@icebreakers/stylelint-config 5.0.1 → 5.0.3

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/README.md CHANGED
@@ -57,9 +57,7 @@ export default createStylelintConfig({
57
57
  units: ['upx'], // replace default list
58
58
  addAtRules: ['tailwind'],
59
59
  },
60
- extends: [
61
- '@acme/stylelint-config',
62
- ],
60
+ extends: ['@acme/stylelint-config'],
63
61
  overrides: [
64
62
  {
65
63
  files: ['**/*.html'],
@@ -72,6 +70,37 @@ export default createStylelintConfig({
72
70
  })
73
71
  ```
74
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
+
75
104
  ### Option Reference
76
105
 
77
106
  - `miniProgram` – ignore Mini Program build outputs by default: `dist/**`, `.weapp-vite/**`, `node_modules/**`, `miniprogram_npm/**`
@@ -205,7 +234,7 @@ That adds these Tailwind-only rules on top of the default policy:
205
234
  - `tailwindcss/no-import-directive`
206
235
  - `tailwindcss/no-css-layer`
207
236
 
208
- The underlying plugin supports both Tailwind CSS v3 and v4, and switches automatically based on the installed `tailwindcss` major version in the consuming project.
237
+ The underlying plugin supports both Tailwind CSS v3 and v4, and switches automatically based on the installed `tailwindcss` major version in the consuming project. UnoCSS rules discover the nearest `uno.config.*` or `unocss.config.*` and validate with the official generator. Runtime-dependent rules do not guess from class-name prefixes when the corresponding Tailwind runtime or UnoCSS config is unavailable, so semantic names such as `.table-and-form` and `.flex-layout` remain valid. If both runtimes recognize the same selector, the combined preset reports it once.
209
238
 
210
239
  ## Recommended Scripts
211
240
 
package/README.zh.md CHANGED
@@ -55,9 +55,7 @@ export default createStylelintConfig({
55
55
  units: ['upx'], // 覆盖默认单位白名单
56
56
  addAtRules: ['tailwind'],
57
57
  },
58
- extends: [
59
- '@acme/stylelint-config',
60
- ],
58
+ extends: ['@acme/stylelint-config'],
61
59
  overrides: [
62
60
  {
63
61
  files: ['**/*.html'],
@@ -70,6 +68,37 @@ export default createStylelintConfig({
70
68
  })
71
69
  ```
72
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
+
73
102
  ### 配置说明
74
103
 
75
104
  - `miniProgram`:默认忽略小程序常见产物目录:`dist/**`、`.weapp-vite/**`、`node_modules/**`、`miniprogram_npm/**`
@@ -201,7 +230,7 @@ export default createStylelintConfig({
201
230
  - `tailwindcss/no-import-directive`
202
231
  - `tailwindcss/no-css-layer`
203
232
 
204
- 底层插件同时兼容 Tailwind CSS v3 和 v4,会根据使用方项目实际安装的 `tailwindcss` 主版本自动切换检测逻辑。
233
+ 底层插件同时兼容 Tailwind CSS v3 和 v4,会根据使用方项目实际安装的 `tailwindcss` 主版本自动切换检测逻辑。UnoCSS 规则会查找最近的 `uno.config.*` 或 `unocss.config.*`,并通过官方 generator 校验。缺少对应 Tailwind runtime 或 UnoCSS 配置时,依赖运行时的规则不会根据类名前缀猜测,因此 `.table-and-form`、`.flex-layout` 等语义类名可以正常使用;两个 runtime 同时识别同一选择器时,双开 preset 也只报告一次。
205
234
 
206
235
  ## 推荐脚本
207
236
 
package/dist/cli.d.ts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/stylelint-config",
3
3
  "type": "module",
4
- "version": "5.0.1",
4
+ "version": "5.0.3",
5
5
  "description": "Stylelint preset from Icebreaker's dev-configs",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -33,7 +33,6 @@
33
33
  "main": "./dist/index.js",
34
34
  "module": "./dist/index.js",
35
35
  "types": "./dist/index.d.ts",
36
- "bin": "./bin/init.js",
37
36
  "files": [
38
37
  "README.md",
39
38
  "README.zh.md",
@@ -46,13 +45,13 @@
46
45
  "dependencies": {
47
46
  "comment-json": "^5.0.0",
48
47
  "postcss-html": "^1.8.1",
49
- "stylelint-config-recess-order": "^7.6.1",
48
+ "stylelint-config-recess-order": "^7.7.0",
50
49
  "stylelint-config-recommended": "^18.0.0",
51
50
  "stylelint-config-recommended-scss": "^17.0.1",
52
51
  "stylelint-config-recommended-vue": "^1.6.1",
53
52
  "stylelint-config-standard-scss": "^17.0.0",
54
53
  "stylelint-order": "^8.1.1",
55
- "stylelint-plugin-tailwindcss": "3.0.1"
54
+ "stylelint-plugin-tailwindcss": "3.0.3"
56
55
  },
57
56
  "publishConfig": {
58
57
  "access": "public",
@@ -65,6 +64,9 @@
65
64
  "skipLibCheck": true
66
65
  }
67
66
  },
67
+ "devDependencies": {
68
+ "tailwindcss": "^4.3.3"
69
+ },
68
70
  "scripts": {
69
71
  "dev": "tsdown --watch --sourcemap",
70
72
  "build": "tsdown",
@@ -74,5 +76,8 @@
74
76
  "release": "pnpm publish",
75
77
  "sync": "cnpm sync @icebreakers/stylelint-config",
76
78
  "typecheck": "tsc --noEmit"
79
+ },
80
+ "bin": {
81
+ "stylelint-config": "./bin/init.js"
77
82
  }
78
83
  }