Registry / testing / ng-lint-staged

ng-lint-staged

JSON →
library12.0.4jsnpmunverified

ng-lint-staged is a shim that transforms the file list from lint-staged into the appropriate CLI option for Angular's lint builder. Version 12.0.4 supports the @angular-eslint/builder:lint with --lint-file-patterns flag. It handles the argument transformation needed because lint-staged provides a flat list of files while Angular expects a specific format. Regularly updated to support newer Angular versions. Key differentiator: eliminates the need for manual file mapping scripts when using lint-staged with Angular projects.

npm install ng-lint-staged
INSTALL
IMPORT
SIG · NG-LINT-STAGED
N
ng-lint-staged
testingjavascriptv12.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import ngLintStaged from 'ng-lint-staged'
const ngLintStaged = require('ng-lint-staged')
Package is ESM-only? Versions >=7.0.0 are CommonJS; but default import works.
ngLintStaged or no named export?
npx ng-lint-staged lint --fix --
The package is a CLI tool, not a library; no importable symbols. Use npx or add to lint-staged config.
lint-staged config usage
"src/**/*.ts": ["ng-lint-staged lint --fix --"]
"src/**/*.ts": ["ng lint --fix --files"]
Must include trailing '--' to separate files list.

Configure lint-staged to use ng-lint-staged for linting staged .ts files with Angular CLI.

// In package.json, add lint-staged configuration: // "lint-staged": { // "src/**/*.ts": ["ng-lint-staged lint --fix --"] // } // Then run: npx lint-staged
Debug
Known issues
breakingVersion 12.0.0+ changed the CLI flag from --files to --lint-file-patterns (for eslint builder).
fix
Update your lint-staged command: use 'ng-lint-staged lint --fix --' (no explicit flag needed).
affects: >=12.0.0
breakingVersion 7.0.0+ dropped support for tslint builder (now only eslint).
fix
If using tslint, stick with ng-lint-staged <7.0.0.
affects: >=7.0.0
gotchaMissing trailing '--' in the command will cause the files argument to be interpreted as part of the command.
fix
Always append '--' at the end of the ng-lint-staged command.
affects: >=0.0.0
gotchaThe command assumes an npm script named 'lint' exists. If your script is named differently, the command will fail.
fix
Ensure package.json has a 'lint' script that runs 'ng lint <project>'. Or specify a different script name after 'ng-lint-staged'.
affects: >=0.0.0
deprecatedVersion 12.0.4 may be deprecated; check latest version.
fix
Run 'npm outdated ng-lint-staged' to check for newer versions.
affects: 12.0.4
Errors
Common errors & fixes
Error: Cannot find module 'ng-lint-staged'
ng-lint-staged is not installed globally or locally.
fix
Run 'npm install --save-dev ng-lint-staged' in your project.
Unknown option: --files
Using older ng-lint-staged version with eslint builder.
fix
Upgrade ng-lint-staged to >=12.0.0, or use --lint-file-patterns instead of --files.
ng-lint-staged: lint-staged file list must be appended after '--'
Missing '--' separator in the command.
fix
Ensure the command ends with '--' like: 'ng-lint-staged lint --fix --'
Upgrade
Version history
12.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
ng-lint-staged — npm install ng-lint-staged · libregistry