eslint-plugin-stylelint-2 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +329 -0
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/_internal/rule-docs-url.d.ts +15 -0
- package/dist/_internal/rule-docs-url.d.ts.map +1 -0
- package/dist/_internal/rule-docs-url.js +15 -0
- package/dist/_internal/rule-docs-url.js.map +1 -0
- package/dist/_internal/rules-registry.d.ts +88 -0
- package/dist/_internal/rules-registry.d.ts.map +1 -0
- package/dist/_internal/rules-registry.js +85 -0
- package/dist/_internal/rules-registry.js.map +1 -0
- package/dist/_internal/stylelint-config-boolean-option-rule.d.ts +17 -0
- package/dist/_internal/stylelint-config-boolean-option-rule.d.ts.map +1 -0
- package/dist/_internal/stylelint-config-boolean-option-rule.js +90 -0
- package/dist/_internal/stylelint-config-boolean-option-rule.js.map +1 -0
- package/dist/_internal/stylelint-config-disallowed-option-rule.d.ts +16 -0
- package/dist/_internal/stylelint-config-disallowed-option-rule.d.ts.map +1 -0
- package/dist/_internal/stylelint-config-disallowed-option-rule.js +48 -0
- package/dist/_internal/stylelint-config-disallowed-option-rule.js.map +1 -0
- package/dist/_internal/stylelint-config-object.d.ts +62 -0
- package/dist/_internal/stylelint-config-object.d.ts.map +1 -0
- package/dist/_internal/stylelint-config-object.js +114 -0
- package/dist/_internal/stylelint-config-object.js.map +1 -0
- package/dist/_internal/stylelint-config-package-option-rule.d.ts +12 -0
- package/dist/_internal/stylelint-config-package-option-rule.d.ts.map +1 -0
- package/dist/_internal/stylelint-config-package-option-rule.js +66 -0
- package/dist/_internal/stylelint-config-package-option-rule.js.map +1 -0
- package/dist/_internal/stylelint-config-rules-object.d.ts +23 -0
- package/dist/_internal/stylelint-config-rules-object.d.ts.map +1 -0
- package/dist/_internal/stylelint-config-rules-object.js +47 -0
- package/dist/_internal/stylelint-config-rules-object.js.map +1 -0
- package/dist/_internal/stylelint-config-string-array-option-rule.d.ts +27 -0
- package/dist/_internal/stylelint-config-string-array-option-rule.d.ts.map +1 -0
- package/dist/_internal/stylelint-config-string-array-option-rule.js +234 -0
- package/dist/_internal/stylelint-config-string-array-option-rule.js.map +1 -0
- package/dist/_internal/stylelint-config-string-array-option.d.ts +32 -0
- package/dist/_internal/stylelint-config-string-array-option.d.ts.map +1 -0
- package/dist/_internal/stylelint-config-string-array-option.js +55 -0
- package/dist/_internal/stylelint-config-string-array-option.js.map +1 -0
- package/dist/_internal/stylelint-package-dependencies.d.ts +18 -0
- package/dist/_internal/stylelint-package-dependencies.d.ts.map +1 -0
- package/dist/_internal/stylelint-package-dependencies.js +107 -0
- package/dist/_internal/stylelint-package-dependencies.js.map +1 -0
- package/dist/_internal/stylelint-runner.d.ts +4 -0
- package/dist/_internal/stylelint-runner.d.ts.map +1 -0
- package/dist/_internal/stylelint-runner.js +93 -0
- package/dist/_internal/stylelint-runner.js.map +1 -0
- package/dist/_internal/stylelint-worker-types.d.ts +70 -0
- package/dist/_internal/stylelint-worker-types.d.ts.map +1 -0
- package/dist/_internal/stylelint-worker-types.js +2 -0
- package/dist/_internal/stylelint-worker-types.js.map +1 -0
- package/dist/_internal/stylelint-worker.d.ts +2 -0
- package/dist/_internal/stylelint-worker.d.ts.map +1 -0
- package/dist/_internal/stylelint-worker.js +113 -0
- package/dist/_internal/stylelint-worker.js.map +1 -0
- package/dist/_internal/stylelint2-config-references.d.ts +32 -0
- package/dist/_internal/stylelint2-config-references.d.ts.map +1 -0
- package/dist/_internal/stylelint2-config-references.js +65 -0
- package/dist/_internal/stylelint2-config-references.js.map +1 -0
- package/dist/_internal/typed-rule.d.ts +42 -0
- package/dist/_internal/typed-rule.d.ts.map +1 -0
- package/dist/_internal/typed-rule.js +53 -0
- package/dist/_internal/typed-rule.js.map +1 -0
- package/dist/plugin.cjs +1 -0
- package/dist/plugin.d.cts +10 -0
- package/dist/plugin.d.ts +36 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +183 -0
- package/dist/plugin.js.map +1 -0
- package/dist/rules/disallow-stylelint-allow-empty-input.d.ts +9 -0
- package/dist/rules/disallow-stylelint-allow-empty-input.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-allow-empty-input.js +29 -0
- package/dist/rules/disallow-stylelint-allow-empty-input.js.map +1 -0
- package/dist/rules/disallow-stylelint-configuration-comment.d.ts +9 -0
- package/dist/rules/disallow-stylelint-configuration-comment.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-configuration-comment.js +29 -0
- package/dist/rules/disallow-stylelint-configuration-comment.js.map +1 -0
- package/dist/rules/disallow-stylelint-custom-syntax.d.ts +12 -0
- package/dist/rules/disallow-stylelint-custom-syntax.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-custom-syntax.js +32 -0
- package/dist/rules/disallow-stylelint-custom-syntax.js.map +1 -0
- package/dist/rules/disallow-stylelint-default-severity.d.ts +9 -0
- package/dist/rules/disallow-stylelint-default-severity.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-default-severity.js +28 -0
- package/dist/rules/disallow-stylelint-default-severity.js.map +1 -0
- package/dist/rules/disallow-stylelint-duplicate-extends.d.ts +9 -0
- package/dist/rules/disallow-stylelint-duplicate-extends.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-duplicate-extends.js +29 -0
- package/dist/rules/disallow-stylelint-duplicate-extends.js.map +1 -0
- package/dist/rules/disallow-stylelint-duplicate-plugins.d.ts +9 -0
- package/dist/rules/disallow-stylelint-duplicate-plugins.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-duplicate-plugins.js +29 -0
- package/dist/rules/disallow-stylelint-duplicate-plugins.js.map +1 -0
- package/dist/rules/disallow-stylelint-duplicate-rule-option-values.d.ts +10 -0
- package/dist/rules/disallow-stylelint-duplicate-rule-option-values.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-duplicate-rule-option-values.js +171 -0
- package/dist/rules/disallow-stylelint-duplicate-rule-option-values.js.map +1 -0
- package/dist/rules/disallow-stylelint-empty-rules-object.d.ts +7 -0
- package/dist/rules/disallow-stylelint-empty-rules-object.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-empty-rules-object.js +65 -0
- package/dist/rules/disallow-stylelint-empty-rules-object.js.map +1 -0
- package/dist/rules/disallow-stylelint-ignore-disables.d.ts +9 -0
- package/dist/rules/disallow-stylelint-ignore-disables.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-ignore-disables.js +28 -0
- package/dist/rules/disallow-stylelint-ignore-disables.js.map +1 -0
- package/dist/rules/disallow-stylelint-ignore-files.d.ts +9 -0
- package/dist/rules/disallow-stylelint-ignore-files.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-ignore-files.js +28 -0
- package/dist/rules/disallow-stylelint-ignore-files.js.map +1 -0
- package/dist/rules/disallow-stylelint-null-rule-config.d.ts +7 -0
- package/dist/rules/disallow-stylelint-null-rule-config.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-null-rule-config.js +86 -0
- package/dist/rules/disallow-stylelint-null-rule-config.js.map +1 -0
- package/dist/rules/disallow-stylelint-overrides-runtime-options.d.ts +7 -0
- package/dist/rules/disallow-stylelint-overrides-runtime-options.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-overrides-runtime-options.js +124 -0
- package/dist/rules/disallow-stylelint-overrides-runtime-options.js.map +1 -0
- package/dist/rules/disallow-stylelint-processors.d.ts +9 -0
- package/dist/rules/disallow-stylelint-processors.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-processors.js +29 -0
- package/dist/rules/disallow-stylelint-processors.js.map +1 -0
- package/dist/rules/disallow-stylelint-relative-extends-paths.d.ts +9 -0
- package/dist/rules/disallow-stylelint-relative-extends-paths.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-relative-extends-paths.js +28 -0
- package/dist/rules/disallow-stylelint-relative-extends-paths.js.map +1 -0
- package/dist/rules/disallow-stylelint-relative-plugin-paths.d.ts +9 -0
- package/dist/rules/disallow-stylelint-relative-plugin-paths.d.ts.map +1 -0
- package/dist/rules/disallow-stylelint-relative-plugin-paths.js +28 -0
- package/dist/rules/disallow-stylelint-relative-plugin-paths.js.map +1 -0
- package/dist/rules/prefer-stylelint-cache.d.ts +9 -0
- package/dist/rules/prefer-stylelint-cache.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-cache.js +28 -0
- package/dist/rules/prefer-stylelint-cache.js.map +1 -0
- package/dist/rules/prefer-stylelint-define-config.d.ts +7 -0
- package/dist/rules/prefer-stylelint-define-config.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-define-config.js +82 -0
- package/dist/rules/prefer-stylelint-define-config.js.map +1 -0
- package/dist/rules/prefer-stylelint-extends-array.d.ts +9 -0
- package/dist/rules/prefer-stylelint-extends-array.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-extends-array.js +29 -0
- package/dist/rules/prefer-stylelint-extends-array.js.map +1 -0
- package/dist/rules/prefer-stylelint-fix.d.ts +7 -0
- package/dist/rules/prefer-stylelint-fix.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-fix.js +90 -0
- package/dist/rules/prefer-stylelint-fix.js.map +1 -0
- package/dist/rules/prefer-stylelint-formatter.d.ts +10 -0
- package/dist/rules/prefer-stylelint-formatter.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-formatter.js +77 -0
- package/dist/rules/prefer-stylelint-formatter.js.map +1 -0
- package/dist/rules/prefer-stylelint-plugins-array.d.ts +9 -0
- package/dist/rules/prefer-stylelint-plugins-array.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-plugins-array.js +29 -0
- package/dist/rules/prefer-stylelint-plugins-array.js.map +1 -0
- package/dist/rules/prefer-stylelint-report-descriptionless-disables.d.ts +12 -0
- package/dist/rules/prefer-stylelint-report-descriptionless-disables.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-report-descriptionless-disables.js +32 -0
- package/dist/rules/prefer-stylelint-report-descriptionless-disables.js.map +1 -0
- package/dist/rules/prefer-stylelint-report-invalid-scope-disables.d.ts +12 -0
- package/dist/rules/prefer-stylelint-report-invalid-scope-disables.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-report-invalid-scope-disables.js +32 -0
- package/dist/rules/prefer-stylelint-report-invalid-scope-disables.js.map +1 -0
- package/dist/rules/prefer-stylelint-report-needless-disables.d.ts +9 -0
- package/dist/rules/prefer-stylelint-report-needless-disables.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-report-needless-disables.js +29 -0
- package/dist/rules/prefer-stylelint-report-needless-disables.js.map +1 -0
- package/dist/rules/prefer-stylelint-report-unscoped-disables.d.ts +9 -0
- package/dist/rules/prefer-stylelint-report-unscoped-disables.d.ts.map +1 -0
- package/dist/rules/prefer-stylelint-report-unscoped-disables.js +29 -0
- package/dist/rules/prefer-stylelint-report-unscoped-disables.js.map +1 -0
- package/dist/rules/require-stylelint-config-file-naming-convention.d.ts +13 -0
- package/dist/rules/require-stylelint-config-file-naming-convention.d.ts.map +1 -0
- package/dist/rules/require-stylelint-config-file-naming-convention.js +58 -0
- package/dist/rules/require-stylelint-config-file-naming-convention.js.map +1 -0
- package/dist/rules/require-stylelint-custom-syntax-in-overrides.d.ts +7 -0
- package/dist/rules/require-stylelint-custom-syntax-in-overrides.d.ts.map +1 -0
- package/dist/rules/require-stylelint-custom-syntax-in-overrides.js +100 -0
- package/dist/rules/require-stylelint-custom-syntax-in-overrides.js.map +1 -0
- package/dist/rules/require-stylelint-extends-packages-installed.d.ts +12 -0
- package/dist/rules/require-stylelint-extends-packages-installed.d.ts.map +1 -0
- package/dist/rules/require-stylelint-extends-packages-installed.js +31 -0
- package/dist/rules/require-stylelint-extends-packages-installed.js.map +1 -0
- package/dist/rules/require-stylelint-overrides-configuration.d.ts +7 -0
- package/dist/rules/require-stylelint-overrides-configuration.d.ts.map +1 -0
- package/dist/rules/require-stylelint-overrides-configuration.js +100 -0
- package/dist/rules/require-stylelint-overrides-configuration.js.map +1 -0
- package/dist/rules/require-stylelint-overrides-files-array.d.ts +7 -0
- package/dist/rules/require-stylelint-overrides-files-array.d.ts.map +1 -0
- package/dist/rules/require-stylelint-overrides-files-array.js +99 -0
- package/dist/rules/require-stylelint-overrides-files-array.js.map +1 -0
- package/dist/rules/require-stylelint-overrides-files.d.ts +7 -0
- package/dist/rules/require-stylelint-overrides-files.d.ts.map +1 -0
- package/dist/rules/require-stylelint-overrides-files.js +104 -0
- package/dist/rules/require-stylelint-overrides-files.js.map +1 -0
- package/dist/rules/require-stylelint-plugins-packages-installed.d.ts +12 -0
- package/dist/rules/require-stylelint-plugins-packages-installed.d.ts.map +1 -0
- package/dist/rules/require-stylelint-plugins-packages-installed.js +31 -0
- package/dist/rules/require-stylelint-plugins-packages-installed.js.map +1 -0
- package/dist/rules/require-stylelint-report-disables.d.ts +9 -0
- package/dist/rules/require-stylelint-report-disables.d.ts.map +1 -0
- package/dist/rules/require-stylelint-report-disables.js +29 -0
- package/dist/rules/require-stylelint-report-disables.js.map +1 -0
- package/dist/rules/require-stylelint-rules-object.d.ts +7 -0
- package/dist/rules/require-stylelint-rules-object.d.ts.map +1 -0
- package/dist/rules/require-stylelint-rules-object.js +65 -0
- package/dist/rules/require-stylelint-rules-object.js.map +1 -0
- package/dist/rules/sort-stylelint-extends.d.ts +9 -0
- package/dist/rules/sort-stylelint-extends.d.ts.map +1 -0
- package/dist/rules/sort-stylelint-extends.js +28 -0
- package/dist/rules/sort-stylelint-extends.js.map +1 -0
- package/dist/rules/sort-stylelint-plugins.d.ts +9 -0
- package/dist/rules/sort-stylelint-plugins.d.ts.map +1 -0
- package/dist/rules/sort-stylelint-plugins.js +28 -0
- package/dist/rules/sort-stylelint-plugins.js.map +1 -0
- package/dist/rules/sort-stylelint-rule-keys.d.ts +7 -0
- package/dist/rules/sort-stylelint-rule-keys.d.ts.map +1 -0
- package/dist/rules/sort-stylelint-rule-keys.js +129 -0
- package/dist/rules/sort-stylelint-rule-keys.js.map +1 -0
- package/dist/rules/stylelint.d.ts +15 -0
- package/dist/rules/stylelint.d.ts.map +1 -0
- package/dist/rules/stylelint.js +157 -0
- package/dist/rules/stylelint.js.map +1 -0
- package/docs/rules/disallow-stylelint-allow-empty-input.md +62 -0
- package/docs/rules/disallow-stylelint-configuration-comment.md +62 -0
- package/docs/rules/disallow-stylelint-custom-syntax.md +70 -0
- package/docs/rules/disallow-stylelint-default-severity.md +77 -0
- package/docs/rules/disallow-stylelint-duplicate-extends.md +61 -0
- package/docs/rules/disallow-stylelint-duplicate-plugins.md +61 -0
- package/docs/rules/disallow-stylelint-duplicate-rule-option-values.md +73 -0
- package/docs/rules/disallow-stylelint-empty-rules-object.md +62 -0
- package/docs/rules/disallow-stylelint-ignore-disables.md +78 -0
- package/docs/rules/disallow-stylelint-ignore-files.md +78 -0
- package/docs/rules/disallow-stylelint-null-rule-config.md +63 -0
- package/docs/rules/disallow-stylelint-overrides-runtime-options.md +82 -0
- package/docs/rules/disallow-stylelint-processors.md +62 -0
- package/docs/rules/disallow-stylelint-relative-extends-paths.md +61 -0
- package/docs/rules/disallow-stylelint-relative-plugin-paths.md +61 -0
- package/docs/rules/getting-started.md +130 -0
- package/docs/rules/overview.md +99 -0
- package/docs/rules/prefer-stylelint-cache.md +79 -0
- package/docs/rules/prefer-stylelint-define-config.md +90 -0
- package/docs/rules/prefer-stylelint-extends-array.md +61 -0
- package/docs/rules/prefer-stylelint-fix.md +79 -0
- package/docs/rules/prefer-stylelint-formatter.md +80 -0
- package/docs/rules/prefer-stylelint-plugins-array.md +61 -0
- package/docs/rules/prefer-stylelint-report-descriptionless-disables.md +85 -0
- package/docs/rules/prefer-stylelint-report-invalid-scope-disables.md +83 -0
- package/docs/rules/prefer-stylelint-report-needless-disables.md +83 -0
- package/docs/rules/prefer-stylelint-report-unscoped-disables.md +83 -0
- package/docs/rules/presets/all.md +39 -0
- package/docs/rules/presets/configs.md +40 -0
- package/docs/rules/presets/configuration.md +64 -0
- package/docs/rules/presets/index.md +82 -0
- package/docs/rules/presets/recommended.md +40 -0
- package/docs/rules/presets/stylelint-only.md +42 -0
- package/docs/rules/require-stylelint-config-file-naming-convention.md +61 -0
- package/docs/rules/require-stylelint-custom-syntax-in-overrides.md +77 -0
- package/docs/rules/require-stylelint-extends-packages-installed.md +61 -0
- package/docs/rules/require-stylelint-overrides-configuration.md +80 -0
- package/docs/rules/require-stylelint-overrides-files-array.md +78 -0
- package/docs/rules/require-stylelint-overrides-files.md +83 -0
- package/docs/rules/require-stylelint-plugins-packages-installed.md +61 -0
- package/docs/rules/require-stylelint-report-disables.md +67 -0
- package/docs/rules/require-stylelint-rules-object.md +61 -0
- package/docs/rules/sort-stylelint-extends.md +61 -0
- package/docs/rules/sort-stylelint-plugins.md +61 -0
- package/docs/rules/sort-stylelint-rule-keys.md +65 -0
- package/docs/rules/stylelint.md +100 -0
- package/package.json +577 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# disallow-stylelint-duplicate-plugins
|
|
2
|
+
|
|
3
|
+
Disallow duplicate entries in top-level Stylelint `plugins` declarations.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
Reports duplicate string entries in top-level `plugins` arrays.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
Duplicate plugin references make config harder to reason about and create unnecessary churn in shared lint setup.
|
|
18
|
+
|
|
19
|
+
## ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
plugins: ["stylelint-order", "stylelint-order"],
|
|
24
|
+
rules: {},
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ✅ Correct
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
export default {
|
|
32
|
+
plugins: ["stylelint-order"],
|
|
33
|
+
rules: {},
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Behavior and migration notes
|
|
38
|
+
|
|
39
|
+
This rule auto-fixes by keeping the first occurrence of each plugin entry.
|
|
40
|
+
|
|
41
|
+
## ESLint flat config example
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
45
|
+
|
|
46
|
+
export default [stylelint2.configs.configuration];
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## When not to use it
|
|
50
|
+
|
|
51
|
+
Do not use this rule if duplicate plugin entries are intentionally required by external code-generation workflows.
|
|
52
|
+
|
|
53
|
+
## Package documentation
|
|
54
|
+
|
|
55
|
+
Stylelint package documentation:
|
|
56
|
+
|
|
57
|
+
> **Rule catalog ID:** R024
|
|
58
|
+
|
|
59
|
+
## Further reading
|
|
60
|
+
|
|
61
|
+
- [Stylelint plugins](https://stylelint.io/user-guide/configure/#plugins)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# disallow-stylelint-duplicate-rule-option-values
|
|
2
|
+
|
|
3
|
+
Disallow duplicate scalar literals in array-valued Stylelint secondary rule options.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
Reports duplicate scalar literals in array-valued properties inside secondary option objects.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
Duplicate option values add noise and can obscure actual rule intent during config review.
|
|
18
|
+
|
|
19
|
+
## ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
rules: {
|
|
24
|
+
"selector-class-pattern": [
|
|
25
|
+
"^[a-z]+$",
|
|
26
|
+
{
|
|
27
|
+
resolveNestedSelectors: [":global", ":global", ":host"],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## ✅ Correct
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
export default {
|
|
38
|
+
rules: {
|
|
39
|
+
"selector-class-pattern": [
|
|
40
|
+
"^[a-z]+$",
|
|
41
|
+
{
|
|
42
|
+
resolveNestedSelectors: [":global", ":host"],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Behavior and migration notes
|
|
50
|
+
|
|
51
|
+
This rule auto-fixes by keeping the first occurrence of each duplicate scalar literal value.
|
|
52
|
+
|
|
53
|
+
## ESLint flat config example
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
57
|
+
|
|
58
|
+
export default [stylelint2.configs.configuration];
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## When not to use it
|
|
62
|
+
|
|
63
|
+
Do not use this rule if your stylelint secondary option arrays intentionally include duplicate scalar values for generated-tool compatibility.
|
|
64
|
+
|
|
65
|
+
## Package documentation
|
|
66
|
+
|
|
67
|
+
Stylelint package documentation:
|
|
68
|
+
|
|
69
|
+
> **Rule catalog ID:** R032
|
|
70
|
+
|
|
71
|
+
## Further reading
|
|
72
|
+
|
|
73
|
+
- [Stylelint secondary options](https://stylelint.io/user-guide/configure/)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# disallow-stylelint-empty-rules-object
|
|
2
|
+
|
|
3
|
+
Disallow an empty top-level `rules` object in authored Stylelint config files.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
This rule reports config objects that include `rules: {}` with no configured rules.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
An empty `rules` object in committed shared config is usually accidental drift. It communicates that rule policy exists while actually enabling nothing.
|
|
18
|
+
|
|
19
|
+
## ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
rules: {},
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## ✅ Correct
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
export default {
|
|
31
|
+
rules: {
|
|
32
|
+
"color-no-invalid-hex": true,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Behavior and migration notes
|
|
38
|
+
|
|
39
|
+
- This rule reports empty rules objects.
|
|
40
|
+
- It does not auto-fix because the desired replacement depends on your policy (add real rules or remove the object).
|
|
41
|
+
|
|
42
|
+
## ESLint flat config example
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
46
|
+
|
|
47
|
+
export default [stylelint2.configs.configuration];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## When not to use it
|
|
51
|
+
|
|
52
|
+
Do not use this rule if your team intentionally keeps empty `rules` objects as scaffolding placeholders.
|
|
53
|
+
|
|
54
|
+
## Package documentation
|
|
55
|
+
|
|
56
|
+
Stylelint package documentation:
|
|
57
|
+
|
|
58
|
+
> **Rule catalog ID:** R018
|
|
59
|
+
|
|
60
|
+
## Further reading
|
|
61
|
+
|
|
62
|
+
- [Stylelint rules reference](https://stylelint.io/user-guide/rules/list)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# disallow-stylelint-ignore-disables
|
|
2
|
+
|
|
3
|
+
Disallow configuring Stylelint's top-level `ignoreDisables` option inside authored Stylelint config files.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
This rule reports Stylelint config objects that include a top-level `ignoreDisables` property.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
This plugin now provides a family of rules that reinforce Stylelint disable-comment reporting. `ignoreDisables: true` undermines that governance by making Stylelint disregard disable comments entirely.
|
|
18
|
+
|
|
19
|
+
That setting is an execution policy decision and is usually a poor fit for a shared committed config object.
|
|
20
|
+
|
|
21
|
+
## ❌ Incorrect
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
export default {
|
|
25
|
+
ignoreDisables: true,
|
|
26
|
+
rules: {},
|
|
27
|
+
};
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## ✅ Correct
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
export default {
|
|
34
|
+
rules: {},
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Behavior and migration notes
|
|
39
|
+
|
|
40
|
+
- This rule removes the top-level `ignoreDisables` property.
|
|
41
|
+
- It preserves the rest of the config object.
|
|
42
|
+
- If you truly need to ignore disable comments, set that at the Stylelint invocation layer instead of the shared config file.
|
|
43
|
+
|
|
44
|
+
## Additional examples
|
|
45
|
+
|
|
46
|
+
### ✅ Correct — leave invocation-only behavior to the runner
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
await stylelint.lint({
|
|
50
|
+
code,
|
|
51
|
+
ignoreDisables: true,
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## ESLint flat config example
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
59
|
+
|
|
60
|
+
export default [
|
|
61
|
+
stylelint2.configs.configuration,
|
|
62
|
+
];
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## When not to use it
|
|
66
|
+
|
|
67
|
+
Do not use this rule if your team intentionally wants a committed shared Stylelint config to ignore disable comments across every environment.
|
|
68
|
+
|
|
69
|
+
## Package documentation
|
|
70
|
+
|
|
71
|
+
Stylelint package documentation:
|
|
72
|
+
|
|
73
|
+
> **Rule catalog ID:** R008
|
|
74
|
+
|
|
75
|
+
## Further reading
|
|
76
|
+
|
|
77
|
+
- [Stylelint configuring guide](https://stylelint.io/user-guide/configure/#ignoredisables)
|
|
78
|
+
- [Stylelint ignore-code guide](https://stylelint.io/user-guide/ignore-code/)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# disallow-stylelint-ignore-files
|
|
2
|
+
|
|
3
|
+
Disallow configuring Stylelint's top-level `ignoreFiles` option inside authored Stylelint config files.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
This rule reports Stylelint config objects that include a top-level `ignoreFiles` property.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
`ignoreFiles` changes lint coverage at the config level and can accidentally hide files from linting across editor, CI, and local workflows.
|
|
18
|
+
|
|
19
|
+
Stylelint also documents that `ignoreFiles` is not efficient for broad ignore coverage and can override default `node_modules` ignore behavior. In shared configs, ignore scope is usually clearer in `.stylelintignore` or invocation-level file globs.
|
|
20
|
+
|
|
21
|
+
## ❌ Incorrect
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
export default {
|
|
25
|
+
ignoreFiles: ["**/vendor/**/*.css"],
|
|
26
|
+
rules: {},
|
|
27
|
+
};
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## ✅ Correct
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
export default {
|
|
34
|
+
rules: {},
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Behavior and migration notes
|
|
39
|
+
|
|
40
|
+
- This rule removes the top-level `ignoreFiles` property.
|
|
41
|
+
- It preserves the rest of the config object.
|
|
42
|
+
- Move ignore patterns to `.stylelintignore` (preferred for file-scope ignores) or to explicit invocation globs in scripts.
|
|
43
|
+
|
|
44
|
+
## Additional examples
|
|
45
|
+
|
|
46
|
+
### ✅ Correct — ignore scope moved out of shared config
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// package.json
|
|
50
|
+
{
|
|
51
|
+
"scripts": {
|
|
52
|
+
"lint:css": "stylelint \"src/**/*.{css,scss}\""
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## ESLint flat config example
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
61
|
+
|
|
62
|
+
export default [stylelint2.configs.configuration];
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## When not to use it
|
|
66
|
+
|
|
67
|
+
Do not use this rule if your team intentionally controls all Stylelint ignore patterns directly in the committed config object and accepts that coupling.
|
|
68
|
+
|
|
69
|
+
## Package documentation
|
|
70
|
+
|
|
71
|
+
Stylelint package documentation:
|
|
72
|
+
|
|
73
|
+
> **Rule catalog ID:** R010
|
|
74
|
+
|
|
75
|
+
## Further reading
|
|
76
|
+
|
|
77
|
+
- [Stylelint configuring guide](https://stylelint.io/user-guide/configure/#ignorefiles)
|
|
78
|
+
- [Stylelint ignoring code](https://stylelint.io/user-guide/ignore-code/)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# disallow-stylelint-null-rule-config
|
|
2
|
+
|
|
3
|
+
Disallow `null` values in top-level Stylelint `rules` entries.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
Reports top-level rule entries configured as `null`, for example `"at-rule-no-unknown": null`.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
`null` entries hide rule intent in shared configs and can mask policy drift. Explicit rule values are easier to audit and maintain.
|
|
18
|
+
|
|
19
|
+
## ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
rules: {
|
|
24
|
+
"at-rule-no-unknown": null,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## ✅ Correct
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
export default {
|
|
33
|
+
rules: {
|
|
34
|
+
"at-rule-no-unknown": true,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Behavior and migration notes
|
|
40
|
+
|
|
41
|
+
This rule reports null rule entries and does not auto-fix because desired replacement values are policy-specific.
|
|
42
|
+
|
|
43
|
+
## ESLint flat config example
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
47
|
+
|
|
48
|
+
export default [stylelint2.configs.configuration];
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## When not to use it
|
|
52
|
+
|
|
53
|
+
Do not use this rule if your team intentionally uses `null` to disable inherited rules in shared config files.
|
|
54
|
+
|
|
55
|
+
## Package documentation
|
|
56
|
+
|
|
57
|
+
Stylelint package documentation:
|
|
58
|
+
|
|
59
|
+
> **Rule catalog ID:** R030
|
|
60
|
+
|
|
61
|
+
## Further reading
|
|
62
|
+
|
|
63
|
+
- [Stylelint rules](https://stylelint.io/user-guide/rules/list)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# disallow-stylelint-overrides-runtime-options
|
|
2
|
+
|
|
3
|
+
Disallow runtime-only Stylelint options (`allowEmptyInput`, `cache`, `fix`) inside `overrides` entries.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
This rule reports override entries that configure:
|
|
14
|
+
|
|
15
|
+
- `allowEmptyInput`
|
|
16
|
+
- `cache`
|
|
17
|
+
- `fix`
|
|
18
|
+
|
|
19
|
+
## Why this rule exists
|
|
20
|
+
|
|
21
|
+
Stylelint documents these as runtime options that should not be overridden per-file. Keeping them inside override blocks creates confusing behavior and weakens execution-level policy.
|
|
22
|
+
|
|
23
|
+
## ❌ Incorrect
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
export default {
|
|
27
|
+
overrides: [
|
|
28
|
+
{
|
|
29
|
+
files: ["**/*.scss"],
|
|
30
|
+
fix: true,
|
|
31
|
+
rules: {
|
|
32
|
+
"at-rule-no-unknown": null,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## ✅ Correct
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
export default {
|
|
43
|
+
overrides: [
|
|
44
|
+
{
|
|
45
|
+
files: ["**/*.scss"],
|
|
46
|
+
rules: {
|
|
47
|
+
"at-rule-no-unknown": null,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Behavior and migration notes
|
|
55
|
+
|
|
56
|
+
- This rule auto-fixes by removing the runtime-only option from each invalid override entry.
|
|
57
|
+
- Use execution-time controls (`eslint --fix`, Stylelint CLI options, task-runner settings) for runtime behavior.
|
|
58
|
+
|
|
59
|
+
## ESLint flat config example
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
63
|
+
|
|
64
|
+
export default [stylelint2.configs.configuration];
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## When not to use it
|
|
68
|
+
|
|
69
|
+
Do not use this rule if your team intentionally accepts override-local runtime behavior and understands the resulting execution coupling.
|
|
70
|
+
|
|
71
|
+
## Package documentation
|
|
72
|
+
|
|
73
|
+
Stylelint package documentation:
|
|
74
|
+
|
|
75
|
+
> **Rule catalog ID:** R036
|
|
76
|
+
|
|
77
|
+
## Further reading
|
|
78
|
+
|
|
79
|
+
- [Stylelint `allowEmptyInput`](https://stylelint.io/user-guide/configure/#allowemptyinput)
|
|
80
|
+
- [Stylelint `cache`](https://stylelint.io/user-guide/configure/#cache)
|
|
81
|
+
- [Stylelint `fix`](https://stylelint.io/user-guide/configure/#fix)
|
|
82
|
+
- [Stylelint `overrides`](https://stylelint.io/user-guide/configure/#overrides)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# disallow-stylelint-processors
|
|
2
|
+
|
|
3
|
+
Disallow configuring Stylelint's top-level `processors` option inside authored Stylelint config files.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
This rule reports Stylelint config objects that include a top-level `processors` property.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
Processor pipelines are often legacy integration paths that hide parsing behavior and introduce brittle lint flows. Modern Stylelint usage favors explicit syntax selection and rule config composition.
|
|
18
|
+
|
|
19
|
+
## ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
processors: ["stylelint-processor-styled-components"],
|
|
24
|
+
rules: {},
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ✅ Correct
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
export default {
|
|
32
|
+
rules: {},
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Behavior and migration notes
|
|
37
|
+
|
|
38
|
+
- This rule removes top-level `processors`.
|
|
39
|
+
- It preserves the rest of the config object.
|
|
40
|
+
- Prefer modern syntax-aware configuration and explicit file scoping.
|
|
41
|
+
|
|
42
|
+
## ESLint flat config example
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
46
|
+
|
|
47
|
+
export default [stylelint2.configs.configuration];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## When not to use it
|
|
51
|
+
|
|
52
|
+
Do not use this rule if your repository still relies on processor-based Stylelint integration and cannot migrate yet.
|
|
53
|
+
|
|
54
|
+
## Package documentation
|
|
55
|
+
|
|
56
|
+
Stylelint package documentation:
|
|
57
|
+
|
|
58
|
+
> **Rule catalog ID:** R015
|
|
59
|
+
|
|
60
|
+
## Further reading
|
|
61
|
+
|
|
62
|
+
- [Stylelint configuring guide](https://stylelint.io/user-guide/configure/)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# disallow-stylelint-relative-extends-paths
|
|
2
|
+
|
|
3
|
+
Disallow relative-path entries in top-level Stylelint `extends` declarations.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
Reports `extends` entries that start with `./`, `../`, `.\\`, or `..\\`.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
Relative path references in shared configs are fragile across package boundaries and monorepos. Package-based identifiers are more portable and predictable.
|
|
18
|
+
|
|
19
|
+
## ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
extends: ["../shared/stylelint.cjs"],
|
|
24
|
+
rules: {},
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ✅ Correct
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
export default {
|
|
32
|
+
extends: ["stylelint-config-standard"],
|
|
33
|
+
rules: {},
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Behavior and migration notes
|
|
38
|
+
|
|
39
|
+
This rule reports relative-path entries and does not auto-fix because replacement identifiers are repository-specific.
|
|
40
|
+
|
|
41
|
+
## ESLint flat config example
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
45
|
+
|
|
46
|
+
export default [stylelint2.configs.configuration];
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## When not to use it
|
|
50
|
+
|
|
51
|
+
Do not use this rule if your config architecture intentionally relies on relative extends references.
|
|
52
|
+
|
|
53
|
+
## Package documentation
|
|
54
|
+
|
|
55
|
+
Stylelint package documentation:
|
|
56
|
+
|
|
57
|
+
> **Rule catalog ID:** R027
|
|
58
|
+
|
|
59
|
+
## Further reading
|
|
60
|
+
|
|
61
|
+
- [Stylelint extends](https://stylelint.io/user-guide/configure/#extends)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# disallow-stylelint-relative-plugin-paths
|
|
2
|
+
|
|
3
|
+
Disallow relative-path entries in top-level Stylelint `plugins` declarations.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets Stylelint config modules such as `stylelint.config.ts`, `stylelint.config.mjs`, and `.stylelintrc.js`.
|
|
8
|
+
|
|
9
|
+
It focuses on top-level exported config objects, including configs wrapped in `defineConfig(...)`.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
Reports `plugins` entries that start with `./`, `../`, `.\\`, or `..\\`.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
Relative plugin paths are brittle in shared configs and can break when package roots or workspace layouts change.
|
|
18
|
+
|
|
19
|
+
## ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
plugins: ["./plugins/local-stylelint-plugin.cjs"],
|
|
24
|
+
rules: {},
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ✅ Correct
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
export default {
|
|
32
|
+
plugins: ["stylelint-order"],
|
|
33
|
+
rules: {},
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Behavior and migration notes
|
|
38
|
+
|
|
39
|
+
This rule reports relative-path entries and does not auto-fix because package replacement names are project-specific.
|
|
40
|
+
|
|
41
|
+
## ESLint flat config example
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import stylelint2 from "eslint-plugin-stylelint-2";
|
|
45
|
+
|
|
46
|
+
export default [stylelint2.configs.configuration];
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## When not to use it
|
|
50
|
+
|
|
51
|
+
Do not use this rule if your repository intentionally loads local relative plugin modules.
|
|
52
|
+
|
|
53
|
+
## Package documentation
|
|
54
|
+
|
|
55
|
+
Stylelint package documentation:
|
|
56
|
+
|
|
57
|
+
> **Rule catalog ID:** R028
|
|
58
|
+
|
|
59
|
+
## Further reading
|
|
60
|
+
|
|
61
|
+
- [Stylelint plugins](https://stylelint.io/user-guide/configure/#plugins)
|