Registry / devops / sass-lint-auto-fix

sass-lint-auto-fix

JSON →
library0.21.2jsnpmunverified

A CLI tool that automatically fixes common sass-lint issues by parsing Sass/SCSS into an AST and modifying nodes to conform to rules defined in .sass-lint.yml. Currently at v0.21.2 (August 2020) with no updates since. It complements sass-lint (not stylelint) and supports SCSS and Sass syntax. Key differentiators: resolves issues via gonzales-pe AST manipulation; supports custom config files and husky pre-commit hooks. Alternatives: stylelint with --fix, Prettier. Note: sass-lint is deprecated in favor of stylelint, making this tool also effectively deprecated.

npm install sass-lint-auto-fix
INSTALL
IMPORT
SIG · SASS-LINT-AUTO-FIX
S
sass-lint-auto-fix
devopsjavascriptv0.21.2
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.

sassLintAutoFix
const sassLintAutoFix = require('sass-lint-auto-fix')
import * as sassLintAutoFix from 'sass-lint-auto-fix'
Package is CommonJS only; no named exports. Use require().
CLI usage
npx sass-lint-auto-fix "**/*.scss"
sass-lint-auto-fix "**/*.scss"
If installed globally, the command is sass-lint-auto-fix. npx works for local installs.
Configuration import (cosmiconfig)
// uses .sass-lint-auto-fix.yml automatically
require('sass-lint-auto-fix').config
Configuration is loaded automatically through cosmiconfig, not exported.

Shows install, script configuration, and running the auto-fix via CLI or npx.

// Install as dev dependency npm install --save-dev sass-lint-auto-fix sass-lint // Add to package.json { "scripts": { "lint": "sass-lint -v", "lint:fix": "sass-lint-auto-fix" } } // Run npm run lint:fix // Or with npx (no install) npx sass-lint-auto-fix "src/**/*.scss" --config-sass-lint .sass-lint.yml
sass-lint-auto-fix --version
Debug
Known issues
deprecatedsass-lint is deprecated; consider migrating to stylelint. sass-lint-auto-fix only works with sass-lint.
fix
Migrate to stylelint and use stylelint --fix or prettier for formatting.
affects: >=0.18.0
breakingv0.21.0 changed config loading to use cosmiconfig; old config file paths may not work.
fix
Ensure your configuration file is named .sass-lint-auto-fix.[yml|yaml|json|js] or specify custom path with --config.
affects: >=0.21.0
gotchaThe tool may exit with code 0 even if fixes were applied; fixed in v0.21.2.
fix
Upgrade to v0.21.2 or later to get correct exit codes.
affects: <0.21.2
gotchaSome rules like indentation are not supported as resolvers; they remain as 0 in config.
fix
Check the list of supported resolvers in the default config; unsupported rules must be fixed manually.
affects: all
deprecatedThe package has had no releases since 2020 and is considered unmaintained.
fix
Use alternatives like stylelint --fix, Prettier, or sass formatter.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'sass-lint'
sass-lint is a peer dependency and must be installed separately.
fix
Run npm install --save-dev sass-lint
Error: No files matched pattern: "**/*.s+(a|c)ss"
The glob pattern does not match any files, or the pattern is incorrectly quoted.
fix
Ensure the pattern is correct and quoted. For example: sass-lint-auto-fix "src/**/*.scss"
Error: Unsupported syntax - only scss and sass supported
The input file has an extension other than .scss or .sass, e.g., .css.
fix
Only lint .scss and .sass files; convert .css to .scss or use a different tool.
TypeError: Cannot read property 'remove' of undefined
A bug in the rule resolver or an AST inconsistency; often occurs on edge cases with custom syntax.
fix
Upgrade to latest version (0.21.2) or isolate the file and disable the problematic resolver.
Upgrade
Version history
0.21.2latest on npm
Audit
Dependencies
sass-lintrequiredCore linting rules that the auto-fix resolves
Agent activity
6 hits · last 30 days
node
4
Bingbot
1
Resources
sass-lint-auto-fix — npm install sass-lint-auto-fix · libregistry