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.
Common errors
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()'.
Warnings
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).
Install
npm install sass-lint-format-scss-lint yarn add sass-lint-format-scss-lint pnpm add sass-lint-format-scss-lint Imports
- default wrong
const formatter = require('sass-lint-format-scss-lint');correctimport formatter from 'sass-lint-format-scss-lint'; - format wrong
import { format } from 'sass-lint-format-scss-lint';correctconst format = require('sass-lint-format-scss-lint'); - use as sass-lint formatter wrong
sassLint.lintFiles({options}, {formatter: 'scss-lint'});correctconst sassLint = require('sass-lint'); const formatter = require('sass-lint-format-scss-lint'); sassLint.lintFiles({options}).then(results => console.log(formatter(results)));
Quickstart
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));