@icebreakers/stylelint-config 5.1.5 → 6.0.0

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
@@ -9,7 +9,9 @@
9
9
  ## Requirements
10
10
 
11
11
  - Node.js `^22.23.4 || ^24.22.1 || >=26.12.1` (24.22.1 LTS recommended)
12
- - Stylelint 16 (flat-compatible configuration)
12
+ - Stylelint 18 (flat-compatible configuration)
13
+
14
+ The default SCSS, Vue and ordering presets are tested with Stylelint 18. The SCSS and recess-order upstream packages still declare Stylelint 17 peer ranges, so package managers can report peer warnings; strict peer installation is not supported until those packages publish compatible metadata. No peer overrides are applied. Custom `stylelint-scss` rules outside this preset may require their own Stylelint 18 migration.
13
15
 
14
16
  ## Installation
15
17
 
@@ -104,7 +106,7 @@ The same `rules` option also works with `icebreaker({ rules: { ... } })`.
104
106
  ### Option Reference
105
107
 
106
108
  - `miniProgram` – ignore Mini Program build outputs by default: `dist/**`, `.weapp-vite/**`, `node_modules/**`, `miniprogram_npm/**`
107
- - `presets.scss` – include `stylelint-config-standard-scss` (default `true`)
109
+ - `presets.scss` – include the bundled standard SCSS preset based on `stylelint-config-standard@41` (default `true`)
108
110
  - `presets.vue` – include `stylelint-config-recommended-vue/scss` (default `true`)
109
111
  - `presets.order` – include `stylelint-config-recess-order` (default `true`)
110
112
  - `formattingPreset` – enable fix-oriented formatting conventions. Use `'safe'` for a conservative autofix layer, or `'off'` (default) to keep only the linting presets.
@@ -138,7 +140,7 @@ export default createStylelintConfig({
138
140
  ```
139
141
 
140
142
  `formattingPreset: 'safe'` is intentionally conservative. It focuses on rules
141
- that Stylelint 16+ still supports and can fix reliably, such as:
143
+ that Stylelint 18 still supports and can fix reliably, such as:
142
144
 
143
145
  - modern color function notation (`rgba()` -> `rgb(... / ...)`)
144
146
  - quoted `url(...)` values
package/README.zh.md CHANGED
@@ -7,7 +7,9 @@
7
7
  ## 环境要求
8
8
 
9
9
  - Node.js `^22.23.4 || ^24.22.1 || >=26.12.1`(推荐 24.22.1 LTS)
10
- - Stylelint 16(支持 Flat Config)
10
+ - Stylelint 18(支持 Flat Config)
11
+
12
+ 默认 SCSS、Vue 和排序预设已通过 Stylelint 18 验证。SCSS 与 recess-order 上游包仍声明 Stylelint 17 的 peer 范围,包管理器可能报告 peer 警告;在上游发布兼容声明前,不支持严格 peer 安装。本包不使用 peer override。预设外自行启用的 `stylelint-scss` 规则仍需独立验证其 Stylelint 18 兼容性。
11
13
 
12
14
  ## 安装
13
15
 
@@ -102,7 +104,7 @@ export default createStylelintConfig({
102
104
  ### 配置说明
103
105
 
104
106
  - `miniProgram`:默认忽略小程序常见产物目录:`dist/**`、`.weapp-vite/**`、`node_modules/**`、`miniprogram_npm/**`
105
- - `presets.scss`:是否包含 `stylelint-config-standard-scss`,默认开启
107
+ - `presets.scss`:是否包含基于 `stylelint-config-standard@41` 的包内标准 SCSS 预设,默认开启
106
108
  - `presets.vue`:是否包含 `stylelint-config-recommended-vue/scss`,默认开启
107
109
  - `presets.order`:是否包含 `stylelint-config-recess-order`,默认开启
108
110
  - `formattingPreset`:是否启用面向 `--fix` 的保守格式化约定层。`'safe'` 表示启用,`'off'`(默认)表示只保留 lint 预设。
@@ -134,7 +136,7 @@ export default createStylelintConfig({
134
136
  })
135
137
  ```
136
138
 
137
- `formattingPreset: 'safe'` 是一层刻意保守的配置,只包含 Stylelint 16+
139
+ `formattingPreset: 'safe'` 是一层刻意保守的配置,只包含 Stylelint 18
138
140
  仍支持、且 `--fix` 行为稳定的规则,例如:
139
141
 
140
142
  - 使用现代颜色函数写法(如 `rgba()` 转成 `rgb(... / ...)`)
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@ import process from "node:process";
2
2
  import fs from "node:fs";
3
3
  import { resolve } from "node:path";
4
4
  import jsonc from "comment-json";
5
- //#region src/shared.ts
5
+ // src/shared.ts
6
6
  const STYLELINT_LANGUAGES = [
7
7
  "vue",
8
8
  "css",
@@ -33,8 +33,7 @@ function setVscodeSettingsJson(json = {}) {
33
33
  else delete json["eslint.validate"];
34
34
  return json;
35
35
  }
36
- //#endregion
37
- //#region src/cli.ts
36
+ // src/cli.ts
38
37
  const cwd = process.cwd();
39
38
  fs.mkdirSync(resolve(cwd, ".vscode"), { recursive: true });
40
39
  const vscodeSettingsFilename = resolve(cwd, ".vscode/settings.json");
@@ -47,5 +46,4 @@ if (isExisted) {
47
46
  setVscodeSettingsJson(json);
48
47
  fs.writeFileSync(vscodeSettingsFilename, jsonc.stringify(json, void 0, 2), "utf8");
49
48
  console.info(`[@icebreakers/stylelint-config] ${isExisted ? "update" : "init"} '.vscode/settings.json' finished`);
50
- //#endregion
51
49
  export {};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/types.d.ts
2
1
  interface StylelintRuleOptions {
3
2
  [key: string]: unknown;
4
3
  }
@@ -51,7 +50,7 @@ interface IcebreakerStylelintOptions {
51
50
  presets?: PresetToggles;
52
51
  /** Control the bundled Tailwind/UnoCSS policy layer. */
53
52
  tailwindcssPreset?: TailwindcssPresetLevel;
54
- /** Enable fix-oriented formatting conventions that remain supported in Stylelint 16+. */
53
+ /** 启用在 Stylelint 18 中仍受支持的修复型格式规则。 */
55
54
  formattingPreset?: FormattingPresetLevel;
56
55
  /** Append extra extends entries. */
57
56
  extends?: StylelintConfig['extends'];
@@ -68,12 +67,7 @@ interface IcebreakerStylelintOptions {
68
67
  /** Override or add rules. */
69
68
  rules?: StylelintConfig['rules'];
70
69
  }
71
- //#endregion
72
- //#region src/config.d.ts
73
70
  declare function createIcebreakerStylelintConfig(options?: IcebreakerStylelintOptions): StylelintConfig;
74
- //#endregion
75
- //#region src/index.d.ts
76
71
  export declare function icebreaker(config?: IcebreakerStylelintOptions & StylelintConfig): StylelintConfig;
77
72
  export type IcebreakerStylelintConfig = ReturnType<typeof icebreaker>;
78
- //#endregion
79
73
  export { type FormattingPresetLevel, type IcebreakerStylelintOptions, type IgnoreListOptions, type PresetToggles, type StylelintConfig, type StylelintOverride, type StylelintRuleOptions, type StylelintRuleSetting, type TailwindcssPresetLevel, createIcebreakerStylelintConfig as createStylelintConfig };
package/dist/index.js CHANGED
@@ -2,12 +2,10 @@ import { createRequire } from "node:module";
2
2
  import process from "node:process";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { base, noApplyRuleName, noArbitraryValueRuleName, noAtomicClassRuleName, noCssLayerRuleName, noInvalidApplyRuleName, noInvalidThemeFunctionRuleName, noScreenDirectiveRuleName, noThemeFunctionRuleName, recommended, strict, unocssNoApplyRuleName, unocssNoArbitraryValueRuleName, unocssNoAtomicClassRuleName, unocssNoInvalidApplyRuleName, unocssNoVariantGroupRuleName } from "stylelint-plugin-tailwindcss";
5
- //#region src/constants.ts
6
- const PRESET_STANDARD_SCSS = "stylelint-config-standard-scss";
5
+ // src/constants.ts
7
6
  const PRESET_VUE_SCSS = "stylelint-config-recommended-vue/scss";
8
7
  const PRESET_RECESS_ORDER = "stylelint-config-recess-order";
9
- //#endregion
10
- //#region src/utils.ts
8
+ // src/utils.ts
11
9
  const IGNORE_DEFAULTS = {
12
10
  atRules: [
13
11
  "tailwind",
@@ -64,8 +62,7 @@ function normalizeExtends(base) {
64
62
  if (Array.isArray(base)) return base.length === 1 ? base[0] : base;
65
63
  return base;
66
64
  }
67
- //#endregion
68
- //#region src/config.ts
65
+ // src/config.ts
69
66
  const requireFromConfig = createRequire(import.meta.url);
70
67
  const BEM_OOCSS_CLASS_NAME_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?:__[a-z0-9]+(?:-[a-z0-9]+)*)*(?:--[a-z0-9]+(?:-[a-z0-9]+)*)*$/;
71
68
  function resolvePresetPath(specifier) {
@@ -79,7 +76,7 @@ function resolvePresetPath(specifier) {
79
76
  return specifier;
80
77
  }
81
78
  }
82
- const PRESET_PATH_STANDARD_SCSS = resolvePresetPath(PRESET_STANDARD_SCSS);
79
+ const PRESET_PATH_STANDARD_SCSS = fileURLToPath(new URL("../presets/stylelint-config-standard-scss.mjs", import.meta.url));
83
80
  const PRESET_PATH_VUE_SCSS = resolvePresetPath(PRESET_VUE_SCSS);
84
81
  const PRESET_PATH_RECESS_ORDER = resolvePresetPath(PRESET_RECESS_ORDER);
85
82
  const MINI_PROGRAM_IGNORE_FILES = [
@@ -193,10 +190,8 @@ function createIcebreakerStylelintConfig(options = {}) {
193
190
  }
194
191
  };
195
192
  }
196
- //#endregion
197
- //#region src/index.ts
193
+ // src/index.ts
198
194
  function icebreaker(config) {
199
195
  return createIcebreakerStylelintConfig(config);
200
196
  }
201
- //#endregion
202
197
  export { createIcebreakerStylelintConfig as createStylelintConfig, icebreaker };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/stylelint-config",
3
3
  "type": "module",
4
- "version": "5.1.5",
4
+ "version": "6.0.0",
5
5
  "description": "Stylelint preset from the repoctl development toolchain",
6
6
  "author": "ice breaker <hi@sonofmagic.top>",
7
7
  "license": "MIT",
@@ -41,21 +41,25 @@
41
41
  "README.md",
42
42
  "README.zh.md",
43
43
  "bin",
44
- "dist"
44
+ "dist",
45
+ "presets"
45
46
  ],
46
47
  "engines": {
47
48
  "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
48
49
  },
50
+ "peerDependencies": {
51
+ "stylelint": "^18.0.0"
52
+ },
49
53
  "dependencies": {
50
54
  "comment-json": "^5.0.0",
51
55
  "postcss-html": "^2.0.0",
52
- "stylelint-config-recess-order": "^7.8.0",
53
- "stylelint-config-recommended": "^18.0.0",
56
+ "stylelint-config-recess-order": "^7.9.0",
57
+ "stylelint-config-recommended": "^19.0.0",
54
58
  "stylelint-config-recommended-scss": "^17.0.1",
55
59
  "stylelint-config-recommended-vue": "^2.0.0",
56
- "stylelint-config-standard-scss": "^17.0.0",
57
- "stylelint-order": "^8.1.2",
58
- "stylelint-plugin-tailwindcss": "3.1.5"
60
+ "stylelint-config-standard": "^41.0.0",
61
+ "stylelint-order": "^8.1.3",
62
+ "stylelint-plugin-tailwindcss": "3.2.0"
59
63
  },
60
64
  "publishConfig": {
61
65
  "access": "public",
@@ -1,6 +1,6 @@
1
- MIT License
1
+ The MIT License (MIT)
2
2
 
3
- Copyright (c) 2025 ice breaker
3
+ Copyright (c) 2021 Present stylelint-scss authors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,73 @@
1
+ // 基于 stylelint-config-standard-scss@17.0.0;许可见同目录 LICENSE.stylelint-config-standard-scss。
2
+ export default {
3
+ extends: ['stylelint-config-standard', 'stylelint-config-recommended-scss'],
4
+ rules: {
5
+ 'at-rule-empty-line-before': [
6
+ 'always',
7
+ {
8
+ except: ['blockless-after-blockless', 'first-nested'],
9
+ ignore: ['after-comment'],
10
+ ignoreAtRules: ['else'],
11
+ },
12
+ ],
13
+ 'import-notation': 'string',
14
+ 'length-zero-no-unit': [
15
+ true,
16
+ {
17
+ ignore: ['custom-properties'],
18
+ ignorePreludeOfAtRules: ['function', 'mixin'],
19
+ },
20
+ ],
21
+ 'scss/at-else-closing-brace-newline-after': 'always-last-in-chain',
22
+ 'scss/at-else-closing-brace-space-after': 'always-intermediate',
23
+ 'scss/at-else-empty-line-before': 'never',
24
+ 'scss/at-else-if-parentheses-space-before': 'always',
25
+ 'scss/at-function-parentheses-space-before': 'never',
26
+ 'scss/at-function-pattern': [
27
+ '^(-?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',
28
+ {
29
+ message: name => `Expected function name "${name}" to be kebab-case`,
30
+ },
31
+ ],
32
+ 'scss/at-if-closing-brace-newline-after': 'always-last-in-chain',
33
+ 'scss/at-if-closing-brace-space-after': 'always-intermediate',
34
+ 'scss/at-mixin-argumentless-call-parentheses': 'never',
35
+ 'scss/at-mixin-parentheses-space-before': 'never',
36
+ 'scss/at-mixin-pattern': [
37
+ '^(-?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',
38
+ {
39
+ message: name => `Expected mixin name "${name}" to be kebab-case`,
40
+ },
41
+ ],
42
+ 'scss/at-rule-conditional-no-parentheses': true,
43
+ 'scss/dollar-variable-colon-space-after': 'always-single-line',
44
+ 'scss/dollar-variable-colon-space-before': 'never',
45
+ 'scss/dollar-variable-empty-line-before': [
46
+ 'always',
47
+ {
48
+ except: ['after-dollar-variable', 'first-nested'],
49
+ ignore: ['after-comment', 'inside-single-line-block'],
50
+ },
51
+ ],
52
+ 'scss/dollar-variable-pattern': [
53
+ '^(-?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',
54
+ {
55
+ message: name => `Expected variable name "${name}" to be kebab-case`,
56
+ },
57
+ ],
58
+ 'scss/double-slash-comment-empty-line-before': [
59
+ 'always',
60
+ {
61
+ except: ['first-nested'],
62
+ ignore: ['between-comments', 'stylelint-commands'],
63
+ },
64
+ ],
65
+ 'scss/double-slash-comment-whitespace-inside': 'always',
66
+ 'scss/percent-placeholder-pattern': [
67
+ '^(-?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',
68
+ {
69
+ message: name => `Expected placeholder name "${name}" to be kebab-case`,
70
+ },
71
+ ],
72
+ },
73
+ }