mm_eslint 1.2.1 → 1.2.2

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 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1039,6 +1039,18 @@ Detector.prototype._getPropType = function (val_node, prop_name, parent_node) {
1039
1039
  return "method"; // 对象方法类型
1040
1040
  }
1041
1041
 
1042
+ // 优先检查属性名是否符合类命名规范(PascalCase)
1043
+ // 当属性名符合PascalCase时,优先考虑类类型
1044
+ if (prop_name && /^[A-Z][a-zA-Z0-9]*$/.test(prop_name)) {
1045
+ const common_config_names = ['config', 'options', 'params', 'settings', 'props'];
1046
+ const is_common_config = common_config_names.includes(prop_name.toLowerCase());
1047
+
1048
+ // 如果属性名符合PascalCase且不是常见配置参数名,优先认为是类类型
1049
+ if (!is_common_config) {
1050
+ return "class";
1051
+ }
1052
+ }
1053
+
1042
1054
  // 检查是否为函数
1043
1055
  if (
1044
1056
  val_node.type === "FunctionExpression" ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_eslint",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
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": [