git-style-lint

raw JSON →
1.1.14 verified Fri May 01 auth: no javascript

A tool that runs stylelint (currently for *.scss files) only on changed lines in a git repository, designed for pre-commit hooks. Version 1.1.14 requires Node.js v8.x or higher, with version for 6.x in progress. It differs from full-file linters by focusing only on modified lines, providing faster feedback in pre-commit workflows, and is specifically tailored for SCSS files.

error Error: Cannot find module 'stylelint'
cause stylelint not installed as a peer dependency
fix
npm install stylelint --save-dev
error SyntaxError: Unexpected token import
cause Node.js version <8 doesn't support ES modules
fix
Use CommonJS: const gitStyleLint = require('git-style-lint') or upgrade Node.
breaking Requires Node.js v8+; earlier versions unsupported.
fix Upgrade Node.js to v8 or higher.
gotcha Only supports *.scss files currently, not CSS or other preprocessors.
fix Ensure files are .scss or extend package to support other formats.
deprecated Version for Node.js v6.x was planned but never released; use v8+.
fix Use Node.js >=8.
npm install git-style-lint
yarn add git-style-lint
pnpm add git-style-lint

Shows basic usage: import package, configure with stylelint, lint changed lines in SCSS files.

import gitStyleLint from 'git-style-lint';
import stylelint from 'stylelint';

const result = await gitStyleLint({
  files: ['src/**/*.scss'],
  linter: stylelint.lint,
  config: {
    extends: 'stylelint-config-standard-scss'
  }
});

console.log('Lint results:', result);