oxlint-plugin-react-doctor 0.4.0-dev.5448962 → 0.4.0-dev.831cf3f

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/dist/index.d.ts CHANGED
@@ -4622,6 +4622,25 @@ declare const REACT_DOCTOR_RULES: readonly [{
4622
4622
  readonly recommendation?: string;
4623
4623
  readonly create: (context: RuleContext) => RuleVisitors;
4624
4624
  };
4625
+ }, {
4626
+ readonly key: "react-doctor/query-destructure-result";
4627
+ readonly id: "query-destructure-result";
4628
+ readonly source: "react-doctor";
4629
+ readonly originallyExternal: false;
4630
+ readonly rule: {
4631
+ readonly framework: "tanstack-query";
4632
+ readonly category: "Bugs";
4633
+ readonly id: string;
4634
+ readonly title?: string;
4635
+ readonly severity: RuleSeverity;
4636
+ readonly requires?: ReadonlyArray<string>;
4637
+ readonly disabledBy?: ReadonlyArray<string>;
4638
+ readonly tags?: ReadonlyArray<string>;
4639
+ readonly defaultEnabled?: boolean;
4640
+ readonly lifecycle?: "retired";
4641
+ readonly recommendation?: string;
4642
+ readonly create: (context: RuleContext) => RuleVisitors;
4643
+ };
4625
4644
  }, {
4626
4645
  readonly key: "react-doctor/query-mutation-missing-invalidation";
4627
4646
  readonly id: "query-mutation-missing-invalidation";
@@ -11053,6 +11072,25 @@ declare const RULES: readonly [{
11053
11072
  readonly recommendation?: string;
11054
11073
  readonly create: (context: RuleContext) => RuleVisitors;
11055
11074
  };
11075
+ }, {
11076
+ readonly key: "react-doctor/query-destructure-result";
11077
+ readonly id: "query-destructure-result";
11078
+ readonly source: "react-doctor";
11079
+ readonly originallyExternal: false;
11080
+ readonly rule: {
11081
+ readonly framework: "tanstack-query";
11082
+ readonly category: "Bugs";
11083
+ readonly id: string;
11084
+ readonly title?: string;
11085
+ readonly severity: RuleSeverity;
11086
+ readonly requires?: ReadonlyArray<string>;
11087
+ readonly disabledBy?: ReadonlyArray<string>;
11088
+ readonly tags?: ReadonlyArray<string>;
11089
+ readonly defaultEnabled?: boolean;
11090
+ readonly lifecycle?: "retired";
11091
+ readonly recommendation?: string;
11092
+ readonly create: (context: RuleContext) => RuleVisitors;
11093
+ };
11056
11094
  }, {
11057
11095
  readonly key: "react-doctor/query-mutation-missing-invalidation";
11058
11096
  readonly id: "query-mutation-missing-invalidation";
package/dist/index.js CHANGED
@@ -25588,6 +25588,26 @@ const preferUseReducer = defineRule({
25588
25588
  }
25589
25589
  });
25590
25590
  //#endregion
25591
+ //#region src/plugin/rules/tanstack-query/query-destructure-result.ts
25592
+ const queryDestructureResult = defineRule({
25593
+ id: "query-destructure-result",
25594
+ title: "Destructure TanStack Query result",
25595
+ tags: ["test-noise"],
25596
+ requires: ["tanstack-query"],
25597
+ severity: "error",
25598
+ recommendation: "Destructure only the fields you need, like `const { data, isLoading } = useQuery(...)`. Assigning the whole object bypasses TanStack Query's tracked-property optimization and subscribes to every field.",
25599
+ create: (context) => ({ VariableDeclarator(node) {
25600
+ if (!isNodeOfType(node.id, "Identifier")) return;
25601
+ if (!node.init || !isNodeOfType(node.init, "CallExpression")) return;
25602
+ const calleeName = isNodeOfType(node.init.callee, "Identifier") ? node.init.callee.name : null;
25603
+ if (!calleeName || !TANSTACK_QUERY_HOOKS.has(calleeName)) return;
25604
+ context.report({
25605
+ node: node.id,
25606
+ message: `Destructure ${calleeName}() results instead of assigning the whole query object, so TanStack Query only subscribes to the fields you use.`
25607
+ });
25608
+ } })
25609
+ });
25610
+ //#endregion
25591
25611
  //#region src/plugin/rules/tanstack-query/query-mutation-missing-invalidation.ts
25592
25612
  const queryMutationMissingInvalidation = defineRule({
25593
25613
  id: "query-mutation-missing-invalidation",
@@ -37261,6 +37281,17 @@ const reactDoctorRules = [
37261
37281
  category: "Bugs"
37262
37282
  }
37263
37283
  },
37284
+ {
37285
+ key: "react-doctor/query-destructure-result",
37286
+ id: "query-destructure-result",
37287
+ source: "react-doctor",
37288
+ originallyExternal: false,
37289
+ rule: {
37290
+ ...queryDestructureResult,
37291
+ framework: "tanstack-query",
37292
+ category: "Bugs"
37293
+ }
37294
+ },
37264
37295
  {
37265
37296
  key: "react-doctor/query-mutation-missing-invalidation",
37266
37297
  id: "query-mutation-missing-invalidation",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-react-doctor",
3
- "version": "0.4.0-dev.5448962",
3
+ "version": "0.4.0-dev.831cf3f",
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",