stylelint-standard

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

stylelint-standard is a fixed lint configuration package for stylelint, currently at version 1.2.3. It provides a standard set of CSS linting rules with minimal configuration. It is actively maintained with regular releases and includes TypeScript type definitions. Unlike other stylelint configs, it focuses on stability and performance.

error TypeError: stylelintStandard is not a function
cause Using default import incorrectly as a function instead of configuration object.
fix
Use stylelintStandard directly as config: stylelint.lint({ config: stylelintStandard })
error Cannot find module 'stylelint-standard'
cause Package not installed or import path incorrect.
fix
Run 'npm install stylelint-standard' and ensure correct import.
breaking Breaking change in v1.0.0: Config format changed from array to object.
fix Update config import to use default export instead of array.
deprecated Deprecated: Use of deprecated rule 'block-no-empty' removed in v1.2.0, replaced by 'declaration-block-no-duplicate-properties'.
fix Remove deprecated rule from custom config.
gotcha stylelint-standard does not include auto-fix rules; you must use stylelint --fix separately.
fix Run stylelint with --fix flag for auto-correction.
npm install stylelint-standard
yarn add stylelint-standard
pnpm add stylelint-standard

Lint a CSS string using the standard configuration and log warnings.

import stylelint from 'stylelint';
import stylelintStandard from 'stylelint-standard';

const result = await stylelint.lint({
  code: '.foo { color: red; }',
  config: stylelintStandard,
});

console.log(result.results[0].warnings);