happiness-scss

raw JSON →
5.3.0 verified Fri May 01 auth: no javascript deprecated

A SCSS/Sass linter based on sass-lint that enforces a 'happiness' style guide, similar to the JavaScript happiness linter. Current stable version is 5.3.0 (last released in 2017). It provides a CLI tool and Node.js API to check .scss and .sass files for style errors. Key differentiators: it is a simple, opinionated linter with minimal configuration, intended to bring consistency without debate. However, the project is no longer maintained, and sass-lint itself is deprecated in favor of stylelint. Use in legacy projects only.

error Error: Cannot find module 'sass-lint'
cause sass-lint dependency missing or not installed.
fix
Run 'npm install sass-lint' as a dependency.
error happiness-scss: command not found
cause happiness-scss not installed globally or not in PATH.
fix
Install globally: 'npm install -g happiness-scss' or use npx: 'npx happiness-scss'.
error TypeError: happiness.lintFiles is not a function
cause Using wrong import/require or older version without that API.
fix
Use 'const happiness = require('happiness-scss');' and call happiness.lintFiles() from v5+.
deprecated happiness-scss is no longer maintained. Use stylelint instead.
fix Migrate to stylelint with stylelint-config-standard-scss.
deprecated sass-lint is deprecated. happiness-scss wraps sass-lint and thus inherits its deprecation.
fix Switch to stylelint and stylelint-scss plugin.
gotcha The CLI does not respect .sass-lint.yml configuration by default; it uses its own built-in rules.
fix Use '--config' flag to specify custom config file if needed.
gotcha Ignore pattern defaults to ./node_modules/** but does not ignore other common directories like .git, bower_components.
fix Explicitly add ignore patterns for other directories using -i option.
npm install happiness-scss
yarn add happiness-scss
pnpm add happiness-scss

Shows CLI usage and Node.js API for linting SCSS/Sass files using happiness-scss.

// Install: npm install -g happiness-scss
// Check all .scss files in current directory and subdirectories:
happiness-scss
// Or specify a glob pattern:
happiness-scss "./src/**/*.scss"
// Use different formatter:
happiness-scss -f table
// Ignore patterns:
happiness-scss -i "./test/vendor/**"
// Node.js API:
const happiness = require('happiness-scss');
happiness.lintFiles('./src/**/*.scss', {
  formatter: 'stylish',
  options: {
    'merge-default-rules': false
  }
}).then(results => {
  console.log(results);
});