broccoli-sass-lint

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

A Broccoli plugin that provides pure Node.js scss/sass linting using sass-lint. Version 1.1.2 is the latest stable release with infrequent updates. It integrates seamlessly into Broccoli build pipelines, offering options for configuration, error handling, logging, custom test generation, and support for persistent filtering. Unlike CLI-based linters, this package is designed specifically for Broccoli-based projects.

error Error: Cannot find module 'sass-lint'
cause Missing sass-lint as a dependency
fix
Run npm install --save-dev sass-lint
error TypeError: SassLinter is not a constructor
cause Using import instead of require, or incorrectly destructuring
fix
Use const SassLinter = require('broccoli-sass-lint');
deprecated sass-lint package is deprecated; consider using stylelint with scss plugin instead
fix Migrate to stylelint-config-standard-scss and broccoli-stylelint
gotcha If shouldThrowExceptions is false, errors will not stop the build, which may lead to uncaught lint errors
fix Set shouldThrowExceptions: true to ensure errors break the build
breaking In version 1.1.0, the constructor API changed from accepting options as first argument to accepting input tree and options
fix Use new SassLinter(inputTree, options) instead of new SassLinter(options)
npm install broccoli-sass-lint
yarn add broccoli-sass-lint
pnpm add broccoli-sass-lint

Shows how to instantiate the linter with options and integrate into a Broccoli build

const SassLinter = require('broccoli-sass-lint');

const linter = new SassLinter('app/styles', {
  configPath: '.sass-lint.yml',
  shouldThrowExceptions: true,
  shouldLog: true,
});

// In a Brocfile.js, export linter or use with broccoli mergeTrees
const broccoli = require('broccoli');
const tree = linter; // or merge with other trees

module.exports = tree;