lintspaces-cli

raw JSON →
1.0.0 verified Sat Apr 25 auth: no javascript

CLI tool wrapping the lintspaces library for checking whitespace, indentation, newlines, trailing spaces, and editorconfig compliance in text files. The current stable version is 1.0.0, released with lintspaces v0.12.0, reverting the default .editorconfig loading introduced in v0.8.0. It supports glob patterns, regex ignores, JSON output, and dotfile matching; designed for simple shell usage without a build system. Release cadence is infrequent, with major updates tied to lintspaces releases.

error Error: Cannot find module 'lintspaces'
cause Global install of lintspaces-cli doesn't include lintspaces as a dependency?
fix
Ensure lintspaces is installed (npm install -g lintspaces-cli should pull it). If not, install lintspaces globally: npm install -g lintspaces
error Invalid regular expression: /[object Object]/: invalid group
cause Passed --regexignores without properly quoting the regex pattern.
fix
Use properly formatted regex: --regexignores '/\d+/'
error is not a file
cause The glob pattern didn't match any files or matched a directory.
fix
Update to v0.7.1+ or ensure glob only matches files, not directories.
breaking v1.0.0 no longer automatically loads .editorconfig from the current working directory; use -e explicitly if needed.
fix Add -e .editorconfig or specify the full path to your editorconfig file.
deprecated v0.8.0 introduced automatic .editorconfig loading, but this was reverted in v1.0.0. Relying on the old behavior will break on upgrade.
fix Update scripts to include -e .editorconfig if needed.
gotcha Glob patterns must be quoted on Unix shells to prevent expansion before being passed to the CLI. E.g., use "src/**/*.js" without quotes may not work.
fix Always quote glob patterns: lintspaces -n -t "src/**/*.js"
gotcha Options are normalized to lowercase, so --JSON is invalid. Use --json exactly.
fix Use --json in lowercase.
npm install lintspaces-cli
yarn add lintspaces-cli
pnpm add lintspaces-cli

Show how to use lintspaces-cli via npx to check JavaScript and CSS files for trailing spaces, newline at EOF, and 2-space indentation.

npx lintspaces -n -t -d spaces -s 2 src/**/*.js src/**/*.css