lint-changed
raw JSON → 0.0.0-development verified Fri May 01 auth: no javascript abandoned
Run linters against git-changed files (both staged and unstaged) to enforce code quality before commit. Version 0.0.0-development, based on lint-staged but differs by including modified-but-unstaged files via changed-git-files instead of staged-git-files. Supports ESLint, stylelint, and other linters for JavaScript, CSS, SCSS, and more. No active maintenance or releases beyond the initial development version. Key differentiator: lints all changed files, not just staged ones, useful for pre-commit checks.
Common errors
error TypeError: lintChanged is not a function ↓
cause Used CommonJS require on an ESM-only module.
fix
Change to 'import lintChanged from 'lint-changed'' or use dynamic import.
error Error: Cannot find module 'changed-git-files' ↓
cause Missing peer dependency 'changed-git-files'.
fix
Install it: npm install changed-git-files --save-dev
error SyntaxError: Unexpected token 'export' ↓
cause Running in a CommonJS environment without transpilation.
fix
Use a bundler or Node with --experimental-modules flag.
Warnings
deprecated Package is marked as 0.0.0-development and has no stable release; consider using lint-staged instead. ↓
fix Switch to lint-staged for a maintained and stable alternative.
breaking Package is ESM-only and cannot be used with CommonJS require. ↓
fix Use import syntax or dynamic import().
gotcha The package may not handle large repositories efficiently; no performance guarantees. ↓
fix Test with your codebase size; consider limiting file patterns.
Install
npm install lint-changed yarn add lint-changed pnpm add lint-changed Imports
- lintChanged wrong
const lintChanged = require('lint-changed')correctimport lintChanged from 'lint-changed'
Quickstart
import lintChanged from 'lint-changed';
const result = await lintChanged({
linters: {
'*.js': ['eslint --fix'],
'*.css': ['stylelint --fix']
},
// optional: directory to search for git repo
cwd: process.cwd()
});
console.log('Linting complete:', result);