eslint-plugin-light 1.0.12 → 1.0.14

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 CHANGED
@@ -1,6 +1,19 @@
1
+ ## <small>1.0.14 (2025-06-11)</small>
2
+
3
+ * feat(eslint-plugin-light): 优化classname-per-line ([fa99594](https://github.com/novlan1/plugin-light/commits/fa99594))
4
+
5
+
6
+
7
+ ## <small>1.0.13 (2025-06-10)</small>
8
+
9
+ * feat(eslint-plugin-light): 优化规则名称 ([73affad](https://github.com/novlan1/plugin-light/commits/73affad))
10
+ * chore: update t-comm@1.5.40 ([d019355](https://github.com/novlan1/plugin-light/commits/d019355))
11
+
12
+
13
+
1
14
  ## <small>1.0.12 (2025-05-30)</small>
2
15
 
3
- * feat(eslint-plugin-light): add css-per-line rule ([bc1d247](https://github.com/novlan1/plugin-light/commits/bc1d247))
16
+ * feat(eslint-plugin-light): add classname-per-line rule ([bc1d247](https://github.com/novlan1/plugin-light/commits/bc1d247))
4
17
 
5
18
 
6
19
 
package/README.md CHANGED
@@ -387,7 +387,7 @@ module.exports = {
387
387
  }
388
388
  ```
389
389
 
390
- ### 3.11. css-per-line
390
+ ### 3.11. classname-per-line
391
391
 
392
392
  限制 Vue 中每行只有`1`个CSS类名,可以配置阈值。
393
393
 
@@ -401,7 +401,7 @@ module.exports = {
401
401
  'light',
402
402
  ],
403
403
  rules: {
404
- 'light/css-per-line': 2,
404
+ 'light/classname-per-line': 2,
405
405
  },
406
406
  }
407
407
  ```
@@ -40,7 +40,7 @@ module.exports = {
40
40
  const classValue = node.value.value.trim();
41
41
 
42
42
  // 检查是否已经是多行格式
43
- if (isAlreadyMultiLine(text)) {
43
+ if (isAlreadyMultiLine(text, threshold)) {
44
44
  return;
45
45
  }
46
46
 
@@ -88,8 +88,11 @@ function getQuoteChars(sourceCode, node) {
88
88
  }
89
89
 
90
90
 
91
- function isAlreadyMultiLine(text) {
91
+ function isAlreadyMultiLine(text, threshold) {
92
92
  const lines = text.split('\n');
93
+
94
+ const bad = lines.find(line => line.split(/\s+/).length > threshold);
95
+
93
96
  // 多于1行且不是空行
94
- return lines.length > 1 && lines.some(line => line.trim().length > 0);
97
+ return lines.length > 1 && lines.some(line => line.trim().length > 0) && !bad;
95
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-light",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Simple Eslint Plugin",
5
5
  "keywords": [
6
6
  "eslint",
@@ -8,7 +8,7 @@
8
8
  "eslint-plugin",
9
9
  "eslint-plugin-light"
10
10
  ],
11
- "homepage": "https://novlan1.github.io/plugin-light/zh/eslint-plugin-light.html",
11
+ "homepage": "https://novlan1.github.io/docs/plugin-light/zh/eslint-plugin-light.html",
12
12
  "bugs": {
13
13
  "url": "https://github.com/novlan1/plugin-light/issues"
14
14
  },