@icebreakers/stylelint-config 1.2.3 → 1.2.5

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
@@ -79,6 +79,7 @@ export default createStylelintConfig({
79
79
 
80
80
  Defaults include:
81
81
 
82
+ - Allowing BEM/OOCSS class selectors (e.g. `block__element--modifier`, `object--state`)
82
83
  - Allowing the `rpx` unit for mini-program compatibility
83
84
  - Ignoring Tailwind/UnoCSS style at-rules (`apply`, `screen`, etc.)
84
85
  - Ignoring the `page` selector used by various platforms
package/README.zh.md CHANGED
@@ -77,6 +77,7 @@ export default createStylelintConfig({
77
77
 
78
78
  默认行为包括:
79
79
 
80
+ - 允许 BEM / OOCSS 风格的类名(如 `block__element--modifier`、`object--state`)
80
81
  - 允许 `rpx` 单位,兼容小程序
81
82
  - 忽略 Tailwind / UnoCSS 常见指令(如 `apply`、`screen`)
82
83
  - 忽略多端平台常见的 `page` 选择器
package/dist/index.cjs CHANGED
@@ -25,8 +25,8 @@ __export(index_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(index_exports);
27
27
 
28
- // ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
29
- var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
28
+ // ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
29
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
30
30
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
31
31
 
32
32
  // src/config.ts
@@ -113,6 +113,7 @@ function normalizeExtends(base) {
113
113
 
114
114
  // src/config.ts
115
115
  var requireFromConfig = (0, import_node_module.createRequire)(importMetaUrl);
116
+ var 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]+)*)*$/;
116
117
  var PRESET_PATH_STANDARD_SCSS = requireFromConfig.resolve(PRESET_STANDARD_SCSS);
117
118
  var PRESET_PATH_VUE_SCSS = requireFromConfig.resolve(PRESET_VUE_SCSS);
118
119
  var PRESET_PATH_RECESS_ORDER = requireFromConfig.resolve(PRESET_RECESS_ORDER);
@@ -148,6 +149,13 @@ function resolveRules(options) {
148
149
  const ignoreAtRules = resolveIgnoreList("atRules", options?.ignores);
149
150
  const rules = {
150
151
  "function-name-case": null,
152
+ "selector-class-pattern": [
153
+ new RegExp(BEM_OOCSS_CLASS_NAME_PATTERN),
154
+ {
155
+ message: "Use BEM/OOCSS-friendly class names",
156
+ resolveNestedSelectors: true
157
+ }
158
+ ],
151
159
  "unit-no-unknown": [
152
160
  true,
153
161
  {
package/dist/index.js CHANGED
@@ -82,6 +82,7 @@ function normalizeExtends(base) {
82
82
 
83
83
  // src/config.ts
84
84
  var requireFromConfig = createRequire(import.meta.url);
85
+ var 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]+)*)*$/;
85
86
  var PRESET_PATH_STANDARD_SCSS = requireFromConfig.resolve(PRESET_STANDARD_SCSS);
86
87
  var PRESET_PATH_VUE_SCSS = requireFromConfig.resolve(PRESET_VUE_SCSS);
87
88
  var PRESET_PATH_RECESS_ORDER = requireFromConfig.resolve(PRESET_RECESS_ORDER);
@@ -117,6 +118,13 @@ function resolveRules(options) {
117
118
  const ignoreAtRules = resolveIgnoreList("atRules", options?.ignores);
118
119
  const rules = {
119
120
  "function-name-case": null,
121
+ "selector-class-pattern": [
122
+ new RegExp(BEM_OOCSS_CLASS_NAME_PATTERN),
123
+ {
124
+ message: "Use BEM/OOCSS-friendly class names",
125
+ resolveNestedSelectors: true
126
+ }
127
+ ],
120
128
  "unit-no-unknown": [
121
129
  true,
122
130
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/stylelint-config",
3
3
  "type": "module",
4
- "version": "1.2.3",
4
+ "version": "1.2.5",
5
5
  "description": "Stylelint preset from Icebreaker's dev-configs",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -41,8 +41,8 @@
41
41
  "dist"
42
42
  ],
43
43
  "dependencies": {
44
- "comment-json": "^4.4.1",
45
- "postcss-html": "^1.8.0",
44
+ "comment-json": "^4.5.1",
45
+ "postcss-html": "^1.8.1",
46
46
  "stylelint-config-recess-order": "^7.4.0",
47
47
  "stylelint-config-recommended-scss": "^16.0.2",
48
48
  "stylelint-config-recommended-vue": "^1.6.1",