mm_eslint 1.1.5 → 1.1.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.
Files changed (2) hide show
  1. package/index.js +12 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2087,18 +2087,20 @@ const constant_name_rule = {
2087
2087
  return {
2088
2088
  VariableDeclarator(node) {
2089
2089
  if (node.id.type === "Identifier" && node.parent.kind === "const") {
2090
- // 对所有const声明应用常量命名规则
2091
- const constant_name = node.id.name;
2092
- const detector = new Detector({ "constant-name": options });
2093
- const result = detector.checkName(constant_name, "constant-name");
2090
+ // 只对真正的常量应用常量命名规则
2091
+ if (isRealConstant(node)) {
2092
+ const constant_name = node.id.name;
2093
+ const detector = new Detector({ "constant-name": options });
2094
+ const result = detector.checkName(constant_name, "constant-name");
2094
2095
 
2095
- if (!result.valid) {
2096
- result.errors.forEach((error) => {
2097
- context.report({
2098
- node: node.id,
2099
- message: `常量名"${constant_name}"不符合规范: ${error}`,
2096
+ if (!result.valid) {
2097
+ result.errors.forEach((error) => {
2098
+ context.report({
2099
+ node: node.id,
2100
+ message: `常量名"${constant_name}"不符合规范: ${error}`,
2101
+ });
2100
2102
  });
2101
- });
2103
+ }
2102
2104
  }
2103
2105
  }
2104
2106
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_eslint",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "ESLint plugin for naming conventions - PascalCase, camelCase, snake_case, and UPPER_SNAKE_CASE naming rules",
5
5
  "main": "index.js",
6
6
  "keywords": [