Sass-lint scss-lint Default Formatter

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

A formatter plugin for sass-lint that reproduces the default output style of scss-lint. Version 1.1.0 is the latest stable release. Requires sass-lint >= 2.0.0. This package is specifically designed for users migrating from scss-lint to sass-lint who want to maintain the same CLI output format. It is a simple adapter that transforms sass-lint's results into scss-lint's format string. No active development expected; primarily used in legacy projects.

error Error: Cannot find module 'sass-lint-format-scss-lint'
cause Package not installed or not in node_modules.
fix
Run 'npm install sass-lint-format-scss-lint' (or 'yarn add' / 'pnpm add').
error TypeError: formatter is not a function
cause Incorrect import style; using destructuring on a default export that is a function.
fix
Use 'const formatter = require('sass-lint-format-scss-lint');' (CommonJS) or 'import formatter from ...' (ESM).
error sass-lint is not a function
cause Using outdated or incorrect sass-lint API (require('sass-lint') returns an object with methods, not a function).
fix
Use 'sassLint = require('sass-lint');' then invoke 'sassLint.lintFiles()' or 'sassLint.lintText()'.
gotcha The formatter expects the result object from sass-lint.lintFiles() directly; passing an array or modified object may cause errors.
fix Ensure you pass the exact results object returned by sass-lint.lintFiles() (the raw output).
npm install sass-lint-format-scss-lint
yarn add sass-lint-format-scss-lint
pnpm add sass-lint-format-scss-lint

Shows how to use the formatter to convert sass-lint results to scss-lint style output.

const sassLint = require('sass-lint');
const formatter = require('sass-lint-format-scss-lint');

const files = ['src/**/*.scss'];
const options = {
  options: {
    formatter: 'stylish', // default, but we override manually
    cache: false,
  },
  files: { include: files },
};

sassLint.lintFiles(options)
  .then(results => {
    const output = formatter(results);
    console.log(output);
  })
  .catch(err => console.error(err));