Skip to main content

Js

Struct Js 

Source
#[non_exhaustive]
pub struct Js {
Show 27 fields pub enabled: bool, pub entry: Vec<String>, pub project: Vec<String>, pub ignore: Vec<String>, pub ignore_files: Vec<String>, pub ignore_dependencies: Vec<String>, pub ignore_binaries: Vec<String>, pub ignore_global_binaries: bool, pub ignore_unresolved: Vec<String>, pub ignore_workspaces: Vec<String>, pub ignore_exports_used_in_file: IgnoreExportsUsedInFile, pub ignore_members: Vec<String>, pub production: bool, pub isolate_workspaces: bool, pub no_gitignore: bool, pub include_entry_exports: bool, pub tsconfig: Option<String>, pub use_tsconfig_files: bool, pub include_fixtures: bool, pub discovery: JsDiscovery, pub cycles: JsCycles, pub workspaces: IndexMap<String, JsWorkspace>, pub plugins: IndexMap<String, PluginConfig>, pub extend_ignore: Vec<String>, pub extend_ignore_dependencies: Vec<String>, pub extend_ignore_binaries: Vec<String>, pub extend_ignore_unresolved: Vec<String>,
}
Expand description

[js]

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§enabled: bool

Run the JavaScript analysis.

§entry: Vec<String>

Entry-point globs, added to the ones plugins and package.json provide.

§project: Vec<String>

Globs of the files that belong to the project.

§ignore: Vec<String>

Globs of files that are not analysed.

§ignore_files: Vec<String>

Globs of files, relative to the workspace root, never reported by unused-files; other rules still analyse them (knip’s ignoreFiles).

§ignore_dependencies: Vec<String>

Dependencies never reported as unused or unlisted.

§ignore_binaries: Vec<String>

Binaries never reported as unlisted.

§ignore_global_binaries: bool

Never report the system and shell tools scripts run (rm, curl, git, docker) as unlisted binaries, since they are installed globally rather than from npm (knip’s ignoreGlobalBinaries). On by default; turn it off to have unlisted-binaries report them unless a dependency provides them.

§ignore_unresolved: Vec<String>

Import specifiers never reported as unresolved. Entries are exact specifiers, globs or regular expressions (/^@org\/.+$/), see the [js] documentation.

§ignore_workspaces: Vec<String>

Workspace directories (globs) the JavaScript analysis skips. Manifest and policy rules still check them.

§ignore_exports_used_in_file: IgnoreExportsUsedInFile

Exports that other code in the same file uses are not reported: true for every kind, or a table of kinds.

§ignore_members: Vec<String>

Enum and namespace member names (globs or regular expressions) never reported as unused.

§production: bool

Analyse production code only.

§isolate_workspaces: bool

knip’s strict mode. Each workspace package uses only the dependencies its own manifest lists: an import is not satisfied by a containing package or the root. Production code must import from dependencies or peerDependencies, type-only imports use no package, and required peer dependencies are checked like dependencies. Set by skif --strict; not a configuration key, so a file never sets it.

§no_gitignore: bool

Find source files that .gitignore files hide (the git index is not used then). Set by skif --no-gitignore; not a configuration key.

§include_entry_exports: bool

Report unused exports of entry files too.

§tsconfig: Option<String>

The TypeScript configuration of the root package, relative to the workspace root and inside it, used instead of tsconfig.json for its path aliases and compiler options (knip’s --tsConfig). Other packages keep their own tsconfig.json.

§use_tsconfig_files: bool

The project files of a package with a TypeScript configuration are the files its files names and those its include selects minus its exclude, instead of the project globs (knip’s --use-tsconfig-files).

§include_fixtures: bool

Report files in fixtures and __fixtures__ directories as unused, and their unused exports, types and members, like any other file. Off by default: those directories hold test data that tests load by path.

§discovery: JsDiscovery

How source files are found: auto lists them from the git index and re-lists from disk every directory modified since the index was written, which gives the walk’s result without walking every directory; git trusts the index alone (faster, blind to untracked and deleted files); walk always walks. Both index modes fall back to the walk when the workspace is not in a git work tree with a usable SHA-1 index.

§cycles: JsCycles

What circular-imports reports.

§workspaces: IndexMap<String, JsWorkspace>

Per-workspace overrides keyed by directory. The key "." is the root workspace.

§plugins: IndexMap<String, PluginConfig>

Plugin switches keyed by plugin name.

§extend_ignore: Vec<String>

Appended to ignore instead of replacing it. Folded away when the configuration is resolved.

§extend_ignore_dependencies: Vec<String>

Appended to ignore-dependencies instead of replacing it. Folded away when the configuration is resolved.

§extend_ignore_binaries: Vec<String>

Appended to ignore-binaries instead of replacing it. Folded away when the configuration is resolved.

§extend_ignore_unresolved: Vec<String>

Appended to ignore-unresolved instead of replacing it. Folded away when the configuration is resolved.

Implementations§

Source§

impl Js

Source

pub fn with_entry<I, S>(self, entry: I) -> Js
where I: IntoIterator<Item = S>, S: Into<String>,

Sets the entry globs.

Source

pub fn with_project<I, S>(self, project: I) -> Js
where I: IntoIterator<Item = S>, S: Into<String>,

Sets the project globs.

Source

pub const fn with_enabled(self, enabled: bool) -> Js

Enables or disables the JavaScript analysis.

Source

pub const fn with_production(self, production: bool) -> Js

Restricts the analysis to production code.

Source

pub const fn with_isolate_workspaces(self, isolate: bool) -> Js

Makes each workspace package use only the dependencies its own manifest lists, as knip’s --strict does.

Source

pub fn with_tsconfig(self, path: impl Into<String>) -> Js

Uses path, relative to the workspace root, as the TypeScript configuration of the root package.

Source

pub const fn with_use_tsconfig_files(self, enabled: bool) -> Js

Takes the project files of each package with a TypeScript configuration from its files, include and exclude.

Source

pub fn with_plugin(self, name: impl Into<String>, plugin: PluginConfig) -> Js

Switches a plugin on or off, or configures it.

Trait Implementations§

Source§

impl Clone for Js

Source§

fn clone(&self) -> Js

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Js

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Js

Source§

fn default() -> Js

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Js
where Js: Default,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Js, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Js

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Js

Source§

fn eq(&self, other: &Js) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Js

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Js

Auto Trait Implementations§

§

impl Forget for Js

§

impl Freeze for Js

§

impl RefUnwindSafe for Js

§

impl Send for Js

§

impl Sync for Js

§

impl Unpin for Js

§

impl UnsafeUnpin for Js

§

impl UnwindSafe for Js

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more