oxlint-plugin-react-doctor 0.5.4-dev.e90eb7a → 0.5.4

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 +9 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22559,10 +22559,9 @@ const TANSTACK_ROUTE_CREATION_FUNCTIONS = new Set([
22559
22559
  "createRootRouteWithContext"
22560
22560
  ]);
22561
22561
  const TANSTACK_SERVER_FN_NAMES = new Set(["createServerFn"]);
22562
- const TANSTACK_INPUT_VALIDATOR_METHOD_NAMES = new Set(["validator", "inputValidator"]);
22563
22562
  const TANSTACK_MIDDLEWARE_METHOD_ORDER = [
22564
22563
  "middleware",
22565
- "validator",
22564
+ "inputValidator",
22566
22565
  "client",
22567
22566
  "server",
22568
22567
  "handler"
@@ -35201,7 +35200,7 @@ const walkServerFnChain = (outerNode) => {
35201
35200
  const result = {
35202
35201
  isServerFnChain: false,
35203
35202
  specifiedMethod: null,
35204
- hasInputValidation: false
35203
+ hasInputValidator: false
35205
35204
  };
35206
35205
  if (!isNodeOfType(outerNode, "CallExpression")) return result;
35207
35206
  if (!isNodeOfType(outerNode.callee, "MemberExpression")) return result;
@@ -35215,7 +35214,7 @@ const walkServerFnChain = (outerNode) => {
35215
35214
  for (const property of optionsArgument.properties ?? []) if (isNodeOfType(property, "Property") && isNodeOfType(property.key, "Identifier") && property.key.name === "method" && isNodeOfType(property.value, "Literal") && typeof property.value.value === "string") result.specifiedMethod = property.value.value;
35216
35215
  }
35217
35216
  }
35218
- if (calleeName && TANSTACK_INPUT_VALIDATOR_METHOD_NAMES.has(calleeName)) result.hasInputValidation = true;
35217
+ if (calleeName === "inputValidator") result.hasInputValidator = true;
35219
35218
  if (isNodeOfType(currentNode.callee, "MemberExpression")) currentNode = currentNode.callee.object;
35220
35219
  else break;
35221
35220
  }
@@ -35769,14 +35768,13 @@ const tanstackStartRoutePropertyOrder = defineRule({
35769
35768
  });
35770
35769
  //#endregion
35771
35770
  //#region src/plugin/rules/tanstack-start/tanstack-start-server-fn-method-order.ts
35772
- const toMethodOrderToken = (methodName) => TANSTACK_INPUT_VALIDATOR_METHOD_NAMES.has(methodName) ? "validator" : methodName;
35773
35771
  const tanstackStartServerFnMethodOrder = defineRule({
35774
35772
  id: "tanstack-start-server-fn-method-order",
35775
35773
  title: "Server function method order breaks type inference",
35776
35774
  tags: ["test-noise"],
35777
35775
  requires: ["tanstack-start"],
35778
35776
  severity: "error",
35779
- recommendation: "Chain methods in order: .middleware() → .validator() → .client() → .server() → .handler(). Types depend on this sequence.",
35777
+ recommendation: "Chain methods in order: .middleware() → .inputValidator() → .client() → .server() → .handler(). Types depend on this sequence.",
35780
35778
  create: (context) => ({ CallExpression(node) {
35781
35779
  if (!isNodeOfType(node.callee, "MemberExpression")) return;
35782
35780
  const methodNames = [];
@@ -35791,10 +35789,10 @@ const tanstackStartServerFnMethodOrder = defineRule({
35791
35789
  } else return;
35792
35790
  const ownMethodName = isNodeOfType(node.callee.property, "Identifier") ? node.callee.property.name : null;
35793
35791
  if (methodNames[methodNames.length - 1] !== ownMethodName) return;
35794
- const orderSensitiveMethods = methodNames.filter((name) => TANSTACK_MIDDLEWARE_METHOD_ORDER.includes(toMethodOrderToken(name)));
35792
+ const orderSensitiveMethods = methodNames.filter((name) => TANSTACK_MIDDLEWARE_METHOD_ORDER.includes(name));
35795
35793
  let lastIndex = -1;
35796
35794
  for (const methodName of orderSensitiveMethods) {
35797
- const currentIndex = TANSTACK_MIDDLEWARE_METHOD_ORDER.indexOf(toMethodOrderToken(methodName));
35795
+ const currentIndex = TANSTACK_MIDDLEWARE_METHOD_ORDER.indexOf(methodName);
35798
35796
  if (currentIndex < lastIndex) {
35799
35797
  const expectedBefore = TANSTACK_MIDDLEWARE_METHOD_ORDER[lastIndex];
35800
35798
  context.report({
@@ -35815,7 +35813,7 @@ const tanstackStartServerFnValidateInput = defineRule({
35815
35813
  tags: ["test-noise"],
35816
35814
  requires: ["tanstack-start"],
35817
35815
  severity: "warn",
35818
- recommendation: "Add `.validator(schema)` before `.handler()`. This data crosses the network and must be validated at runtime.",
35816
+ recommendation: "Add `.inputValidator(schema)` before `.handler()`. This data crosses the network and must be validated at runtime.",
35819
35817
  create: (context) => ({ CallExpression(node) {
35820
35818
  if (!isNodeOfType(node.callee, "MemberExpression")) return;
35821
35819
  if (!isNodeOfType(node.callee.property, "Identifier")) return;
@@ -35829,9 +35827,9 @@ const tanstackStartServerFnValidateInput = defineRule({
35829
35827
  if (isNodeOfType(child, "MemberExpression") && isNodeOfType(child.property, "Identifier") && child.property.name === "data") accessesData = true;
35830
35828
  if (isNodeOfType(child, "ObjectPattern") && child.properties?.some((property) => isNodeOfType(property, "Property") && isNodeOfType(property.key, "Identifier") && property.key.name === "data")) accessesData = true;
35831
35829
  });
35832
- if (accessesData && !chainInfo.hasInputValidation) context.report({
35830
+ if (accessesData && !chainInfo.hasInputValidator) context.report({
35833
35831
  node,
35834
- message: "This server function reads network data with no validator(), so anyone can send unvalidated input."
35832
+ message: "This server function reads network data with no inputValidator(), so anyone can send unvalidated input."
35835
35833
  });
35836
35834
  } })
35837
35835
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-react-doctor",
3
- "version": "0.5.4-dev.e90eb7a",
3
+ "version": "0.5.4",
4
4
  "description": "oxlint plugin for React Doctor: diagnose React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
5
5
  "keywords": [
6
6
  "accessibility",