@tanstack/eslint-plugin-query 5.0.0-alpha.88 → 5.0.0-beta.10

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 (86) hide show
  1. package/build/legacy/__tests__/configs.test.cjs +21 -0
  2. package/build/legacy/__tests__/configs.test.cjs.map +1 -0
  3. package/build/legacy/__tests__/configs.test.d.cts +2 -0
  4. package/build/legacy/__tests__/configs.test.d.ts +2 -0
  5. package/build/legacy/__tests__/configs.test.js +19 -0
  6. package/build/legacy/__tests__/configs.test.js.map +1 -0
  7. package/build/legacy/__tests__/exhaustive-deps.test.cjs +722 -0
  8. package/build/legacy/__tests__/exhaustive-deps.test.cjs.map +1 -0
  9. package/build/legacy/__tests__/exhaustive-deps.test.d.cts +2 -0
  10. package/build/legacy/__tests__/exhaustive-deps.test.d.ts +2 -0
  11. package/build/legacy/__tests__/exhaustive-deps.test.js +720 -0
  12. package/build/legacy/__tests__/exhaustive-deps.test.js.map +1 -0
  13. package/build/legacy/configs.cjs +46 -0
  14. package/build/legacy/configs.cjs.map +1 -0
  15. package/build/legacy/configs.d.cts +8 -0
  16. package/build/legacy/configs.d.ts +8 -0
  17. package/build/legacy/configs.js +21 -0
  18. package/build/legacy/configs.js.map +1 -0
  19. package/build/legacy/index.cjs +28 -431
  20. package/build/legacy/index.cjs.map +1 -1
  21. package/build/legacy/index.d.cts +3 -14
  22. package/build/legacy/index.d.ts +3 -14
  23. package/build/legacy/index.js +3 -432
  24. package/build/legacy/index.js.map +1 -1
  25. package/build/legacy/rules/exhaustive-deps.rule.cjs +141 -0
  26. package/build/legacy/rules/exhaustive-deps.rule.cjs.map +1 -0
  27. package/build/legacy/rules/exhaustive-deps.rule.d.cts +6 -0
  28. package/build/legacy/rules/exhaustive-deps.rule.d.ts +6 -0
  29. package/build/legacy/rules/exhaustive-deps.rule.js +115 -0
  30. package/build/legacy/rules/exhaustive-deps.rule.js.map +1 -0
  31. package/build/legacy/rules/exhaustive-deps.utils.cjs +52 -0
  32. package/build/legacy/rules/exhaustive-deps.utils.cjs.map +1 -0
  33. package/build/legacy/rules/exhaustive-deps.utils.d.cts +12 -0
  34. package/build/legacy/rules/exhaustive-deps.utils.d.ts +12 -0
  35. package/build/legacy/rules/exhaustive-deps.utils.js +27 -0
  36. package/build/legacy/rules/exhaustive-deps.utils.js.map +1 -0
  37. package/build/legacy/rules.cjs +44 -0
  38. package/build/legacy/rules.cjs.map +1 -0
  39. package/build/legacy/rules.d.cts +7 -0
  40. package/build/legacy/rules.d.ts +7 -0
  41. package/build/legacy/rules.js +9 -0
  42. package/build/legacy/rules.js.map +1 -0
  43. package/build/legacy/utils/ast-utils.cjs +247 -0
  44. package/build/legacy/utils/ast-utils.cjs.map +1 -0
  45. package/build/legacy/utils/ast-utils.d.cts +41 -0
  46. package/build/legacy/utils/ast-utils.d.ts +41 -0
  47. package/build/legacy/utils/ast-utils.js +222 -0
  48. package/build/legacy/utils/ast-utils.js.map +1 -0
  49. package/build/legacy/utils/create-rule.cjs +39 -0
  50. package/build/legacy/utils/create-rule.cjs.map +1 -0
  51. package/build/legacy/utils/create-rule.d.cts +10 -0
  52. package/build/legacy/utils/create-rule.d.ts +10 -0
  53. package/build/legacy/utils/create-rule.js +14 -0
  54. package/build/legacy/utils/create-rule.js.map +1 -0
  55. package/build/legacy/utils/detect-react-query-imports.cjs +70 -0
  56. package/build/legacy/utils/detect-react-query-imports.cjs.map +1 -0
  57. package/build/legacy/utils/detect-react-query-imports.d.cts +12 -0
  58. package/build/legacy/utils/detect-react-query-imports.d.ts +12 -0
  59. package/build/legacy/utils/detect-react-query-imports.js +45 -0
  60. package/build/legacy/utils/detect-react-query-imports.js.map +1 -0
  61. package/build/legacy/utils/object-utils.cjs +33 -0
  62. package/build/legacy/utils/object-utils.cjs.map +1 -0
  63. package/build/legacy/utils/object-utils.d.cts +3 -0
  64. package/build/legacy/utils/object-utils.d.ts +3 -0
  65. package/build/legacy/utils/object-utils.js +8 -0
  66. package/build/legacy/utils/object-utils.js.map +1 -0
  67. package/build/legacy/utils/test-utils.cjs +36 -0
  68. package/build/legacy/utils/test-utils.cjs.map +1 -0
  69. package/build/legacy/utils/test-utils.d.cts +3 -0
  70. package/build/legacy/utils/test-utils.d.ts +3 -0
  71. package/build/legacy/utils/test-utils.js +11 -0
  72. package/build/legacy/utils/test-utils.js.map +1 -0
  73. package/build/legacy/utils/unique-by.cjs +33 -0
  74. package/build/legacy/utils/unique-by.cjs.map +1 -0
  75. package/build/legacy/utils/unique-by.d.cts +3 -0
  76. package/build/legacy/utils/unique-by.d.ts +3 -0
  77. package/build/legacy/utils/unique-by.js +8 -0
  78. package/build/legacy/utils/unique-by.js.map +1 -0
  79. package/package.json +2 -2
  80. package/src/{configs/index.test.ts → __tests__/configs.test.ts} +1 -1
  81. package/src/{rules/exhaustive-deps → __tests__}/exhaustive-deps.test.ts +2 -2
  82. package/src/{configs/index.ts → configs.ts} +1 -1
  83. package/src/rules/{exhaustive-deps/exhaustive-deps.rule.ts → exhaustive-deps.rule.ts} +3 -3
  84. package/src/rules/{exhaustive-deps/exhaustive-deps.utils.ts → exhaustive-deps.utils.ts} +1 -1
  85. package/src/rules.ts +5 -0
  86. package/src/rules/index.ts +0 -5
@@ -0,0 +1,10 @@
1
+ import * as _typescript_eslint_utils_dist_ts_eslint_Rule from '@typescript-eslint/utils/dist/ts-eslint/Rule';
2
+ import { ESLintUtils } from '@typescript-eslint/utils';
3
+ import { EnhancedCreate } from './detect-react-query-imports.cjs';
4
+
5
+ type EslintRule = Omit<Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0], 'create'> & {
6
+ create: EnhancedCreate;
7
+ };
8
+ declare function createRule({ create, ...rest }: EslintRule): _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<string, readonly unknown[], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
9
+
10
+ export { createRule };
@@ -0,0 +1,10 @@
1
+ import * as _typescript_eslint_utils_dist_ts_eslint_Rule from '@typescript-eslint/utils/dist/ts-eslint/Rule';
2
+ import { ESLintUtils } from '@typescript-eslint/utils';
3
+ import { EnhancedCreate } from './detect-react-query-imports.js';
4
+
5
+ type EslintRule = Omit<Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0], 'create'> & {
6
+ create: EnhancedCreate;
7
+ };
8
+ declare function createRule({ create, ...rest }: EslintRule): _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<string, readonly unknown[], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
9
+
10
+ export { createRule };
@@ -0,0 +1,14 @@
1
+ // src/utils/create-rule.ts
2
+ import { ESLintUtils } from "@typescript-eslint/utils";
3
+ import { detectTanstackQueryImports } from "./detect-react-query-imports.js";
4
+ var getDocsUrl = (ruleName) => `https://tanstack.com/query/v4/docs/eslint/${ruleName}`;
5
+ function createRule({ create, ...rest }) {
6
+ return ESLintUtils.RuleCreator(getDocsUrl)({
7
+ ...rest,
8
+ create: detectTanstackQueryImports(create)
9
+ });
10
+ }
11
+ export {
12
+ createRule
13
+ };
14
+ //# sourceMappingURL=create-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/create-rule.ts"],"sourcesContent":["import { ESLintUtils } from '@typescript-eslint/utils'\nimport { detectTanstackQueryImports } from './detect-react-query-imports'\nimport type { EnhancedCreate } from './detect-react-query-imports'\n\nconst getDocsUrl = (ruleName: string): string =>\n `https://tanstack.com/query/v4/docs/eslint/${ruleName}`\n\ntype EslintRule = Omit<\n Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0],\n 'create'\n> & {\n create: EnhancedCreate\n}\n\nexport function createRule({ create, ...rest }: EslintRule) {\n return ESLintUtils.RuleCreator(getDocsUrl)({\n ...rest,\n create: detectTanstackQueryImports(create),\n })\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,kCAAkC;AAG3C,IAAM,aAAa,CAAC,aAClB,6CAA6C,QAAQ;AAShD,SAAS,WAAW,EAAE,QAAQ,GAAG,KAAK,GAAe;AAC1D,SAAO,YAAY,YAAY,UAAU,EAAE;AAAA,IACzC,GAAG;AAAA,IACH,QAAQ,2BAA2B,MAAM;AAAA,EAC3C,CAAC;AACH;","names":[]}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/detect-react-query-imports.ts
21
+ var detect_react_query_imports_exports = {};
22
+ __export(detect_react_query_imports_exports, {
23
+ detectTanstackQueryImports: () => detectTanstackQueryImports
24
+ });
25
+ module.exports = __toCommonJS(detect_react_query_imports_exports);
26
+ function detectTanstackQueryImports(create) {
27
+ return (context, optionsWithDefault) => {
28
+ const tanstackQueryImportSpecifiers = [];
29
+ const helpers = {
30
+ isTanstackQueryImport(node) {
31
+ return !!tanstackQueryImportSpecifiers.find((specifier) => {
32
+ if (specifier.type === "ImportSpecifier") {
33
+ return node.name === specifier.local.name;
34
+ }
35
+ return false;
36
+ });
37
+ }
38
+ };
39
+ const detectionInstructions = {
40
+ ImportDeclaration(node) {
41
+ if (node.specifiers.length > 0 && node.importKind === "value" && node.source.value.startsWith("@tanstack/") && node.source.value.endsWith("-query")) {
42
+ tanstackQueryImportSpecifiers.push(...node.specifiers);
43
+ }
44
+ }
45
+ };
46
+ const ruleInstructions = create(context, optionsWithDefault, helpers);
47
+ const enhancedRuleInstructions = {};
48
+ const allKeys = new Set(
49
+ Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions))
50
+ );
51
+ allKeys.forEach((instruction) => {
52
+ enhancedRuleInstructions[instruction] = (node) => {
53
+ var _a, _b;
54
+ if (instruction in detectionInstructions) {
55
+ (_a = detectionInstructions[instruction]) == null ? void 0 : _a.call(detectionInstructions, node);
56
+ }
57
+ if (ruleInstructions[instruction]) {
58
+ return (_b = ruleInstructions[instruction]) == null ? void 0 : _b.call(ruleInstructions, node);
59
+ }
60
+ return void 0;
61
+ };
62
+ });
63
+ return enhancedRuleInstructions;
64
+ };
65
+ }
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ detectTanstackQueryImports
69
+ });
70
+ //# sourceMappingURL=detect-react-query-imports.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/detect-react-query-imports.ts"],"sourcesContent":["import type { ESLintUtils, TSESLint, TSESTree } from '@typescript-eslint/utils'\n\ntype Create = Parameters<\n ReturnType<typeof ESLintUtils.RuleCreator>\n>[0]['create']\n\ntype Context = Parameters<Create>[0]\ntype Options = Parameters<Create>[1]\ntype Helpers = {\n isTanstackQueryImport: (node: TSESTree.Identifier) => boolean\n}\n\nexport type EnhancedCreate = (\n context: Context,\n options: Options,\n helpers: Helpers,\n) => ReturnType<Create>\n\nexport function detectTanstackQueryImports(create: EnhancedCreate): Create {\n return (context, optionsWithDefault) => {\n const tanstackQueryImportSpecifiers: TSESTree.ImportClause[] = []\n\n const helpers: Helpers = {\n isTanstackQueryImport(node) {\n return !!tanstackQueryImportSpecifiers.find((specifier) => {\n if (specifier.type === 'ImportSpecifier') {\n return node.name === specifier.local.name\n }\n\n return false\n })\n },\n }\n\n const detectionInstructions: TSESLint.RuleListener = {\n ImportDeclaration(node) {\n if (\n node.specifiers.length > 0 &&\n node.importKind === 'value' &&\n node.source.value.startsWith('@tanstack/') &&\n node.source.value.endsWith('-query')\n ) {\n tanstackQueryImportSpecifiers.push(...node.specifiers)\n }\n },\n }\n\n // Call original rule definition\n const ruleInstructions = create(context, optionsWithDefault, helpers)\n const enhancedRuleInstructions: TSESLint.RuleListener = {}\n\n const allKeys = new Set(\n Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions)),\n )\n\n // Iterate over ALL instructions keys so we can override original rule instructions\n // to prevent their execution if conditions to report errors are not met.\n allKeys.forEach((instruction) => {\n enhancedRuleInstructions[instruction] = (node) => {\n if (instruction in detectionInstructions) {\n detectionInstructions[instruction]?.(node)\n }\n\n // TODO: canReportErrors()\n if (ruleInstructions[instruction]) {\n return ruleInstructions[instruction]?.(node)\n }\n\n return undefined\n }\n })\n\n return enhancedRuleInstructions\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,SAAS,2BAA2B,QAAgC;AACzE,SAAO,CAAC,SAAS,uBAAuB;AACtC,UAAM,gCAAyD,CAAC;AAEhE,UAAM,UAAmB;AAAA,MACvB,sBAAsB,MAAM;AAC1B,eAAO,CAAC,CAAC,8BAA8B,KAAK,CAAC,cAAc;AACzD,cAAI,UAAU,SAAS,mBAAmB;AACxC,mBAAO,KAAK,SAAS,UAAU,MAAM;AAAA,UACvC;AAEA,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AAEA,UAAM,wBAA+C;AAAA,MACnD,kBAAkB,MAAM;AACtB,YACE,KAAK,WAAW,SAAS,KACzB,KAAK,eAAe,WACpB,KAAK,OAAO,MAAM,WAAW,YAAY,KACzC,KAAK,OAAO,MAAM,SAAS,QAAQ,GACnC;AACA,wCAA8B,KAAK,GAAG,KAAK,UAAU;AAAA,QACvD;AAAA,MACF;AAAA,IACF;AAGA,UAAM,mBAAmB,OAAO,SAAS,oBAAoB,OAAO;AACpE,UAAM,2BAAkD,CAAC;AAEzD,UAAM,UAAU,IAAI;AAAA,MAClB,OAAO,KAAK,qBAAqB,EAAE,OAAO,OAAO,KAAK,gBAAgB,CAAC;AAAA,IACzE;AAIA,YAAQ,QAAQ,CAAC,gBAAgB;AAC/B,+BAAyB,WAAW,IAAI,CAAC,SAAS;AA1DxD;AA2DQ,YAAI,eAAe,uBAAuB;AACxC,sCAAsB,iBAAtB,+CAAqC;AAAA,QACvC;AAGA,YAAI,iBAAiB,WAAW,GAAG;AACjC,kBAAO,sBAAiB,iBAAjB,0CAAgC;AAAA,QACzC;AAEA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,12 @@
1
+ import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
2
+
3
+ type Create = Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0]['create'];
4
+ type Context = Parameters<Create>[0];
5
+ type Options = Parameters<Create>[1];
6
+ type Helpers = {
7
+ isTanstackQueryImport: (node: TSESTree.Identifier) => boolean;
8
+ };
9
+ type EnhancedCreate = (context: Context, options: Options, helpers: Helpers) => ReturnType<Create>;
10
+ declare function detectTanstackQueryImports(create: EnhancedCreate): Create;
11
+
12
+ export { EnhancedCreate, detectTanstackQueryImports };
@@ -0,0 +1,12 @@
1
+ import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
2
+
3
+ type Create = Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0]['create'];
4
+ type Context = Parameters<Create>[0];
5
+ type Options = Parameters<Create>[1];
6
+ type Helpers = {
7
+ isTanstackQueryImport: (node: TSESTree.Identifier) => boolean;
8
+ };
9
+ type EnhancedCreate = (context: Context, options: Options, helpers: Helpers) => ReturnType<Create>;
10
+ declare function detectTanstackQueryImports(create: EnhancedCreate): Create;
11
+
12
+ export { EnhancedCreate, detectTanstackQueryImports };
@@ -0,0 +1,45 @@
1
+ // src/utils/detect-react-query-imports.ts
2
+ function detectTanstackQueryImports(create) {
3
+ return (context, optionsWithDefault) => {
4
+ const tanstackQueryImportSpecifiers = [];
5
+ const helpers = {
6
+ isTanstackQueryImport(node) {
7
+ return !!tanstackQueryImportSpecifiers.find((specifier) => {
8
+ if (specifier.type === "ImportSpecifier") {
9
+ return node.name === specifier.local.name;
10
+ }
11
+ return false;
12
+ });
13
+ }
14
+ };
15
+ const detectionInstructions = {
16
+ ImportDeclaration(node) {
17
+ if (node.specifiers.length > 0 && node.importKind === "value" && node.source.value.startsWith("@tanstack/") && node.source.value.endsWith("-query")) {
18
+ tanstackQueryImportSpecifiers.push(...node.specifiers);
19
+ }
20
+ }
21
+ };
22
+ const ruleInstructions = create(context, optionsWithDefault, helpers);
23
+ const enhancedRuleInstructions = {};
24
+ const allKeys = new Set(
25
+ Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions))
26
+ );
27
+ allKeys.forEach((instruction) => {
28
+ enhancedRuleInstructions[instruction] = (node) => {
29
+ var _a, _b;
30
+ if (instruction in detectionInstructions) {
31
+ (_a = detectionInstructions[instruction]) == null ? void 0 : _a.call(detectionInstructions, node);
32
+ }
33
+ if (ruleInstructions[instruction]) {
34
+ return (_b = ruleInstructions[instruction]) == null ? void 0 : _b.call(ruleInstructions, node);
35
+ }
36
+ return void 0;
37
+ };
38
+ });
39
+ return enhancedRuleInstructions;
40
+ };
41
+ }
42
+ export {
43
+ detectTanstackQueryImports
44
+ };
45
+ //# sourceMappingURL=detect-react-query-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/detect-react-query-imports.ts"],"sourcesContent":["import type { ESLintUtils, TSESLint, TSESTree } from '@typescript-eslint/utils'\n\ntype Create = Parameters<\n ReturnType<typeof ESLintUtils.RuleCreator>\n>[0]['create']\n\ntype Context = Parameters<Create>[0]\ntype Options = Parameters<Create>[1]\ntype Helpers = {\n isTanstackQueryImport: (node: TSESTree.Identifier) => boolean\n}\n\nexport type EnhancedCreate = (\n context: Context,\n options: Options,\n helpers: Helpers,\n) => ReturnType<Create>\n\nexport function detectTanstackQueryImports(create: EnhancedCreate): Create {\n return (context, optionsWithDefault) => {\n const tanstackQueryImportSpecifiers: TSESTree.ImportClause[] = []\n\n const helpers: Helpers = {\n isTanstackQueryImport(node) {\n return !!tanstackQueryImportSpecifiers.find((specifier) => {\n if (specifier.type === 'ImportSpecifier') {\n return node.name === specifier.local.name\n }\n\n return false\n })\n },\n }\n\n const detectionInstructions: TSESLint.RuleListener = {\n ImportDeclaration(node) {\n if (\n node.specifiers.length > 0 &&\n node.importKind === 'value' &&\n node.source.value.startsWith('@tanstack/') &&\n node.source.value.endsWith('-query')\n ) {\n tanstackQueryImportSpecifiers.push(...node.specifiers)\n }\n },\n }\n\n // Call original rule definition\n const ruleInstructions = create(context, optionsWithDefault, helpers)\n const enhancedRuleInstructions: TSESLint.RuleListener = {}\n\n const allKeys = new Set(\n Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions)),\n )\n\n // Iterate over ALL instructions keys so we can override original rule instructions\n // to prevent their execution if conditions to report errors are not met.\n allKeys.forEach((instruction) => {\n enhancedRuleInstructions[instruction] = (node) => {\n if (instruction in detectionInstructions) {\n detectionInstructions[instruction]?.(node)\n }\n\n // TODO: canReportErrors()\n if (ruleInstructions[instruction]) {\n return ruleInstructions[instruction]?.(node)\n }\n\n return undefined\n }\n })\n\n return enhancedRuleInstructions\n }\n}\n"],"mappings":";AAkBO,SAAS,2BAA2B,QAAgC;AACzE,SAAO,CAAC,SAAS,uBAAuB;AACtC,UAAM,gCAAyD,CAAC;AAEhE,UAAM,UAAmB;AAAA,MACvB,sBAAsB,MAAM;AAC1B,eAAO,CAAC,CAAC,8BAA8B,KAAK,CAAC,cAAc;AACzD,cAAI,UAAU,SAAS,mBAAmB;AACxC,mBAAO,KAAK,SAAS,UAAU,MAAM;AAAA,UACvC;AAEA,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AAEA,UAAM,wBAA+C;AAAA,MACnD,kBAAkB,MAAM;AACtB,YACE,KAAK,WAAW,SAAS,KACzB,KAAK,eAAe,WACpB,KAAK,OAAO,MAAM,WAAW,YAAY,KACzC,KAAK,OAAO,MAAM,SAAS,QAAQ,GACnC;AACA,wCAA8B,KAAK,GAAG,KAAK,UAAU;AAAA,QACvD;AAAA,MACF;AAAA,IACF;AAGA,UAAM,mBAAmB,OAAO,SAAS,oBAAoB,OAAO;AACpE,UAAM,2BAAkD,CAAC;AAEzD,UAAM,UAAU,IAAI;AAAA,MAClB,OAAO,KAAK,qBAAqB,EAAE,OAAO,OAAO,KAAK,gBAAgB,CAAC;AAAA,IACzE;AAIA,YAAQ,QAAQ,CAAC,gBAAgB;AAC/B,+BAAyB,WAAW,IAAI,CAAC,SAAS;AA1DxD;AA2DQ,YAAI,eAAe,uBAAuB;AACxC,sCAAsB,iBAAtB,+CAAqC;AAAA,QACvC;AAGA,YAAI,iBAAiB,WAAW,GAAG;AACjC,kBAAO,sBAAiB,iBAAjB,0CAAgC;AAAA,QACzC;AAEA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/object-utils.ts
21
+ var object_utils_exports = {};
22
+ __export(object_utils_exports, {
23
+ objectKeys: () => objectKeys
24
+ });
25
+ module.exports = __toCommonJS(object_utils_exports);
26
+ function objectKeys(obj) {
27
+ return Object.keys(obj);
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ objectKeys
32
+ });
33
+ //# sourceMappingURL=object-utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/object-utils.ts"],"sourcesContent":["export function objectKeys<T extends Record<string, unknown>>(\n obj: T,\n): Array<keyof T> {\n return Object.keys(obj) as Array<keyof T>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,WACd,KACgB;AAChB,SAAO,OAAO,KAAK,GAAG;AACxB;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function objectKeys<T extends Record<string, unknown>>(obj: T): Array<keyof T>;
2
+
3
+ export { objectKeys };
@@ -0,0 +1,3 @@
1
+ declare function objectKeys<T extends Record<string, unknown>>(obj: T): Array<keyof T>;
2
+
3
+ export { objectKeys };
@@ -0,0 +1,8 @@
1
+ // src/utils/object-utils.ts
2
+ function objectKeys(obj) {
3
+ return Object.keys(obj);
4
+ }
5
+ export {
6
+ objectKeys
7
+ };
8
+ //# sourceMappingURL=object-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/object-utils.ts"],"sourcesContent":["export function objectKeys<T extends Record<string, unknown>>(\n obj: T,\n): Array<keyof T> {\n return Object.keys(obj) as Array<keyof T>\n}\n"],"mappings":";AAAO,SAAS,WACd,KACgB;AAChB,SAAO,OAAO,KAAK,GAAG;AACxB;","names":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/test-utils.ts
21
+ var test_utils_exports = {};
22
+ __export(test_utils_exports, {
23
+ normalizeIndent: () => normalizeIndent
24
+ });
25
+ module.exports = __toCommonJS(test_utils_exports);
26
+ function normalizeIndent(template) {
27
+ var _a, _b, _c;
28
+ const codeLines = ((_a = template[0]) == null ? void 0 : _a.split("\n")) ?? [""];
29
+ const leftPadding = ((_c = (_b = codeLines[1]) == null ? void 0 : _b.match(/\s+/)) == null ? void 0 : _c[0]) ?? "";
30
+ return codeLines.map((line) => line.slice(leftPadding.length)).join("\n");
31
+ }
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ normalizeIndent
35
+ });
36
+ //# sourceMappingURL=test-utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/test-utils.ts"],"sourcesContent":["export function normalizeIndent(template: TemplateStringsArray) {\n const codeLines = template[0]?.split('\\n') ?? ['']\n const leftPadding = codeLines[1]?.match(/\\s+/)?.[0] ?? ''\n return codeLines.map((line) => line.slice(leftPadding.length)).join('\\n')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,gBAAgB,UAAgC;AAAhE;AACE,QAAM,cAAY,cAAS,CAAC,MAAV,mBAAa,MAAM,UAAS,CAAC,EAAE;AACjD,QAAM,gBAAc,qBAAU,CAAC,MAAX,mBAAc,MAAM,WAApB,mBAA6B,OAAM;AACvD,SAAO,UAAU,IAAI,CAAC,SAAS,KAAK,MAAM,YAAY,MAAM,CAAC,EAAE,KAAK,IAAI;AAC1E;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function normalizeIndent(template: TemplateStringsArray): string;
2
+
3
+ export { normalizeIndent };
@@ -0,0 +1,3 @@
1
+ declare function normalizeIndent(template: TemplateStringsArray): string;
2
+
3
+ export { normalizeIndent };
@@ -0,0 +1,11 @@
1
+ // src/utils/test-utils.ts
2
+ function normalizeIndent(template) {
3
+ var _a, _b, _c;
4
+ const codeLines = ((_a = template[0]) == null ? void 0 : _a.split("\n")) ?? [""];
5
+ const leftPadding = ((_c = (_b = codeLines[1]) == null ? void 0 : _b.match(/\s+/)) == null ? void 0 : _c[0]) ?? "";
6
+ return codeLines.map((line) => line.slice(leftPadding.length)).join("\n");
7
+ }
8
+ export {
9
+ normalizeIndent
10
+ };
11
+ //# sourceMappingURL=test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/test-utils.ts"],"sourcesContent":["export function normalizeIndent(template: TemplateStringsArray) {\n const codeLines = template[0]?.split('\\n') ?? ['']\n const leftPadding = codeLines[1]?.match(/\\s+/)?.[0] ?? ''\n return codeLines.map((line) => line.slice(leftPadding.length)).join('\\n')\n}\n"],"mappings":";AAAO,SAAS,gBAAgB,UAAgC;AAAhE;AACE,QAAM,cAAY,cAAS,CAAC,MAAV,mBAAa,MAAM,UAAS,CAAC,EAAE;AACjD,QAAM,gBAAc,qBAAU,CAAC,MAAX,mBAAc,MAAM,WAApB,mBAA6B,OAAM;AACvD,SAAO,UAAU,IAAI,CAAC,SAAS,KAAK,MAAM,YAAY,MAAM,CAAC,EAAE,KAAK,IAAI;AAC1E;","names":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/unique-by.ts
21
+ var unique_by_exports = {};
22
+ __export(unique_by_exports, {
23
+ uniqueBy: () => uniqueBy
24
+ });
25
+ module.exports = __toCommonJS(unique_by_exports);
26
+ function uniqueBy(arr, fn) {
27
+ return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i);
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ uniqueBy
32
+ });
33
+ //# sourceMappingURL=unique-by.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/unique-by.ts"],"sourcesContent":["export function uniqueBy<T>(arr: T[], fn: (x: T) => unknown): T[] {\n return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,SAAY,KAAU,IAA4B;AAChE,SAAO,IAAI,OAAO,CAAC,GAAG,GAAG,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;AAC1E;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function uniqueBy<T>(arr: T[], fn: (x: T) => unknown): T[];
2
+
3
+ export { uniqueBy };
@@ -0,0 +1,3 @@
1
+ declare function uniqueBy<T>(arr: T[], fn: (x: T) => unknown): T[];
2
+
3
+ export { uniqueBy };
@@ -0,0 +1,8 @@
1
+ // src/utils/unique-by.ts
2
+ function uniqueBy(arr, fn) {
3
+ return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i);
4
+ }
5
+ export {
6
+ uniqueBy
7
+ };
8
+ //# sourceMappingURL=unique-by.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/unique-by.ts"],"sourcesContent":["export function uniqueBy<T>(arr: T[], fn: (x: T) => unknown): T[] {\n return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i)\n}\n"],"mappings":";AAAO,SAAS,SAAY,KAAU,IAA4B;AAChE,SAAO,IAAI,OAAO,CAAC,GAAG,GAAG,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;AAC1E;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/eslint-plugin-query",
3
- "version": "5.0.0-alpha.88",
3
+ "version": "5.0.0-beta.10",
4
4
  "description": "ESLint plugin for TanStack Query",
5
5
  "author": "Eliya Cohen",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "test:types": "tsc",
48
48
  "test:lib": "vitest run --coverage",
49
49
  "test:lib:dev": "pnpm run test:lib --watch",
50
- "test:build": "publint --strict && attw --pack",
50
+ "test:build": "publint --strict",
51
51
  "build": "tsup"
52
52
  }
53
53
  }
@@ -1,4 +1,4 @@
1
- import { configs } from './index'
1
+ import { configs } from '../configs'
2
2
 
3
3
  describe('configs', () => {
4
4
  it('should match snapshot', () => {
@@ -1,6 +1,6 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils'
2
- import { normalizeIndent } from '../../utils/test-utils'
3
- import { rule } from './exhaustive-deps.rule'
2
+ import { normalizeIndent } from '../utils/test-utils'
3
+ import { rule } from '../rules/exhaustive-deps.rule'
4
4
 
5
5
  const ruleTester = new ESLintUtils.RuleTester({
6
6
  parser: '@typescript-eslint/parser',
@@ -1,4 +1,4 @@
1
- import { rules } from '../rules'
1
+ import { rules } from './rules'
2
2
  import type { TSESLint } from '@typescript-eslint/utils'
3
3
 
4
4
  function generateRecommendedConfig(
@@ -1,7 +1,7 @@
1
1
  import { AST_NODE_TYPES } from '@typescript-eslint/utils'
2
- import { ASTUtils } from '../../utils/ast-utils'
3
- import { createRule } from '../../utils/create-rule'
4
- import { uniqueBy } from '../../utils/unique-by'
2
+ import { ASTUtils } from '../utils/ast-utils'
3
+ import { createRule } from '../utils/create-rule'
4
+ import { uniqueBy } from '../utils/unique-by'
5
5
  import { ExhaustiveDepsUtils } from './exhaustive-deps.utils'
6
6
  import type { TSESLint } from '@typescript-eslint/utils'
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { AST_NODE_TYPES } from '@typescript-eslint/utils'
2
- import { ASTUtils } from '../../utils/ast-utils'
2
+ import { ASTUtils } from '../utils/ast-utils'
3
3
  import type { TSESLint } from '@typescript-eslint/utils'
4
4
 
5
5
  export const ExhaustiveDepsUtils = {
package/src/rules.ts ADDED
@@ -0,0 +1,5 @@
1
+ import * as exhaustiveDeps from './rules/exhaustive-deps.rule'
2
+
3
+ export const rules = {
4
+ [exhaustiveDeps.name]: exhaustiveDeps.rule,
5
+ }
@@ -1,5 +0,0 @@
1
- import * as exhaustiveDeps from './exhaustive-deps/exhaustive-deps.rule'
2
-
3
- export const rules = {
4
- [exhaustiveDeps.name]: exhaustiveDeps.rule,
5
- }