パッケージの詳細

stylelint-define-config

stylelint-types10.9kMIT16.21.0

Provide a defineConfig function for stylelint.config.js files

config, configuration, define-config, stylelint-config

readme

stylelint-define-config

Static Badge npm npm peer dependency version npm GitHub License

Provide a defineConfig function for stylelint.config.js.

Install

npm i -D stylelint-define-config
# or
pnpm add -D stylelint-define-config
# or
yarn add -D stylelint-define-config

Usage

By default only stylelint's rules are supported. To activate auto-suggestions for Rules of specific plugins, you need to install the respective types for that plugin.

Plugins can either support their own types, or they could be supported by the community in the @stylelint-types repository.

stylelint.config.js

// @ts-check
const defineConfig = require('stylelint-define-config')

/// <reference types="@stylelint-types/stylelint-scss" />

module.exports = defineConfig({
  extends: 'stylelint-config-standard',
  rules: {
    // ...rules
  }
})

Why?

Improve your stylelint configuration experience with:

  • auto-suggestions
  • type checking (Use // @ts-check at the first line in your stylelint.config.[c,m]js)
  • documentation

rule

secondary

Community Plugins

Want to support your own plugin?

:warning: This feature is very new and requires the support of the respective plugin owners

Add a declare module to your plugin package like this:

declare module 'stylelint-define-config' {
  export interface CustomRuleOptions {
    /**
     * Require or disallow a newline after the closing brace of `@else` statements.
     *
     * @see [at-else-closing-brace-newline-after](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/at-else-closing-brace-space-after)
     */
    'scss/at-else-closing-brace-newline-after': AtElseClosingBraceNewlineAfterOptions

    // ... more Rules
  }
}
import { RuleConfig } from 'stylelint-define-config'

export type AtElseClosingBraceNewlineAfterOptions = RuleConfig<'always-last-in-chain', {
  disableFix?: boolean
}>

There are other interfaces that can be extended.

  • CustomExtends
  • CustomPlugins
  • CustomSyntax

LICENSE

MIT

更新履歴

16.21.0 (2025-06-22)

Features

  • add ignore: ["after-custom-property"] to custom-property-empty-line-before (0363113)
  • update stylelint to 16.21.0 (3e5ffba)

16.19.0 (2025-04-25)

Features

  • add exceptWithoutPropertyFallback: [] to function-allowed-list (a816c4b)
  • add ignore: ["four-into-three-edge-values"] to shorthand-property-no-redundant-values (de71c9a)
  • update stylelint to 18.19.0 (7ffa2ab)

16.18.0 (2025-04-17)

Features

  • add color-function-alias-notation rule (d6a4885)
  • add container-name-pattern rule (b4bb5e1)
  • bump stylelint to 16.18.0 (1dc3038)

16.17.0 (2025-04-05)

Bug Fixes

Features

  • add ignorePreludeOfAtRules: [] to length-zero-no-unit (a73ff8c)
  • add layer-name-pattern rule (ef8984d)
  • bump stylelint to 16.17.0 (830ad1b)

16.15.0 (2025-03-02)

Features

  • add languageOptions configuration property (3b6204f)
  • add syntax-string-no-invalid rule (629221e)
  • regex support to ignoreAtRules option of at-rule-empty-line-before (8e0592d)
  • update stylelint to 16.15.0 (bba7988)

16.14.1 (2025-01-30)

Bug Fixes

  • replace StandardPropertiesMap to KebabCaseStandardPropertiesMap, close #1 (962efb7)

16.14.0 (2025-01-26)

Features

  • add replaced text and corresponding range to Warning type (1790682)
  • bump stylelint to 16.14.0 (660ed15)

16.13.0 (2025-01-20)

Features

  • add "ignore": ["at-rule-preludes", "declaration-values"] to string-no-newline (3d26b39)
  • add at-rule-descriptor-no-unknown rule (5dd4057)
  • add at-rule-descriptor-value-no-unknown rule (df276d1)
  • add at-rule-no-deprecated rule (4b5c52c)
  • add at-rule-prelude-no-invalid rule (4208f2d)
  • add declaration-property-value-keyword-no-deprecated rule (84e1997)
  • add lax / strict values to the fix Node.js API option and CLI flag (4a86a60)
  • bump stylelint to 16.13.0 (18d6d83)

Performance Improvements

  • update some rules messageArgs (cdec711)

1.8.1 (2024-12-15)

Features

  • bump stylelint to 16.12.0 (fae3ba4)

1.8.0 (2024-11-30)

Features

  • add ignoreFunctions: [] to media-query-no-invalid (cca29af)
  • add name configuration property under overrides (a9e93b1)
  • add reportUnscopedDisables option (fe45ded)
  • update stylelint to 16.11.0 (b138f97)

1.7.0 (2024-10-29)

Features

  • add formatter configuration property (4d9584b)
  • add support for string | RegExp to ignoreValues option of value-no-vendor-prefix (c0ed9fc)
  • add support for string to ignoreLonghands option of declaration-block-no-redundant-longhand-properties (c975bf4)
  • update stylelint to 16.10.0 (0ab1ac4)

1.6.0 (2024-08-18)

Features

  • add url secondary option (5d0c69f)
  • update stylelint to v16.8.x (61de38c)

1.5.0 (2024-5-3)

Features

  • regex support to ignoreValues for value-no-vendor-prefix (d9b079e)

1.4.0 (2024-4-28)

Features

  • add ignore: ["keyframe-selectors"] to rule-selector-property-disallowed-list (47ee8f6)
  • add ignoreLonghands: [] to declaration-block-no-redundant-longhand-properties (94a2924)
  • add no-unknown-custom-media (b78279f)

1.3.0 (2024-4-9)

Features

  • add ignoreSelectors: [] to selector-max-compound-selectors (82a1148)

Performance Improvements

  • update stylelint to v16.3.1 (944cede)

1.2.0 (2024-2-20)

Features

  • ignore: ["keyframe-selectors"] to selector-disallowed-list (62c8a1f)
  • checkContextFunctionalPseudoClasses: [] to selector-max-id (775da81)
  • media-query-no-invalid specific problem messages (c7cabbf)
  • add KebabCaseStandardPropertiesMap type (eb32e76)
  • add lightness-notation rule (22992bb)
  • add viewport unit types (4b844cc)
  • rename @stylistic/stylelint-plugin (5c80fb7)

Performance Improvements

  • bump non-major deps to latest (60fccd1)

1.1.0 (2023-12-16)

Features

1.0.2 (2023-12-15)

Performance Improvements

1.0.1 (2023-12-12)

Performance Improvements

1.0.0 (2023-12-11)

Features