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.
Files changed (2) hide show
  1. package/index.js +4 -7
  2. 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
- const detector = new Detector({ "method-name": options });
1942
- const result = detector.checkName(method_name, "method-name");
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_eslint",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
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": [