mm_eslint 1.2.0 → 1.2.1
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/index.js +15 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1048,7 +1048,21 @@ Detector.prototype._getPropType = function (val_node, prop_name, parent_node) {
|
|
|
1048
1048
|
(val_node.name.endsWith("Function") ||
|
|
1049
1049
|
val_node.name.endsWith("Func") ||
|
|
1050
1050
|
val_node.name.startsWith("on") ||
|
|
1051
|
-
val_node.name.startsWith("handle")
|
|
1051
|
+
val_node.name.startsWith("handle") ||
|
|
1052
|
+
// 新增:常见函数命名模式识别
|
|
1053
|
+
val_node.name.endsWith("Manager") ||
|
|
1054
|
+
val_node.name.endsWith("Admin") ||
|
|
1055
|
+
val_node.name.endsWith("Handler") ||
|
|
1056
|
+
val_node.name.endsWith("Service") ||
|
|
1057
|
+
val_node.name.endsWith("Util") ||
|
|
1058
|
+
val_node.name.endsWith("Helper") ||
|
|
1059
|
+
val_node.name.endsWith("Factory") ||
|
|
1060
|
+
val_node.name.endsWith("Provider") ||
|
|
1061
|
+
// 检查是否为小驼峰命名(函数常见命名风格)
|
|
1062
|
+
(/^[a-z][a-zA-Z0-9]*$/.test(val_node.name) &&
|
|
1063
|
+
val_node.name !== val_node.name.toLowerCase() &&
|
|
1064
|
+
!val_node.name.includes("_") &&
|
|
1065
|
+
!val_node.name.includes("-"))))
|
|
1052
1066
|
) {
|
|
1053
1067
|
return "function";
|
|
1054
1068
|
}
|