mm_eslint 1.5.5 → 1.5.6

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.
@@ -76,6 +76,37 @@ VariableName.prototype.VariableDeclaration = function (node) {
76
76
  for (let i = 0; i < node.declarations.length; i++) {
77
77
  let decl = node.declarations[i];
78
78
  if (decl.id && decl.id.type === 'Identifier') {
79
+
80
+ // 排除对象字面量(ObjectExpression)
81
+ if (decl.init && decl.init.type === 'ObjectExpression') {
82
+ continue;
83
+ }
84
+
85
+ // 排除数组字面量(ArrayExpression)
86
+ if (decl.init && decl.init.type === 'ArrayExpression') {
87
+ continue;
88
+ }
89
+
90
+ // 排除类实例:如果右边是 new 表达式,则不是变量
91
+ if (decl.init && decl.init.type === 'NewExpression') {
92
+ continue;
93
+ }
94
+
95
+ // 排除正则表达式字面量(RegExp实例)
96
+ if (decl.init && decl.init.type === 'Literal' && decl.init.regex) {
97
+ continue;
98
+ }
99
+
100
+ // 排除函数:如果右边是函数表达式或箭头函数,则不是变量
101
+ if (decl.init && (decl.init.type === 'FunctionExpression' || decl.init.type === 'ArrowFunctionExpression')) {
102
+ continue;
103
+ }
104
+
105
+ // 排除类:如果右边是类表达式,则不是变量
106
+ if (decl.init && decl.init.type === 'ClassExpression') {
107
+ continue;
108
+ }
109
+
79
110
  // 检测变量名
80
111
  let name = decl.id.name;
81
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_eslint",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
4
4
  "description": "ESLint plugin for personal naming conventions - supports PascalCase, camelCase, snake_case, and UPPER_SNAKE_CASE naming rules with intelligent recommendations",
5
5
  "main": "index.js",
6
6
  "keywords": [