oxlint-plugin-react-doctor 0.7.5-dev.8fc5848 → 0.7.5-dev.bc49aaa

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/dist/index.js +43 -69
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23108,73 +23108,61 @@ const PURE_GLOBAL_CALLEE_NAMES = new Set([
23108
23108
  "Array",
23109
23109
  "BigInt",
23110
23110
  "Boolean",
23111
- "encodeURIComponent",
23112
23111
  "Number",
23113
23112
  "Object",
23114
23113
  "String",
23115
23114
  "parseFloat",
23116
- "parseInt",
23117
- "structuredClone"
23118
- ]);
23119
- const PURE_GLOBAL_CONSTRUCTOR_NAMES = new Set(["Date", "Set"]);
23120
- const PURE_HELPER_NAMESPACE_MEMBER_NAMES = new Map([
23121
- ["Array", new Set(["from"])],
23122
- ["JSON", new Set([
23123
- "isRawJSON",
23124
- "parse",
23125
- "rawJSON",
23126
- "stringify"
23127
- ])],
23128
- ["Math", new Set([
23129
- "abs",
23130
- "acos",
23131
- "acosh",
23132
- "asin",
23133
- "asinh",
23134
- "atan",
23135
- "atan2",
23136
- "atanh",
23137
- "cbrt",
23138
- "ceil",
23139
- "clz32",
23140
- "cos",
23141
- "cosh",
23142
- "exp",
23143
- "floor",
23144
- "fround",
23145
- "hypot",
23146
- "imul",
23147
- "log",
23148
- "log10",
23149
- "log1p",
23150
- "log2",
23151
- "max",
23152
- "min",
23153
- "pow",
23154
- "round",
23155
- "sign",
23156
- "sin",
23157
- "sinh",
23158
- "sqrt",
23159
- "tan",
23160
- "tanh",
23161
- "trunc"
23162
- ])],
23163
- ["Object", new Set(["assign"])]
23115
+ "parseInt"
23164
23116
  ]);
23117
+ const PURE_GLOBAL_NAMESPACE_NAMES = new Set(["JSON", "Math"]);
23118
+ const PURE_HELPER_NAMESPACE_MEMBER_NAMES = new Map([["JSON", new Set([
23119
+ "isRawJSON",
23120
+ "parse",
23121
+ "rawJSON",
23122
+ "stringify"
23123
+ ])], ["Math", new Set([
23124
+ "abs",
23125
+ "acos",
23126
+ "acosh",
23127
+ "asin",
23128
+ "asinh",
23129
+ "atan",
23130
+ "atan2",
23131
+ "atanh",
23132
+ "cbrt",
23133
+ "ceil",
23134
+ "clz32",
23135
+ "cos",
23136
+ "cosh",
23137
+ "exp",
23138
+ "floor",
23139
+ "fround",
23140
+ "hypot",
23141
+ "imul",
23142
+ "log",
23143
+ "log10",
23144
+ "log1p",
23145
+ "log2",
23146
+ "max",
23147
+ "min",
23148
+ "pow",
23149
+ "round",
23150
+ "sign",
23151
+ "sin",
23152
+ "sinh",
23153
+ "sqrt",
23154
+ "tan",
23155
+ "tanh",
23156
+ "trunc"
23157
+ ])]]);
23165
23158
  const PURE_MEMBER_TRANSFORM_NAMES = new Set([
23166
23159
  "concat",
23167
23160
  "filter",
23168
- "flatMap",
23169
23161
  "join",
23170
23162
  "map",
23171
- "reduce",
23172
- "replace",
23173
- "slice",
23174
23163
  "split",
23175
23164
  "toLowerCase",
23176
23165
  "toString",
23177
- "toSorted",
23178
23166
  "toUpperCase",
23179
23167
  "trim"
23180
23168
  ]);
@@ -23556,11 +23544,6 @@ const analyzeHelperExpression = (expression, environment, usedParameterIndices)
23556
23544
  const callbackSummary = analyzeHelperStatements(node.body.body ?? [], callbackEnvironment, usedParameterIndices, analyzeHelperExpression);
23557
23545
  return callbackSummary.isValid && !callbackSummary.canContinue;
23558
23546
  }
23559
- if (isNodeOfType(node, "NewExpression")) {
23560
- const callee = stripParenExpression(node.callee);
23561
- if (!isNodeOfType(callee, "Identifier") || !PURE_GLOBAL_CONSTRUCTOR_NAMES.has(callee.name) || environment.parameterIndices.has(callee.name) || environment.recursiveNames.has(callee.name) || environment.shadowedGlobalNames.has(callee.name)) return false;
23562
- return (node.arguments ?? []).every((argument) => analyzeHelperExpression(argument, environment, usedParameterIndices));
23563
- }
23564
23547
  if (isNodeOfType(node, "CallExpression")) {
23565
23548
  const callee = stripParenExpression(node.callee);
23566
23549
  const calleeRoot = getMemberRoot(callee);
@@ -23763,7 +23746,7 @@ const collectValueEvidence = (analysis, expression, frame, remainingCallFrames,
23763
23746
  }
23764
23747
  const callee = stripParenExpression(node.callee);
23765
23748
  const calleeRoot = getMemberRoot(callee);
23766
- const isPureGlobalCall = isNodeOfType(callee, "Identifier") && PURE_GLOBAL_CALLEE_NAMES.has(callee.name) && getIdentifierBindingIdentity(analysis, callee) === null || isNodeOfType(callee, "MemberExpression") && isNodeOfType(calleeRoot, "Identifier") && getIdentifierBindingIdentity(analysis, calleeRoot) === null && PURE_HELPER_NAMESPACE_MEMBER_NAMES.get(calleeRoot.name)?.has(getStaticMemberName$1(callee) ?? "") === true;
23749
+ const isPureGlobalCall = isNodeOfType(callee, "Identifier") && PURE_GLOBAL_CALLEE_NAMES.has(callee.name) && getIdentifierBindingIdentity(analysis, callee) === null || isNodeOfType(calleeRoot, "Identifier") && PURE_GLOBAL_NAMESPACE_NAMES.has(calleeRoot.name) && getIdentifierBindingIdentity(analysis, calleeRoot) === null;
23767
23750
  const isPureMemberTransform = isNodeOfType(callee, "MemberExpression") && PURE_MEMBER_TRANSFORM_NAMES.has(getStaticMemberName$1(callee) ?? "");
23768
23751
  if (isPureGlobalCall || isPureMemberTransform) {
23769
23752
  if (isPureMemberTransform && isNodeOfType(callee, "MemberExpression")) mergeEvidence(evidence, collectValueEvidence(analysis, callee.object, frame, remainingCallFrames, new Set(visitedBindings)));
@@ -23816,15 +23799,6 @@ const collectValueEvidence = (analysis, expression, frame, remainingCallFrames,
23816
23799
  }
23817
23800
  return evidence;
23818
23801
  }
23819
- if (isNodeOfType(node, "NewExpression")) {
23820
- const callee = stripParenExpression(node.callee);
23821
- if (!isNodeOfType(callee, "Identifier") || !PURE_GLOBAL_CONSTRUCTOR_NAMES.has(callee.name) || getIdentifierBindingIdentity(analysis, callee) !== null) {
23822
- evidence.hasUnknownSource = true;
23823
- return evidence;
23824
- }
23825
- for (const argument of node.arguments ?? []) mergeEvidence(evidence, collectValueEvidence(analysis, argument, frame, remainingCallFrames, new Set(visitedBindings)));
23826
- return evidence;
23827
- }
23828
23802
  if (isFunctionLike$1(node) || isNodeOfType(node, "AwaitExpression")) {
23829
23803
  evidence.hasUnknownSource = true;
23830
23804
  return evidence;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-react-doctor",
3
- "version": "0.7.5-dev.8fc5848",
3
+ "version": "0.7.5-dev.bc49aaa",
4
4
  "description": "React Doctor rules for oxlint.",
5
5
  "keywords": [
6
6
  "accessibility",