mm_eslint 1.0.7 → 1.0.8
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 +4 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1922,11 +1922,6 @@ const prototype_method_rule = {
|
|
|
1922
1922
|
) {
|
|
1923
1923
|
const method_name = node.left.property.name;
|
|
1924
1924
|
|
|
1925
|
-
// 跳过私有方法的检测(私有方法由private-naming规则处理)
|
|
1926
|
-
if (method_name.startsWith("_")) {
|
|
1927
|
-
return;
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
1925
|
// 跳过JavaScript内置特殊方法名
|
|
1931
1926
|
const builtin_methods = [
|
|
1932
1927
|
"constructor",
|
|
@@ -1938,8 +1933,10 @@ const prototype_method_rule = {
|
|
|
1938
1933
|
return;
|
|
1939
1934
|
}
|
|
1940
1935
|
|
|
1941
|
-
|
|
1942
|
-
const
|
|
1936
|
+
// 根据方法名是否以下划线开头,选择不同的检测规则
|
|
1937
|
+
const rule_name = method_name.startsWith("_") ? "private-method-naming" : "method-name";
|
|
1938
|
+
const detector = new Detector({ [rule_name]: options });
|
|
1939
|
+
const result = detector.checkName(method_name, rule_name);
|
|
1943
1940
|
|
|
1944
1941
|
if (!result.valid) {
|
|
1945
1942
|
result.errors.forEach((error) => {
|