broccoli-scss-linter

raw JSON →
3.1.0 verified Fri May 01 auth: no javascript maintenance

Broccoli plugin that integrates sass-lint for linting SCSS/SASS files in Broccoli build pipelines. Version 3.1.0 is the latest, targeting Node ≥0.10.0. It wraps sass-lint, providing a config option for custom lint rules. Limited maintenance; the underlying sass-lint has been deprecated in favor of stylelint with SCSS plugin. Use this only for legacy Broccoli projects stuck on sass-lint.

error Error: Cannot find module 'sass-lint'
cause sass-lint is a peer dependency not automatically installed via npm install.
fix
Run: npm install sass-lint --save-dev
error TypeError: ScssLinter is not a constructor
cause Using default import (ESM) or incorrect require path.
fix
Use require('broccoli-scss-linter') (CommonJS) and ensure to use new keyword.
error Configuration file '.scss-lint.yml' not found
cause The config option points to a file that does not exist or is not relative to the project root.
fix
Provide absolute or relative path from the project root; ensure file exists.
gotcha Constructor expects an array of input nodes. Passing a single node (not wrapped in array) will throw: 'Expected an array of nodes'
fix Wrap the input node in an array: new ScssLinter([inputNode], options)
deprecated sass-lint is deprecated in favor of stylelint with scss plugin. This package wraps sass-lint and will not receive updates.
fix Migrate to stylelint with @stylelint/postcss-css-in-js or similar for Broccoli.
gotcha The package does not support ESM imports; using import will fail.
fix Use CommonJS require() instead of ES import.
npm install broccoli-scss-linter
yarn add broccoli-scss-linter
pnpm add broccoli-scss-linter

Shows basic usage: create a ScssLinter instance for a directory, optionally with a config file, and integrate into Broccoli pipeline.

var ScssLinter = require('broccoli-scss-linter');
var funnel = require('broccoli-funnel');

// Assuming 'app/styles' contains .scss files
var linted = new ScssLinter(['app/styles'], {
  config: '.scss-lint.yml' // optional custom config
});

// Merge with other trees
var merge = require('broccoli-merge-trees');
module.exports = merge([linted, otherTrees]);