mm_eslint 1.3.3 → 1.3.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.
- package/config.js +6 -2
- package/detector.js +6 -0
- package/package.json +1 -1
package/config.js
CHANGED
|
@@ -13,7 +13,8 @@ class Config {
|
|
|
13
13
|
'class-name': [],
|
|
14
14
|
'method-name': [],
|
|
15
15
|
'variable-name': [],
|
|
16
|
-
'constant-name': []
|
|
16
|
+
'constant-name': [],
|
|
17
|
+
'property-value-name': [] // 忽略$符号的属性值名
|
|
17
18
|
},
|
|
18
19
|
// 禁止词
|
|
19
20
|
forbidden_words: {
|
|
@@ -498,10 +499,13 @@ Config.prototype.getIgnoredWords = function (name_type) {
|
|
|
498
499
|
'Middleware', 'Component', 'Controller', 'Repository', 'Interface', 'Transform', 'Template'
|
|
499
500
|
],
|
|
500
501
|
'variable-name': [
|
|
501
|
-
'i', 'k', 'x', 'y', 'z', 'n', 'm', 'o', 'middleware', 'component', 'controller', 'repository', 'interface', 'transformer', 'template'
|
|
502
|
+
'i', 'k', 'x', 'y', 'z', 'n', 'm', 'o', 'middleware', 'component', 'controller', 'repository', 'interface', 'transformer', 'template', '$'
|
|
502
503
|
],
|
|
503
504
|
'param-name': [
|
|
504
505
|
'middleware', 'component', 'controller', 'repository', 'interface', 'transformer', 'template'
|
|
506
|
+
],
|
|
507
|
+
'property-value-name': [
|
|
508
|
+
'$' // 忽略$符号的属性值名
|
|
505
509
|
]
|
|
506
510
|
};
|
|
507
511
|
|
package/detector.js
CHANGED
|
@@ -751,6 +751,12 @@ Detector.prototype._checkPropertyName = function (
|
|
|
751
751
|
break;
|
|
752
752
|
}
|
|
753
753
|
|
|
754
|
+
// 检查忽略词
|
|
755
|
+
var ignored_words = this.config.getIgnoredWords(rule_type);
|
|
756
|
+
if (ignored_words && ignored_words.includes(prop_name)) {
|
|
757
|
+
return null; // 忽略词不进行命名规范检测
|
|
758
|
+
}
|
|
759
|
+
|
|
754
760
|
var rule = this.config.getRule(rule_type);
|
|
755
761
|
if (!rule) {
|
|
756
762
|
return null;
|