@icebreakers/stylelint-config 4.0.3 → 4.0.4

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.
Files changed (3) hide show
  1. package/README.md +31 -0
  2. package/README.zh.md +31 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -70,6 +70,37 @@ export default createStylelintConfig({
70
70
  })
71
71
  ```
72
72
 
73
+ ### Override Or Disable Rules
74
+
75
+ Rules passed through `rules` are merged after the bundled presets, so a rule
76
+ with the same name replaces the built-in value. Use `null` to disable a rule:
77
+
78
+ ```ts
79
+ // stylelint.config.ts
80
+ import { createStylelintConfig } from '@icebreakers/stylelint-config'
81
+
82
+ export default createStylelintConfig({
83
+ rules: {
84
+ // Override the built-in warning and report it as an error.
85
+ 'property-no-vendor-prefix': true,
86
+
87
+ // Replace the default BEM/OOCSS class-name pattern.
88
+ 'selector-class-pattern': [
89
+ '^[a-z][a-zA-Z0-9]+$',
90
+ { resolveNestedSelectors: true },
91
+ ],
92
+
93
+ // Disable the four utility guards enabled by the default `base` preset.
94
+ 'tailwindcss/no-atomic-class': null,
95
+ 'tailwindcss/no-invalid-apply': null,
96
+ 'unocss/no-atomic-class': null,
97
+ 'unocss/no-invalid-apply': null,
98
+ },
99
+ })
100
+ ```
101
+
102
+ The same `rules` option also works with `icebreaker({ rules: { ... } })`.
103
+
73
104
  ### Option Reference
74
105
 
75
106
  - `miniProgram` – ignore Mini Program build outputs by default: `dist/**`, `.weapp-vite/**`, `node_modules/**`, `miniprogram_npm/**`
package/README.zh.md CHANGED
@@ -68,6 +68,37 @@ export default createStylelintConfig({
68
68
  })
69
69
  ```
70
70
 
71
+ ### 覆盖或禁用规则
72
+
73
+ 通过 `rules` 传入的规则会在内置 preset 和默认规则之后合并,因此同名规则会
74
+ 覆盖内置值。需要禁用某条规则时,将它设置为 `null`:
75
+
76
+ ```ts
77
+ // stylelint.config.ts
78
+ import { createStylelintConfig } from '@icebreakers/stylelint-config'
79
+
80
+ export default createStylelintConfig({
81
+ rules: {
82
+ // 覆盖内置 warning,改为 error。
83
+ 'property-no-vendor-prefix': true,
84
+
85
+ // 替换默认的 BEM/OOCSS 类名规则。
86
+ 'selector-class-pattern': [
87
+ '^[a-z][a-zA-Z0-9]+$',
88
+ { resolveNestedSelectors: true },
89
+ ],
90
+
91
+ // 禁用默认 `base` preset 启用的四条 utility guard。
92
+ 'tailwindcss/no-atomic-class': null,
93
+ 'tailwindcss/no-invalid-apply': null,
94
+ 'unocss/no-atomic-class': null,
95
+ 'unocss/no-invalid-apply': null,
96
+ },
97
+ })
98
+ ```
99
+
100
+ 使用 `icebreaker({ rules: { ... } })` 时,`rules` 的覆盖行为完全相同。
101
+
71
102
  ### 配置说明
72
103
 
73
104
  - `miniProgram`:默认忽略小程序常见产物目录:`dist/**`、`.weapp-vite/**`、`node_modules/**`、`miniprogram_npm/**`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/stylelint-config",
3
3
  "type": "module",
4
- "version": "4.0.3",
4
+ "version": "4.0.4",
5
5
  "description": "Stylelint preset from Icebreaker's dev-configs",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",