oxlint-plugin-react-doctor 0.7.8-dev.4829841 → 0.7.8-dev.9256423

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 +13 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -43134,6 +43134,13 @@ const getBooleanFormula$1 = (analysis, context, node, protectedSymbolIds, visite
43134
43134
  }
43135
43135
  return null;
43136
43136
  };
43137
+ const getRequiredTruthyConditions = (analysis, context, node, protectedSymbolIds) => {
43138
+ const formula = getBooleanFormula$1(analysis, context, node, protectedSymbolIds);
43139
+ if (formula) return [formula];
43140
+ const expression = stripParenExpression(node);
43141
+ if (!isNodeOfType(expression, "LogicalExpression") || expression.operator !== "&&") return [];
43142
+ return [...getRequiredTruthyConditions(analysis, context, expression.left, protectedSymbolIds), ...getRequiredTruthyConditions(analysis, context, expression.right, protectedSymbolIds)];
43143
+ };
43137
43144
  const evaluateBooleanFormula$1 = (formula, assignments) => {
43138
43145
  if (formula.kind === "constant") return formula.constantValue ?? null;
43139
43146
  if (formula.kind === "atom") return formula.atomKey === void 0 ? null : assignments.get(formula.atomKey) ?? null;
@@ -43268,9 +43275,11 @@ const collectExposureConditions = (analysis, context, node, componentNode, prote
43268
43275
  let parent = node.parent;
43269
43276
  while (parent) {
43270
43277
  if (isNodeOfType(parent, "LogicalExpression") && parent.right === child) {
43271
- const leftFormula = getBooleanFormula$1(analysis, context, parent.left, protectedSymbolIds);
43272
- if (leftFormula && parent.operator === "&&") conditions.push(leftFormula);
43273
- if (leftFormula && parent.operator === "||") conditions.push(createNotFormula(leftFormula));
43278
+ if (parent.operator === "&&") conditions.push(...getRequiredTruthyConditions(analysis, context, parent.left, protectedSymbolIds));
43279
+ if (parent.operator === "||") {
43280
+ const leftFormula = getBooleanFormula$1(analysis, context, parent.left, protectedSymbolIds);
43281
+ if (leftFormula) conditions.push(createNotFormula(leftFormula));
43282
+ }
43274
43283
  } else if (isNodeOfType(parent, "ConditionalExpression")) {
43275
43284
  const testFormula = getBooleanFormula$1(analysis, context, parent.test, protectedSymbolIds);
43276
43285
  if (testFormula && parent.consequent === child) conditions.push(testFormula);
@@ -43501,7 +43510,7 @@ const areAllSetterWritesVisibilityGuarded = (analysis, context, componentNode, r
43501
43510
  const areAllResetStateReadsHiddenUntilReset = (analysis, context, componentNode, setterReferences, dependencyReferences) => {
43502
43511
  if (dependencyReferences.length !== 1) return false;
43503
43512
  const dependencySymbols = getPropDerivedDependencySymbols(analysis, context, dependencyReferences);
43504
- if (dependencySymbols.length === 0 || dependencySymbols.some((symbol) => !isBooleanExpression$1(context, symbol.bindingIdentifier))) return false;
43513
+ if (dependencySymbols.length === 0 || dependencySymbols.some((symbol) => !isBooleanExpression$1(context, symbol.bindingIdentifier) || symbol.references.some((reference) => reference.flag !== "read"))) return false;
43505
43514
  const dependencySymbolIds = new Set(dependencySymbols.map((symbol) => symbol.id));
43506
43515
  const dependencyFormulas = dependencySymbols.map((symbol) => ({
43507
43516
  kind: "atom",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-react-doctor",
3
- "version": "0.7.8-dev.4829841",
3
+ "version": "0.7.8-dev.9256423",
4
4
  "description": "React Doctor rules for oxlint.",
5
5
  "keywords": [
6
6
  "accessibility",