scsslint

raw JSON →
0.0.3 verified Fri May 01 auth: no javascript abandoned

Legacy Node.js bindings for the Ruby-based scss-lint tool (v0.0.3). This package wraps the Ruby gem and provides a simple API to lint SCSS files programmatically from Node.js. It is part of the grunt-scsslint ecosystem and has not been updated since 2014. It requires Ruby and the scss-lint gem to be installed separately. Not to be confused with modern SCSS linters like stylelint-scss. Active development ceased; use at your own risk.

error Cannot find module 'scsslint'
cause Package not installed or npm failed to install due to missing Ruby dependencies.
fix
Run npm install scsslint --save and ensure Ruby is installed.
error ScssLinter is not a constructor
cause Called `ScssLinter()` without `new`.
fix
Change to new ScssLinter().
error sh: scss-lint: command not found
cause Ruby gem scss-lint is not installed or not in PATH.
fix
Install Ruby, then run gem install scss-lint.
error TypeError: linter.lint is not a function
cause Import failed or the package didn't load correctly (e.g., due to CJS/ESM mismatch).
fix
Use CommonJS require and ensure the package is installed properly.
breaking Requires Ruby and scss-lint gem installed separately. Without them, the package will fail silently or throw a cryptic error.
fix Install Ruby and run `gem install scss-lint` before using this package.
gotcha The package exports a constructor, not a factory. Calling `ScssLinter()` without `new` will not create a proper instance.
fix Always use `new ScssLinter()`.
deprecated The underlying scss-lint Ruby gem is deprecated and unmaintained. Use stylelint with scss plugin instead.
fix Migrate to stylelint and @stylelint/postcss-css-in-js or similar modern tooling.
gotcha The `lint` method expects files as an array of strings, options object, and a callback. Incorrect argument ordering will cause unexpected behavior.
fix Ensure arguments are: files (array), options (object), callback (function).
gotcha No error handling if the scss-lint gem is not installed; the callback may never be called or receive an error.
fix Check for Ruby and scss-lint availability before using the package, or wrap call in try-catch.
npm install scsslint
yarn add scsslint
pnpm add scsslint

Shows how to install, require, instantiate, and call the lint method with files, options, and callback.

const ScssLinter = require('scsslint');
const linter = new ScssLinter();

linter.lint(
  ['path/to/file.scss', 'path/to/another.scss'],
  { colorize: true, verbose: true },
  function(err, result) {
    if (err) {
      console.error('Lint error:', err);
    } else {
      console.log('Lint result:', result);
    }
  }
);