eslint-plugin-no-mistakes 0.10.0 → 0.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-no-mistakes",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "ESLint and Oxlint rules for deterministic no-mistakes code analysis",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,6 +39,10 @@ function identifierName(node) {
39
39
  return node && node.type === "Identifier" ? node.name : null;
40
40
  }
41
41
 
42
+ function directCalleeName(call) {
43
+ return identifierName(unwrapExpression(call.callee));
44
+ }
45
+
42
46
  function isSameArgumentList(params, args) {
43
47
  if (params.length !== args.length) return false;
44
48
  return params.every((param, index) => {
@@ -55,16 +59,17 @@ function isSameArgumentList(params, args) {
55
59
  }
56
60
 
57
61
  function isSelfCall(node, call) {
58
- if (call.callee.type !== "Identifier") return false;
62
+ const callee = directCalleeName(call);
63
+ if (!callee) return false;
59
64
  const wrapper = variableWrapperName(node);
60
- if (wrapper) return wrapper === call.callee.name;
61
- if (node.id && node.id.name === call.callee.name) return true;
65
+ if (wrapper) return wrapper === callee;
66
+ if (node.id && node.id.name === callee) return true;
62
67
  const parent = node.parent;
63
68
  return (
64
69
  parent &&
65
70
  parent.type === "VariableDeclarator" &&
66
71
  parent.id.type === "Identifier" &&
67
- parent.id.name === call.callee.name
72
+ parent.id.name === callee
68
73
  );
69
74
  }
70
75
 
@@ -100,6 +105,7 @@ function reportIfAlias(node, context) {
100
105
  if (!isNamedWrapper(node)) return;
101
106
  const call = onlyCallExpression(node.body);
102
107
  if (!call || call.type !== "CallExpression") return;
108
+ if (!directCalleeName(call)) return;
103
109
  if (isSelfCall(node, call)) return;
104
110
  if (isSameArgumentList(node.params || [], call.arguments)) {
105
111
  context.report({ node, messageId: "alias" });