Repository navigation
Releases
v0.8.0
Breaking changes
- MCP
linttakesincludeinstead ofrules, with the meaning of--include(rule IDs or knip issue types). - MCP
explain_usageresolvesfileagainst the server's working directory, asskif explain-usagedoes, not
againstpath.
Added
--format toon: the JSON report encoded as TOON (Token-Oriented Object Notation), with the same data.- MCP:
linttakesconfig,no_config,include,exclude,workspace,strictandmax_show_issues. - MCP:
lintwithfixorfix_unsafe(plusfix_type,select,allow_remove_files) returns the dry-run fix plan. - MCP:
explain_usageexplains a dependency (dependency,package) and takesconfigandno_config. - MCP: a
configtool returns the effective configuration, asskif config --format jsondoes. skif::renderre-exports the TOON error renderers beside the JSON ones.
Changed
- The type checker is tsrs 7.1.0-beta.tsrs2 (was tsrs1), and the parser oxc 0.159; the
type-aware.enginefield of
the JSON report names the new checker. - MCP: each tool argument is the
skifflag of the same name, parsed by the command line itself. - npm:
lintandlintAsyncprint the CLI's warnings to stderr, asskifdoes. - MCP: tool results carry compact JSON text instead of pretty-printed JSON, and tool descriptions are shorter.
Fixed
- MCP:
lintnow honours[lint] require-ignore-reasonsand the tsconfig checks, and setsisErrorwhen roots fail. - npm:
lintandlintAsyncnow apply[lint] require-ignore-reasonsand the tsconfig checks, as the CLI does. --format toon: a usage error, an early error or a panic prints theerrordocument in TOON, not nothing.skif migrate: knip's--treat-tag-hints-as-errorsis noted as approximate (tag hints are part of
stale-js-config), as itstreatTagHintsAsErrorskey already was.
v0.7.0
Breaking changes
- The npm package is
@polylint/skif: its platform packages are@polylint/skif-<platform>, andskif-cliand
skif-<platform>on npm are deprecated and receive no new versions. The command staysskif, and Windows x64 and
arm64 now install from npm (ADR 0015). - skif moved to the polylint organization (ADR 0015): the
repository ispolylint/skif, the documentation is at https://polylint.github.io/skif/, the Action is
polylint/skif@v0.M, Homebrew isbrew install polylint/tap/skifand Scoop is
scoop bucket add polylint https://github.com/polylint/scoop-bucket.skif initandskif migratewrite the
#:schemaURL ofpolylint/skif, and SARIF output names it as the tool's information URI.
Added
--performance,--debugandSKIF_TIMINGS=1split the time of the typed programs into config parse, program
creation and bind, report the project files parsed against the distinct ones, and time the query build, the config
hints, the ambient modules, the judged patterns and each JS rule. Timing lines are buffered and written once when
the run ends, so printing them no longer serialises the threads of a recursive run.
Changed
- Faster runs: the module graph parses the files it reaches ahead of its rounds and reuses each file's parse when it is
built again,**workspace globs are expanded in parallel, the pnpm lockfile parser skips the sections no rule
reads, andchild_processcommand analysis is built only when a command needs it.skif -rlints nested roots
alongside their enclosing roots, with the same report. A typed run asks the checker only for escapes that can reach
an asked declaration and for the ancestors only of classes with heritage, and reuses its parsed config for each
program's own config. The programs of a typed run share each project source they read instead of parsing it once
per program, which cuts babel's typed run by about a third. Release builds use fat LTO. - The Homebrew formula is bottled for macOS arm64 and Linux x86_64 and arm64.
- The GitHub Action and the pre-commit launcher verify build attestations against
polylint/skif, and still accept a
release up to v0.6.0 attested byGoldziher/skif, the repository before the move.
Fixed
- A webpack or rspack config built in a function that changes the config after its literal (
config.module.rules.unshift(…)
under a test) credits the loaders of the literal and of the change again, instead of reporting every loader as an
unused dependency. A rule the evaluator cannot see leaves the package unjudged; one unknown
entry in a known loader list (MiniCssExtractPlugin.loader) does not (#248). @polylint/skifis never reported as an unused dependency.- A bundler alias or
pathstarget in the build output of a workspace package (../lib/dist/index.js) stands for
the source that output is built from whether or not the output exists, so the verdicts no longer depend on a local
build (#251). - With
SKIF_TIMINGSor--performance,--watch,skif lspandskif mcpwrite the phase timings after each run
or request, instead of holding them until the process exits, which an interrupted watcher never reached. - A webpack or rspack rule whose whole
useorloaderis computed (use: cssLoaders()), or amodulethe
evaluator cannot read, leaves the package unjudged instead of judged without the loaders it may name. Ausethat
is one of several known loaders credits each.
v0.6.0
v0.5.0
Install
pnpm add -D skif-cli # or npm install -D, yarn add -D, bun add -D
cargo binstall skif-cli # or cargo install skif-cli
brew install goldziher/tap/skifscoop bucket add goldziher https://github.com/Goldziher/scoop-bucket
scoop install skifDocs: https://goldziher.github.io/skif/
Breaking changes
- Public API:
cargo-semver-checksagainst the 0.4.0 crates on crates.io reports
semver requires new major versionforskif-core(constructible_struct_adds_field:Tokens.empty_commands),
skif-js-syntax(enum_marked_non_exhaustiveandenum_no_repr_variant_discriminant_changed:ImportKind) and
skif-js-plugins(constructible_struct_adds_field:PluginContext.members); the bullets below also list the
breaks it does not flag. - Public API:
skif-js-syntax'sImportKindgainsResolve(enum_variant_added) and is#[non_exhaustive],
so amatchon it outside the crate needs a wildcard arm, and later kinds are no longer a breaking change
(#225). - Consumers of
explain-usage --format json,explain-usage --dependencyand--trace-dependency --format json:
arequire.resolve("x"),createRequire(…).resolve("x")orimport.meta.resolve("x")is listed with the import
kindresolveinstead ofrequire(#225). - Library users that build
PluginContextofskif-js-pluginswith a literal: it gainsmembers, the
directories of the run's other packages below the package, whose sources theexeca,zx,nano-spawnandbun
plugins leave out;&[]reads them all (#97). - Library users that build
skif_core::shell::Tokenswith a literal: it gainsempty_commands, the commands of
redirections alone (> "$(x)") asEmptyCommands (#97). - Library hosts that lint nested roots themselves: the files of other projects that a plugin names as build
sources (a Bazelsrcs) moved fromReport::other_project_filesto the new
Report::other_project_build_sources. Pass those below the root, made relative to the nested root that owns them,
toRunOptions::with_extra_build_sourcesof its run, and credit those outside it as the files of
other_project_filesare; a host that reads onlyother_project_filesno longer makes them used
(ADR 0034,
#226).
Added
-
stale-js-configreports a plainentryorprojectpattern that cancels a pattern ending in!of its list
([js]or a[js.workspaces]table): any plain pattern matching the file a!pattern names, as in
entry = ["src/**", "src/main.js!"], or the same glob as a!glob. In a production run the plain pattern excludes
what the!one selects, while in a normal run the!one selects it alone. The hint says to remove the plain
pattern, or the!one if the files are not production code.skif migrate --from knipkeeps both patterns, since
knip also excludes them in production mode (#227). -
Public API (#206):
PackageSources::withinofskif-js-plugins
makes a listing of a package's sources that shares the texts it reads with another listing, and
WorkspaceListing::package_sourcesofskif-jsmakes one that shares them with the run's other packages. -
Public API (#97):
skif-js-syntaxexportsis_plain_word,
shell_quoteandshell_word, which quote a word of a command line as the command plugins do. -
Public API (#226): the build sources a multi-root host hands a
nested root.skif-core:Report::other_project_build_sourcesandReport::with_other_project_build_sources.
skif-lint:Emitter::report_other_project_build_source,Emitter::take_other_project_build_sources,
LintContext::extra_build_sourcesandRunOptions::with_extra_build_sources.skif:
RunOptions::with_extra_build_sources.
Changed
-
Performance (#206):
--watchscans the tree on up to four
threads, so on a large repository it polls more often and sees a change sooner; scanning takes up to about four
thirds of a core instead of a third. The files it compares are unchanged. The plugins that search a
package's sources (pino,zx,execa,nano-spawn,bun) share the texts they read between all packages of a
workspace and their Nx projects, so a source file is usually read once per workspace instead of once for every
package or project that searches it (pinoand theBun.check ofbunalso search a member's sources from the
root package, and every one of them searches an Nx project's sources from its package); packages resolved in
parallel can still read the same file at the same time. The output is unchanged. -
Performance (#224): evaluating a config that follows its imports
parses and analyses a module inside a cycle of imports once per distinct set of answers its imports give, instead of
at every entry; the analysis budget and the findings are unchanged. A change that reaches a whole class of linked
bindings is applied to that class once instead of once per change.ModuleLoader::holds_no_codeis asked once per
importing directory and specifier, asis_installedalready was. -
Performance: the
execa,zx,nano-spawnandbunplugins no longer walk the directories of a package's
members when they list its own sources, so a workspace root lists only its own directories and each member lists
its own, instead of the root walking every member's tree too; when a plugin of the package already listed every
source (pino), the own sources are taken from that listing. The source texts a plugin searches are read in
parallel, or one after the other on a single-threaded run (a library host sets it with the new
PackageSources::sequentialofskif-js-plugins). The output is unchanged. -
Performance: the analysis of which bindings may share a changed object follows a change only where it can reach
a binding the pass asks about, skips a change of a class of linked bindings an earlier change reached in full, and
applies the getters, setters and iterators code may run implicitly once per list of them, so large bundled modules
(a 2.8 MB GitHub Action bundle) parse several times faster. The output is unchanged.
Fixed
- Resolve calls:
require.resolve(x),createRequire(…).resolve(x)andimport.meta.resolve(x)return a path
and load nothing, so they no longer count as a use of every export of the module they name. The file they name stays
in use, what it imports is followed, and a package they name is still a used dependency, but its exports are judged:
unused-exportsnow reports the value exports nothing else imports (unused-typesalready reported its types, as a
resolve call never credited them). A module otherwise read only through a namespace (ns.a) stays namespace-only,
so its unread exports areunused-namespace-exports. A resolve call is no edge ofcircular-imports, and a module
an extensionless JavaScript mise file task only resolves is used but no entry, so its exports are judged too. A
computed relative specifier (require.resolve(`./tpl/${name}`)) is followed as a glob, as a computedrequire
is, and the call is found behind a TypeScript assertion ((require as NodeRequire).resolve(x)).skif-js-syntax
reports the call asImportKind::Resolve, and the analysis cache is invalidated. knip reports nothing for these exports, so the
findings are skif's alone (#225). - Nested roots under
-r: a file of a nested root that an enclosing root's plugin names as a build source (a
Bazelsrcsof the outerBUILDfile) is a build source of the nested root instead of an entry, so its unused
exports are reported there, as they are for a build source of a workspace member; a file the enclosing root also
imports or names as an entry stays an entry. A package of the nested root that such a build source belongs to is no
longer taken as one another root imports, sounused-subpath-exportsnow judges itsexportsunless an enclosing
root imports or runs one of its files
(ADR 0034,
#226). explain-usage: an importer that uses no export says what it takes instead ofthe whole module: a resolve call
its path, no export, a side-effect importruns it, no exportand a test-runner mocka test-runner call, no export(#225).unlisted-binaries: anode:child_process,execa, nano-spawn orBun.spawncall with a literal argument that
is not a plain word (execFileSync("sqlite3", [db, "select …"])) runs its program: the argument is one quoted word
of the command instead of dropping the call, so the binary is judged. The analysis cache is invalidated
(#97).unlisted-binaries,unused-files: a computed argument of such a call ends its command, instead of being left
out while the literals after it stay:spawn("node", [script, "out.js"])no longer runs a fileout.js. The
analysis cache is invalidated (#97).unlisted-binaries,unused-files: a short flag ...
v0.4.0
Install
pnpm add -D skif-cli # or npm install -D, yarn add -D, bun add -D
cargo binstall skif-cli # or cargo install skif-cli
brew install goldziher/tap/skifscoop bucket add goldziher https://github.com/Goldziher/scoop-bucket
scoop install skifDocs: https://goldziher.github.io/skif/
Breaking changes
- Minimum supported Rust: raised to 1.100 for building the crates from source.
- Public API:
cargo-semver-checksagainst the 0.3.0 crates on crates.io reports
semver requires new major versionforskif-js-plugins(constructible_struct_adds_field:DepRef.dir;
struct_pub_field_missing:ScriptInfo.turbo_tasks),skif-rules(enum_variant_added:ToolchainKind::Bazel) and
skif-js(constructible_struct_adds_field:UnlistedBinary.runs_in); the bullets below also list the breaks it
does not flag. - Embedders of
skif-config:Js::isolate_workspacesis workspace isolation only. An embedder that set it for
knip's strict mode setsJs::strict(with_strict), which implies production mode and isolation and adds the
direct-dependency rules;JsAnalysis::strictfollowsstrict.Js::production_modeandJs::isolatedgive the
effective modes.Jsgainsstrict,use_public_hoistingandcompilers, so a struct literal ofJsneeds them
(#221). - Implementers of
skif_js_syntax::ModuleLoader: the trait gainsis_installedandholds_no_code, bothfalse
by default. The evaluator takes adefine…helper, a copying merge and a package whose methods keep nothing at their
word only for a package the loader calls installed, so a loader that does not implementis_installedgets those
calls as unknown; without a loader, every bare specifier counts as installed. - Library users that build these structs with literals or match these enums exhaustively: new public fields must be
set.skif-js-plugins:DepRefgainsdirandreader_lists,PluginContextgainsglobs(aGlobCache) and
sources(anOption<&PackageSources>), andScriptInfo::turbo_tasksis removed.skif-js:Moduleis
#[non_exhaustive](and gainsis_build_source),UnlistedBinarygainsruns_in,ConfigDependencygainsspan
andreader_lists.skif-js-syntax:Exportgainsused_whole_in_file.skif-rules:ToolchainKindgainsBazel
(ADR 0031). - Library users of
skif-workspace:DependencyEntry::nameandDependencyEntry::specifierareArc<str>instead
ofString, so a consumer can keep a name without copying its text; read them as&strwith&*entry.name, which
also compares with a string (&*entry.name == "react") (#206). - Configurations with
[js.workspaces.<dir>.paths]: a key or target with more than one*is a configuration
error, a key without*maps only that specifier, and"alias/*"no longer maps the barealias, as in TypeScript
(#214). - Consumers of
explain-usage --format json: a file loaded withnew URL("./x", import.meta.url)is listed with
the import kindurlinstead ofrequire, a whole use of a module object is no longer listed as a user of its type
exports, and the entry kindsenclosing-incomplete-scope,script(for the source of build output a script runs) and
bin-stubreplaceunknownfor the files they describe (ADR
0125,
#165).
Added
[js] isolate-workspacesand--isolate-workspaces: workspace isolation without production mode. Each workspace
package uses only the dependencies its ownpackage.jsonlists, so one default run checks every package, its tests,
scripts and tool configs included, against its own manifest, development dependencies included.[js] strictis the
configuration counterpart of--strict(production mode, isolation and knip's direct-dependency rules), so CI no
longer needs the flag. Setting the mode in the file gives every run,skif baseline writeandpruneincluded, the
same mode, andstale-js-configjudgesignore-dependenciesentries against that one run.skif migrate --from knip
writes knip's--strictto[js] strict = truewhen every script runs knip with it; when only some scripts do, a
note leaves it to a human. knip 5's--isolate-workspaces, which only split the TypeScript programs, stays without
effect (ADR 0005,
#221).[js.compilers], the static counterpart of knip'scompilers: an extension skif has no reader for is read by regular
expressions with one capture group (html = { imports = ['<script[^>]+src="([^"]+)"'] }), whose captures are imports
resolved from the file, or with one of skif's readers (page = { as = "mdx" }). Such files join the default project,
sounused-filesjudges them, and their imports count as usage and are reported byunresolved-importsand
unlisted-dependencieslike written ones. An invalid entry is a configuration error, andskif migrate --from knip
points a compiler it cannot translate at the table (#209).[js] use-public-hoisting(defaultfalse): a package that pnpm'spublic-hoist-patternorshamefully-hoist
(pnpm-workspace.yaml, else the root.npmrcbefore pnpm 11) or rules_js'spublic_hoist_packageshoists into a
node_modulesabove a package is available to it, so importing it unlisted is nounlisted-dependenciesfinding.
unused-dependenciesand strict mode are unchanged.YamlSourceofskif-workspacegainspublic_hoist_patternand
shamefully_hoist, andskif-js-pluginsexportsbazel::public_hoist_packages(ADR
0123,
#178).- JS rules for knip's
subpathsissue type:unused-subpath-imports(warning) reports apackage.jsonimports
entry that no#specifier of the package's files selects, with an unsafe fix that removes it;
unused-subpath-exports(off by default, as knip'sincludeSubpathExports) reports anexportssubpath that no
workspace package imports by name, the package itself included, and has no fix. A pattern entry (#utils/*,
./features/*) is used when any import matches it, an exact entry wins over a pattern as in Node.js, and a subpath
that publishes no module (./package.json, a stylesheet) is not reported. Production mode reports neither, because
test files may be the only importers.--include subpathsand--fix-type subpathsselect the imports rule, and
skif migrate --from knipmapssubpaths,includeSubpathExportsand--include-subpath-exports
(#208). skif explain-usage --dependency <NAME> [--package <NAME|DIR>]explains why a dependency is used or unused in each
package that lists it: the verdictunused-dependenciesreaches and the importing files, mocks, commands, binaries,
scripts, plugins and tool configs that credit it, or the imports that count for nothing;--format jsonprints the
samereportdocument as the file explanation. The verdict and the evidence come from one record of uses. A package
that does not list the dependency has the verdictnot listed, without a credit from the@types, peer or
always-used rules, and the config files and lines that name a dependency the package does not list are listed
(unlisted-referencesin the JSON) (#150).- Bazel plugin for rules_js repositories: the
BUILD.bazelandBUILDfiles of a package are scanned as Starlark
text.node_moduleslabels (":node_modules/esbuild","//packages/app:node_modules/zod") andpackage_json.bzl
loads ("@npm//packages/app:esbuild/package_json.bzl") use the dependency of the package they name, reported at the
line of the label. A label of an enclosing package'snode_modules("//adev:node_modules/diff") in aBUILDfile
of a nested package counts only for the package it names, and a dependency so named that the labelled package does not
list is unlisted at theBUILDfile for that package. A comprehension that formats each string of a list literal
([":node_modules/%s" % name for name in ["typescript", "vite"]]) names the formatted packages; the patterns of a
glob(...)("node_modules/**"), any other format template and anode_modulestarget that is no valid npm package
name name no dependency. Theentry_pointofjs_binary,js_run_devserverandjs_testis an entry with public
exports. Thesrcsanddataofjs_libraryandts_project, and thedataof the other three, are build sources:
the files are used and what they import is followed, but their exports are not public, sounused-exports,
unused-types, the member rules andduplicate-exportsjudge them as any module's. A file that an entry rule also
matches stays an entry, and a rootBUILDfile can name the sources of a member below it. Those ofjs_testare not
used in production mode.skif-js-pluginsgainsPluginInput::BuildSource,ProductionBuildSourceand
ReaderDependencyandPluginOutput::build_sourcesandproduction_build_sources;WorkspaceInputsgains
build_sourceandproduction_build_source;UsageReportgainsbuild_sourceandchain_from_build_source,
serialized asbuild-sourceand `chain-f...