A Node.js CLI and equivalent JS API to find unused ECMAScript module exports in a project.
.mts
and .cts
:
findUnusedExports
option moduleGlob
and the CLI command find-unused-exports
argument --module-glob
default value from "**/*.{mjs,cjs,js}"
to "**/{!(*.d).mts,!(*.d).cts,*.{mjs,cjs,js}}"
; .mts
and .cts
files (but not TypeScript definition files) are now recursively matched by default..mjs
that doesn’t match an existing file now resolves to a file at the same path with an .mts
file extension, if it exists..mts
and .cts
files with Babel, even when the project has no Babel config for TypeScript.snapshot
import to assertSnapshot
in tests.findUnusedExports
parameter destructuring to workaround a recently introduced TypeScript bug: microsoft/TypeScript#50286.^14.17.0 || ^16.0.0 || >= 18.0.0
.node:
URL scheme for Node.js builtin module imports.fs
to node:fs/promises
.jsconfig.json
:
compilerOptions.maxNodeModuleJsDepth
to 10
.compilerOptions.module
to nodenext
.actions/checkout
to v3.actions/setup-node
to v3.Record
types with index signatures.^12.22.0 || ^14.17.0 || >= 16.0.0
.files
and exports
fields../package
from the package exports
field; the full package.json
filename must be used in a require
path./public/
.sideEffects
field.jsdoc-md
dev dependency and the related package scripts, replacing the readme “API” section with a manually written “Exports” section.types
script.replace-stack-traces
dev dependency in tests.kleur
chaining API.singleQuote
to the default, false
.license.md
MIT License file.^12.20 || >= 14.13
..mjs
files instead of CJS in .js
files, accessible via import
but not require
.package.json
exports
field public subpath folder mapping (deprecated by Node.js) with a subpath pattern..cjs
file extension.hard-rejection
to detect unhandled Promise
rejections in tests, as Node.js v15+ does this natively.actions/checkout
to v2.actions/setup-node
to v2.CI
environment variable as it’s set by default.jsdoc-md
v10 automatically generates a Prettier formatted readme.test:jsdoc
script that checks the readme API docs are up to date with the source JSDoc.replaceStackTraces
.scanModuleFile
and scanProject
.CliError
class.u
mode.find-unused-exports
CLI errors.dynamicImport
and objectRestSpread
plugins from the Babel parser config, as they are enabled by default nowadays.CliError
instances have correct name
properties.stripStackTraces
test helper with a smarter replaceStackTraces
helper that allows tests to detect a missing stack trace..ans
file extension for snapshot text files containing ANSI formatting.npm-debug.log
from the .gitignore
file as npm v4.2.0+ doesn’t create it in the current working directory.npm install-test
command.kleur
releases.forEach
loops to for…of
syntax.Initial release.