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

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 (79) hide show
  1. package/build/legacy/configs/index.cjs +46 -0
  2. package/build/legacy/configs/index.cjs.map +1 -0
  3. package/build/legacy/configs/index.d.cts +8 -0
  4. package/build/legacy/configs/index.d.ts +8 -0
  5. package/build/legacy/configs/index.js +21 -0
  6. package/build/legacy/configs/index.js.map +1 -0
  7. package/build/legacy/configs/index.test.cjs +21 -0
  8. package/build/legacy/configs/index.test.cjs.map +1 -0
  9. package/build/legacy/configs/index.test.d.cts +2 -0
  10. package/build/legacy/configs/index.test.d.ts +2 -0
  11. package/build/legacy/configs/index.test.js +19 -0
  12. package/build/legacy/configs/index.test.js.map +1 -0
  13. package/build/legacy/index.cjs +28 -431
  14. package/build/legacy/index.cjs.map +1 -1
  15. package/build/legacy/index.d.cts +3 -14
  16. package/build/legacy/index.d.ts +3 -14
  17. package/build/legacy/index.js +3 -432
  18. package/build/legacy/index.js.map +1 -1
  19. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.cjs +141 -0
  20. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.cjs.map +1 -0
  21. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.d.cts +6 -0
  22. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.d.ts +6 -0
  23. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.js +115 -0
  24. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.rule.js.map +1 -0
  25. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.cjs +722 -0
  26. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.cjs.map +1 -0
  27. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.d.cts +2 -0
  28. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.d.ts +2 -0
  29. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.js +720 -0
  30. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.test.js.map +1 -0
  31. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.cjs +52 -0
  32. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.cjs.map +1 -0
  33. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.d.cts +12 -0
  34. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.d.ts +12 -0
  35. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.js +27 -0
  36. package/build/legacy/rules/exhaustive-deps/exhaustive-deps.utils.js.map +1 -0
  37. package/build/legacy/rules/index.cjs +44 -0
  38. package/build/legacy/rules/index.cjs.map +1 -0
  39. package/build/legacy/rules/index.d.cts +7 -0
  40. package/build/legacy/rules/index.d.ts +7 -0
  41. package/build/legacy/rules/index.js +9 -0
  42. package/build/legacy/rules/index.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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/rules/exhaustive-deps/exhaustive-deps.test.ts"],"sourcesContent":["import { ESLintUtils } from '@typescript-eslint/utils'\nimport { normalizeIndent } from '../../utils/test-utils'\nimport { rule } from './exhaustive-deps.rule'\n\nconst ruleTester = new ESLintUtils.RuleTester({\n parser: '@typescript-eslint/parser',\n settings: {},\n})\n\nruleTester.run('exhaustive-deps', rule, {\n valid: [\n {\n name: 'should pass when deps are passed in array (react)',\n code: 'useQuery({ queryKey: [\"todos\"], queryFn: fetchTodos });',\n },\n {\n name: 'should pass when deps are passed in array (solid)',\n code: 'createQuery({ queryKey: [\"todos\"], queryFn: fetchTodos });',\n },\n {\n name: 'should pass when deps are passed in array',\n code: 'useQuery({ queryKey: [\"entity\", id], queryFn: () => api.getEntity(id) });',\n },\n {\n name: 'should pass when deps are passed in template literal',\n // eslint-disable-next-line no-template-curly-in-string\n code: 'useQuery({ queryKey: [`entity/${id}`], queryFn: () => api.getEntity(id) });',\n },\n {\n name: 'should not pass fetch',\n code: 'useQuery({ queryKey: [\"entity\", id], queryFn: () => fetch(id) });',\n },\n {\n name: 'should not pass axios.get',\n code: 'useQuery({ queryKey: [\"entity\", id], queryFn: () => axios.get(id) });',\n },\n {\n name: 'should not pass api.entity.get',\n code: 'useQuery({ queryKey: [\"entity\", id], queryFn: () => api.entity.get(id) });',\n },\n {\n name: 'should not pass api when is being used for calling a function',\n code: `\n import useApi from './useApi'\n\n const useFoo = () => {\n const api = useApi();\n return useQuery({\n queryKey: ['foo'],\n queryFn: () => api.fetchFoo(),\n })\n }\n `,\n },\n {\n name: 'should pass props.src',\n code: `\n function MyComponent(props) {\n useQuery({ queryKey: [\"entity\", props.src], queryFn: () => api.entity.get(props.src) });\n }\n `,\n },\n {\n name: 'identify !!props.id (unary expression)',\n code: `\n function MyComponent(props) {\n useQuery({ queryKey: [\"entity\", !!props.id], queryFn: () => api.entity.get(props.id) });\n }\n `,\n },\n {\n name: 'identify props?.id (chain expression)',\n code: `\n function MyComponent(props) {\n useQuery({ queryKey: [\"entity\", props?.id], queryFn: () => api.entity.get(props?.id) });\n }\n `,\n },\n {\n name: 'identify props!.id (ts non null expression)',\n code: `\n function MyComponent(props) {\n useQuery({ queryKey: [\"entity\", props!.id], queryFn: () => api.entity.get(props!.id) });\n }\n `,\n },\n {\n name: 'should ignore keys from callback',\n code: `\n function MyComponent(props) {\n useQuery({\n queryKey: [\"foo\", dep1],\n queryFn: ({ queryKey: [, dep] }) => fetch(dep),\n });\n }\n `,\n },\n {\n name: 'should ignore type identifiers',\n code: `\n type Result = {};\n function MyComponent(props) {\n useQuery({\n queryKey: [\"foo\", dep],\n queryFn: () => api.get<Result>(dep),\n });\n }\n `,\n },\n {\n name: 'should add \"...args\" to deps',\n code: `\n function foo(...args) {}\n function useData(arg, ...args) {\n return useQuery({\n queryKey: ['foo', arg, ...args],\n queryFn: async () => foo([arg, ...args])\n });\n }\n `,\n },\n {\n name: 'should not add class to deps',\n code: `\n class Foo {}\n useQuery({ queryKey: ['foo'], queryFn: async () => new Foo() });\n `,\n },\n {\n name: 'should not add `undefined` to deps',\n code: `\n useQuery({\n queryKey: [],\n queryFn: async () => {\n if (undefined) {\n return null;\n }\n return 1\n },\n });\n `,\n },\n {\n name: 'should not fail when queryKey is a queryKeyFactory while having a dep as first arg',\n code: normalizeIndent`\n const fooQueryKeyFactory = {\n foo: () => ['foo'] as const,\n num: (num: number) => [...fooQueryKeyFactory.foo(), num] as const,\n }\n \n const useFoo = (num: number) =>\n useQuery({\n queryKey: fooQueryKeyFactory.foo(num),\n queryFn: () => Promise.resolve(num),\n })\n `,\n },\n {\n name: 'should not fail when queryKey is a queryKeyFactory while having a dep in object',\n code: normalizeIndent`\n const fooQueryKeyFactory = {\n foo: () => ['foo'] as const,\n num: (num: number) => [...fooQueryKeyFactory.foo(), num] as const,\n }\n \n const useFoo = (num: number) =>\n useQuery({\n queryKey: fooQueryKeyFactory.foo({ x: num }),\n queryFn: () => Promise.resolve(num),\n })\n `,\n },\n {\n name: 'should not fail when queryKey is a queryKeyFactory while having a dep in object 2',\n code: normalizeIndent`\n const fooQueryKeyFactory = {\n foo: () => ['foo'] as const,\n num: (num: number) => [...fooQueryKeyFactory.foo(), num] as const,\n }\n \n const useFoo = (num: number) =>\n useQuery({\n queryKey: fooQueryKeyFactory.foo({ num }),\n queryFn: () => Promise.resolve(num),\n })\n `,\n },\n {\n name: 'should not fail when queryKey is a queryKeyFactory while having a dep in array',\n code: normalizeIndent`\n const fooQueryKeyFactory = {\n foo: () => ['foo'] as const,\n num: (num: number) => [...fooQueryKeyFactory.foo(), num] as const,\n }\n \n const useFoo = (num: number) =>\n useQuery({\n queryKey: fooQueryKeyFactory.foo([num]),\n queryFn: () => Promise.resolve(num),\n })\n `,\n },\n {\n name: 'should not fail when queryKey is a queryKeyFactory while having a dep in second arg',\n code: normalizeIndent`\n const fooQueryKeyFactory = {\n foo: () => ['foo'] as const,\n num: (num: number) => [...fooQueryKeyFactory.foo(), num] as const,\n }\n \n const useFoo = (num: number) =>\n useQuery({\n queryKey: fooQueryKeyFactory.foo(1, num),\n queryFn: () => Promise.resolve(num),\n })\n `,\n },\n {\n name: 'should not fail when queryKey is a queryKeyFactory while having a dep is object prop',\n code: normalizeIndent`\n const fooQueryKeyFactory = {\n foo: () => ['foo'] as const,\n num: (num: number) => [...fooQueryKeyFactory.foo(), num] as const,\n }\n \n const useFoo = (obj: { num: number }) =>\n useQuery({\n queryKey: fooQueryKeyFactory.foo(obj.num),\n queryFn: () => Promise.resolve(obj.num),\n })\n `,\n },\n {\n name: 'should not treat new Error as missing dependency',\n code: normalizeIndent`\n useQuery({\n queryKey: ['foo'],\n queryFn: () => Promise.reject(new Error('1')),\n })\n `,\n },\n {\n name: 'should see id when there is a const assertion',\n code: normalizeIndent`\n const useX = (id: number) => {\n return useQuery({\n queryKey: ['foo', id] as const,\n queryFn: async () => id,\n })\n }\n `,\n },\n {\n name: 'should not fail if queryKey is having the whole object while queryFn uses some props of it',\n code: normalizeIndent`\n const state = { foo: 'foo', bar: 'bar' }\n \n useQuery({\n queryKey: ['state', state],\n queryFn: () => Promise.resolve({ foo: state.foo, bar: state.bar })\n })\n `,\n },\n {\n name: 'should not fail if queryKey does not include an internal dependency',\n code: normalizeIndent`\n useQuery({\n queryKey: [\"api\"],\n queryFn: async () => {\n const response = Promise.resolve([]);\n const data = await response.json();\n return data[0].name;\n },\n });\n `,\n },\n {\n name: 'should ignore constants defined out of scope (react component, function declaration)',\n code: `\n const CONST_VAL = 1\n function MyComponent() {\n useQuery({\n queryKey: [\"foo\"],\n queryFn: () => CONST_VAL\n });\n }\n `,\n },\n {\n name: 'should ignore constants defined out of scope (react component, function expression)',\n code: `\n const CONST_VAL = 1\n const MyComponent = () => {\n useQuery({\n queryKey: [\"foo\"],\n queryFn: () => CONST_VAL\n });\n }\n `,\n },\n {\n name: 'should ignore constants defined out of scope (react component, anonymous function)',\n code: `\n const CONST_VAL = 1\n const MyComponent = function () {\n useQuery({\n queryKey: [\"foo\"],\n queryFn: () => CONST_VAL\n });\n }\n `,\n },\n {\n name: 'should ignore constants defined out of scope (non react component/hook function)',\n code: `\n const CONST_VAL = 1\n function fn() {\n return {\n queryKey: [\"foo\"],\n queryFn: () => CONST_VAL\n }\n }\n `,\n },\n {\n name: 'should ignore constants defined out of scope (react hook, function declaration)',\n code: `\n const CONST_VAL = 1\n function useHook() {\n useQuery({\n queryKey: [\"foo\"],\n queryFn: () => CONST_VAL\n });\n }\n `,\n },\n {\n name: 'should ignore constants defined out of scope (react hook, function expression)',\n code: `\n const CONST_VAL = 1\n const useHook = () => {\n useQuery({\n queryKey: [\"foo\"],\n queryFn: () => CONST_VAL\n });\n }\n `,\n },\n {\n name: 'should ignore constants defined out of scope (react hook, anonymous function)',\n code: `\n const CONST_VAL = 1\n const useHook = function () {\n useQuery({\n queryKey: [\"foo\"],\n queryFn: () => CONST_VAL\n });\n }\n `,\n },\n {\n name: 'should ignore references of the queryClient',\n code: `\n const CONST_VAL = 1\n function useHook() {\n const queryClient = useQueryClient()\n const kueryKlient = useQueryClient()\n useQuery({\n queryKey: [\"foo\"],\n queryFn: () => {\n doSomething(queryClient)\n queryClient.invalidateQueries()\n doSomethingSus(kueryKlient)\n }\n });\n }\n `,\n },\n ],\n invalid: [\n {\n name: 'should fail when deps are missing in query factory',\n code: normalizeIndent`\n const todoQueries = {\n list: () => ({ queryKey: ['entity'], queryFn: fetchEntities }),\n detail: (id) => ({ queryKey: ['entity'], queryFn: () => fetchEntity(id) })\n }\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'id' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: { result: \"['entity', id]\" },\n output: normalizeIndent`\n const todoQueries = {\n list: () => ({ queryKey: ['entity'], queryFn: fetchEntities }),\n detail: (id) => ({ queryKey: ['entity', id], queryFn: () => fetchEntity(id) })\n }\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when no deps are passed (react)',\n code: normalizeIndent`\n const id = 1;\n useQuery({ queryKey: [\"entity\"], queryFn: () => api.getEntity(id) });\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'id' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: { result: '[\"entity\", id]' },\n output: normalizeIndent`\n const id = 1;\n useQuery({ queryKey: [\"entity\", id], queryFn: () => api.getEntity(id) });\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when no deps are passed (solid)',\n code: normalizeIndent`\n const id = 1;\n createQuery({ queryKey: [\"entity\"], queryFn: () => api.getEntity(id) });\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'id' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: { result: '[\"entity\", id]' },\n output: normalizeIndent`\n const id = 1;\n createQuery({ queryKey: [\"entity\", id], queryFn: () => api.getEntity(id) });\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when deps are passed incorrectly',\n code: normalizeIndent`\n const id = 1;\n useQuery({ queryKey: [\"entity/\\${id}\"], queryFn: () => api.getEntity(id) });\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'id' },\n suggestions: [\n {\n messageId: 'fixTo',\n // eslint-disable-next-line no-template-curly-in-string\n data: { result: '[\"entity/${id}\", id]' },\n output: normalizeIndent`\n const id = 1;\n useQuery({ queryKey: [\"entity/\\${id}\", id], queryFn: () => api.getEntity(id) });\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should pass missing dep while key has a template literal',\n code: normalizeIndent`\n const a = 1;\n const b = 2;\n useQuery({ queryKey: [\\`entity/\\${a}\\`], queryFn: () => api.getEntity(a, b) });\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'b' },\n suggestions: [\n {\n messageId: 'fixTo',\n // eslint-disable-next-line no-template-curly-in-string\n data: { result: '[`entity/${a}`, b]' },\n output: normalizeIndent`\n const a = 1;\n const b = 2;\n useQuery({ queryKey: [\\`entity/\\${a}\\`, b], queryFn: () => api.getEntity(a, b) });\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when dep exists inside setter and missing in queryKey',\n code: normalizeIndent`\n const [id] = React.useState(1);\n useQuery({\n queryKey: [\"entity\"],\n queryFn: () => {\n const { data } = axios.get(\\`.../\\${id}\\`);\n return data;\n }\n });\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'id' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: { result: '[\"entity\", id]' },\n output: normalizeIndent`\n const [id] = React.useState(1);\n useQuery({\n queryKey: [\"entity\", id],\n queryFn: () => {\n const { data } = axios.get(\\`.../\\${id}\\`);\n return data;\n }\n });\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when dep does not exist while having a complex queryKey',\n code: normalizeIndent`\n const todoQueries = {\n key: (a, b, c, d, e) => ({\n queryKey: [\"entity\", a, [b], { c }, 1, true],\n queryFn: () => api.getEntity(a, b, c, d, e)\n })\n }\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'd, e' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: { result: '[\"entity\", a, [b], { c }, 1, true, d, e]' },\n output: normalizeIndent`\n const todoQueries = {\n key: (a, b, c, d, e) => ({\n queryKey: [\"entity\", a, [b], { c }, 1, true, d, e],\n queryFn: () => api.getEntity(a, b, c, d, e)\n })\n }\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when dep does not exist while having a complex queryKey #2',\n code: normalizeIndent`\n const todoQueries = {\n key: (dep1, dep2, dep3, dep4, dep5, dep6, dep7, dep8) => ({\n queryKey: ['foo', {dep1, dep2: dep2, bar: dep3, baz: [dep4, dep5]}, [dep6, dep7]],\n queryFn: () => api.getEntity(dep1, dep2, dep3, dep4, dep5, dep6, dep7, dep8),\n }),\n };\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'dep8' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: {\n result:\n \"['foo', {dep1, dep2: dep2, bar: dep3, baz: [dep4, dep5]}, [dep6, dep7], dep8]\",\n },\n output: normalizeIndent`\n const todoQueries = {\n key: (dep1, dep2, dep3, dep4, dep5, dep6, dep7, dep8) => ({\n queryKey: ['foo', {dep1, dep2: dep2, bar: dep3, baz: [dep4, dep5]}, [dep6, dep7], dep8],\n queryFn: () => api.getEntity(dep1, dep2, dep3, dep4, dep5, dep6, dep7, dep8),\n }),\n };\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when two deps that depend on each other are missing',\n code: normalizeIndent`\n function Component({ map, key }) {\n useQuery({ queryKey: [\"key\"], queryFn: () => api.get(map[key]) });\n }\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'map[key]' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: {\n result: '[\"key\", map[key]]',\n },\n output: normalizeIndent`\n function Component({ map, key }) {\n useQuery({ queryKey: [\"key\", map[key]], queryFn: () => api.get(map[key]) });\n }\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when a queryKey is a reference of an array expression with a missing dep',\n code: normalizeIndent`\n const x = 5;\n const queryKey = ['foo']\n useQuery({ queryKey, queryFn: () => x })\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'x' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: {\n result: \"['foo', x]\",\n },\n output: normalizeIndent`\n const x = 5;\n const queryKey = ['foo', x]\n useQuery({ queryKey, queryFn: () => x })\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when a queryKey is a reference of an array expression with a missing dep',\n code: normalizeIndent`\n const x = 5;\n const queryKey = ['foo']\n useQuery({ queryKey, queryFn: () => x })\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'x' },\n suggestions: [\n {\n messageId: 'fixTo',\n data: {\n result: \"['foo', x]\",\n },\n output: normalizeIndent`\n const x = 5;\n const queryKey = ['foo', x]\n useQuery({ queryKey, queryFn: () => x })\n `,\n },\n ],\n },\n ],\n },\n {\n name: 'should fail when queryKey is a queryKeyFactory while having missing dep',\n code: normalizeIndent`\n const fooQueryKeyFactory = { foo: () => ['foo'] as const }\n\n const useFoo = (num: number) =>\n useQuery({\n queryKey: fooQueryKeyFactory.foo(),\n queryFn: () => Promise.resolve(num),\n })\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'num' },\n },\n ],\n },\n {\n name: 'should fail if queryFn is using multiple object props when only one of them is in the queryKey',\n code: normalizeIndent`\n const state = { foo: 'foo', bar: 'bar' }\n \n useQuery({\n queryKey: ['state', state.foo],\n queryFn: () => Promise.resolve({ foo: state.foo, bar: state.bar })\n })\n `,\n errors: [\n {\n messageId: 'missingDeps',\n data: { deps: 'state.bar' },\n },\n ],\n },\n ],\n})\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,YAAY;AAErB,IAAM,aAAa,IAAI,YAAY,WAAW;AAAA,EAC5C,QAAQ;AAAA,EACR,UAAU,CAAC;AACb,CAAC;AAED,WAAW,IAAI,mBAAmB,MAAM;AAAA,EACtC,OAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,MAAM;AAAA;AAAA,MAEN,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWR;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA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AAQ;AAAA,cACV;AAAA,cACA,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,YAKV;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,MAKN,QAAQ;AAAA,QACN;AAAA,UACE,WAAW;AAAA,UACX,MAAM,EAAE,MAAM,IAAI;AAAA,UAClB,aAAa;AAAA,YACX;AAAA,cACE,WAAW;AAAA,cACX,MAAM;AAAA,gBACJ,QAAQ;AAAA,cACV;AAAA,cACA,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,YAKV;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASN,QAAQ;AAAA,QACN;AAAA,UACE,WAAW;AAAA,UACX,MAAM,EAAE,MAAM,MAAM;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQN,QAAQ;AAAA,QACN;AAAA,UACE,WAAW;AAAA,UACX,MAAM,EAAE,MAAM,YAAY;AAAA,QAC5B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -0,0 +1,52 @@
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/rules/exhaustive-deps/exhaustive-deps.utils.ts
21
+ var exhaustive_deps_utils_exports = {};
22
+ __export(exhaustive_deps_utils_exports, {
23
+ ExhaustiveDepsUtils: () => ExhaustiveDepsUtils
24
+ });
25
+ module.exports = __toCommonJS(exhaustive_deps_utils_exports);
26
+ var import_utils = require("@typescript-eslint/utils");
27
+ var import_ast_utils = require("../../utils/ast-utils.cjs");
28
+ var ExhaustiveDepsUtils = {
29
+ isRelevantReference(params) {
30
+ var _a;
31
+ const { reference, scopeManager, context } = params;
32
+ const component = import_ast_utils.ASTUtils.getFunctionAncestor(context);
33
+ if (component !== void 0 && !import_ast_utils.ASTUtils.isDeclaredInNode({
34
+ scopeManager,
35
+ reference,
36
+ functionNode: component
37
+ })) {
38
+ return false;
39
+ }
40
+ return reference.identifier.name !== "undefined" && ((_a = reference.identifier.parent) == null ? void 0 : _a.type) !== import_utils.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isQueryClientReference(reference);
41
+ },
42
+ isQueryClientReference(reference) {
43
+ var _a, _b, _c;
44
+ const declarator = (_b = (_a = reference.resolved) == null ? void 0 : _a.defs[0]) == null ? void 0 : _b.node;
45
+ return (declarator == null ? void 0 : declarator.type) === import_utils.AST_NODE_TYPES.VariableDeclarator && ((_c = declarator.init) == null ? void 0 : _c.type) === import_utils.AST_NODE_TYPES.CallExpression && declarator.init.callee.type === import_utils.AST_NODE_TYPES.Identifier && declarator.init.callee.name === "useQueryClient";
46
+ }
47
+ };
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ ExhaustiveDepsUtils
51
+ });
52
+ //# sourceMappingURL=exhaustive-deps.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts"],"sourcesContent":["import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport type { TSESLint } from '@typescript-eslint/utils'\n\nexport const ExhaustiveDepsUtils = {\n isRelevantReference(params: {\n context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>\n reference: TSESLint.Scope.Reference\n scopeManager: TSESLint.Scope.ScopeManager\n }) {\n const { reference, scopeManager, context } = params\n const component = ASTUtils.getFunctionAncestor(context)\n\n if (\n component !== undefined &&\n !ASTUtils.isDeclaredInNode({\n scopeManager,\n reference,\n functionNode: component,\n })\n ) {\n return false\n }\n\n return (\n reference.identifier.name !== 'undefined' &&\n reference.identifier.parent?.type !== AST_NODE_TYPES.NewExpression &&\n !ExhaustiveDepsUtils.isQueryClientReference(reference)\n )\n },\n isQueryClientReference(reference: TSESLint.Scope.Reference) {\n const declarator = reference.resolved?.defs[0]?.node\n\n return (\n declarator?.type === AST_NODE_TYPES.VariableDeclarator &&\n declarator.init?.type === AST_NODE_TYPES.CallExpression &&\n declarator.init.callee.type === AST_NODE_TYPES.Identifier &&\n declarator.init.callee.name === 'useQueryClient'\n )\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,uBAAyB;AAGlB,IAAM,sBAAsB;AAAA,EACjC,oBAAoB,QAIjB;AATL;AAUI,UAAM,EAAE,WAAW,cAAc,QAAQ,IAAI;AAC7C,UAAM,YAAY,0BAAS,oBAAoB,OAAO;AAEtD,QACE,cAAc,UACd,CAAC,0BAAS,iBAAiB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAChB,CAAC,GACD;AACA,aAAO;AAAA,IACT;AAEA,WACE,UAAU,WAAW,SAAS,iBAC9B,eAAU,WAAW,WAArB,mBAA6B,UAAS,4BAAe,iBACrD,CAAC,oBAAoB,uBAAuB,SAAS;AAAA,EAEzD;AAAA,EACA,uBAAuB,WAAqC;AA9B9D;AA+BI,UAAM,cAAa,qBAAU,aAAV,mBAAoB,KAAK,OAAzB,mBAA6B;AAEhD,YACE,yCAAY,UAAS,4BAAe,wBACpC,gBAAW,SAAX,mBAAiB,UAAS,4BAAe,kBACzC,WAAW,KAAK,OAAO,SAAS,4BAAe,cAC/C,WAAW,KAAK,OAAO,SAAS;AAAA,EAEpC;AACF;","names":[]}
@@ -0,0 +1,12 @@
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
+
3
+ declare const ExhaustiveDepsUtils: {
4
+ isRelevantReference(params: {
5
+ context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>;
6
+ reference: TSESLint.Scope.Reference;
7
+ scopeManager: TSESLint.Scope.ScopeManager;
8
+ }): boolean;
9
+ isQueryClientReference(reference: TSESLint.Scope.Reference): boolean;
10
+ };
11
+
12
+ export { ExhaustiveDepsUtils };
@@ -0,0 +1,12 @@
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
+
3
+ declare const ExhaustiveDepsUtils: {
4
+ isRelevantReference(params: {
5
+ context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>;
6
+ reference: TSESLint.Scope.Reference;
7
+ scopeManager: TSESLint.Scope.ScopeManager;
8
+ }): boolean;
9
+ isQueryClientReference(reference: TSESLint.Scope.Reference): boolean;
10
+ };
11
+
12
+ export { ExhaustiveDepsUtils };
@@ -0,0 +1,27 @@
1
+ // src/rules/exhaustive-deps/exhaustive-deps.utils.ts
2
+ import { AST_NODE_TYPES } from "@typescript-eslint/utils";
3
+ import { ASTUtils } from "../../utils/ast-utils.js";
4
+ var ExhaustiveDepsUtils = {
5
+ isRelevantReference(params) {
6
+ var _a;
7
+ const { reference, scopeManager, context } = params;
8
+ const component = ASTUtils.getFunctionAncestor(context);
9
+ if (component !== void 0 && !ASTUtils.isDeclaredInNode({
10
+ scopeManager,
11
+ reference,
12
+ functionNode: component
13
+ })) {
14
+ return false;
15
+ }
16
+ return reference.identifier.name !== "undefined" && ((_a = reference.identifier.parent) == null ? void 0 : _a.type) !== AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isQueryClientReference(reference);
17
+ },
18
+ isQueryClientReference(reference) {
19
+ var _a, _b, _c;
20
+ const declarator = (_b = (_a = reference.resolved) == null ? void 0 : _a.defs[0]) == null ? void 0 : _b.node;
21
+ return (declarator == null ? void 0 : declarator.type) === AST_NODE_TYPES.VariableDeclarator && ((_c = declarator.init) == null ? void 0 : _c.type) === AST_NODE_TYPES.CallExpression && declarator.init.callee.type === AST_NODE_TYPES.Identifier && declarator.init.callee.name === "useQueryClient";
22
+ }
23
+ };
24
+ export {
25
+ ExhaustiveDepsUtils
26
+ };
27
+ //# sourceMappingURL=exhaustive-deps.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/rules/exhaustive-deps/exhaustive-deps.utils.ts"],"sourcesContent":["import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { ASTUtils } from '../../utils/ast-utils'\nimport type { TSESLint } from '@typescript-eslint/utils'\n\nexport const ExhaustiveDepsUtils = {\n isRelevantReference(params: {\n context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>\n reference: TSESLint.Scope.Reference\n scopeManager: TSESLint.Scope.ScopeManager\n }) {\n const { reference, scopeManager, context } = params\n const component = ASTUtils.getFunctionAncestor(context)\n\n if (\n component !== undefined &&\n !ASTUtils.isDeclaredInNode({\n scopeManager,\n reference,\n functionNode: component,\n })\n ) {\n return false\n }\n\n return (\n reference.identifier.name !== 'undefined' &&\n reference.identifier.parent?.type !== AST_NODE_TYPES.NewExpression &&\n !ExhaustiveDepsUtils.isQueryClientReference(reference)\n )\n },\n isQueryClientReference(reference: TSESLint.Scope.Reference) {\n const declarator = reference.resolved?.defs[0]?.node\n\n return (\n declarator?.type === AST_NODE_TYPES.VariableDeclarator &&\n declarator.init?.type === AST_NODE_TYPES.CallExpression &&\n declarator.init.callee.type === AST_NODE_TYPES.Identifier &&\n declarator.init.callee.name === 'useQueryClient'\n )\n },\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AAGlB,IAAM,sBAAsB;AAAA,EACjC,oBAAoB,QAIjB;AATL;AAUI,UAAM,EAAE,WAAW,cAAc,QAAQ,IAAI;AAC7C,UAAM,YAAY,SAAS,oBAAoB,OAAO;AAEtD,QACE,cAAc,UACd,CAAC,SAAS,iBAAiB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAChB,CAAC,GACD;AACA,aAAO;AAAA,IACT;AAEA,WACE,UAAU,WAAW,SAAS,iBAC9B,eAAU,WAAW,WAArB,mBAA6B,UAAS,eAAe,iBACrD,CAAC,oBAAoB,uBAAuB,SAAS;AAAA,EAEzD;AAAA,EACA,uBAAuB,WAAqC;AA9B9D;AA+BI,UAAM,cAAa,qBAAU,aAAV,mBAAoB,KAAK,OAAzB,mBAA6B;AAEhD,YACE,yCAAY,UAAS,eAAe,wBACpC,gBAAW,SAAX,mBAAiB,UAAS,eAAe,kBACzC,WAAW,KAAK,OAAO,SAAS,eAAe,cAC/C,WAAW,KAAK,OAAO,SAAS;AAAA,EAEpC;AACF;","names":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name2 in all)
10
+ __defProp(target, name2, { get: all[name2], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/rules/index.ts
31
+ var rules_exports = {};
32
+ __export(rules_exports, {
33
+ rules: () => rules
34
+ });
35
+ module.exports = __toCommonJS(rules_exports);
36
+ var exhaustiveDeps = __toESM(require("./exhaustive-deps/exhaustive-deps.rule.cjs"), 1);
37
+ var rules = {
38
+ [exhaustiveDeps.name]: exhaustiveDeps.rule
39
+ };
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ rules
43
+ });
44
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/rules/index.ts"],"sourcesContent":["import * as exhaustiveDeps from './exhaustive-deps/exhaustive-deps.rule'\n\nexport const rules = {\n [exhaustiveDeps.name]: exhaustiveDeps.rule,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAgC;AAEzB,IAAM,QAAQ;AAAA,EACnB,CAAgB,mBAAI,GAAkB;AACxC;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as _typescript_eslint_utils_dist_ts_eslint_Rule from '@typescript-eslint/utils/dist/ts-eslint/Rule';
2
+
3
+ declare const rules: {
4
+ "exhaustive-deps": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<string, readonly unknown[], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
5
+ };
6
+
7
+ export { rules };
@@ -0,0 +1,7 @@
1
+ import * as _typescript_eslint_utils_dist_ts_eslint_Rule from '@typescript-eslint/utils/dist/ts-eslint/Rule';
2
+
3
+ declare const rules: {
4
+ "exhaustive-deps": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<string, readonly unknown[], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
5
+ };
6
+
7
+ export { rules };
@@ -0,0 +1,9 @@
1
+ // src/rules/index.ts
2
+ import * as exhaustiveDeps from "./exhaustive-deps/exhaustive-deps.rule.js";
3
+ var rules = {
4
+ [exhaustiveDeps.name]: exhaustiveDeps.rule
5
+ };
6
+ export {
7
+ rules
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/rules/index.ts"],"sourcesContent":["import * as exhaustiveDeps from './exhaustive-deps/exhaustive-deps.rule'\n\nexport const rules = {\n [exhaustiveDeps.name]: exhaustiveDeps.rule,\n}\n"],"mappings":";AAAA,YAAY,oBAAoB;AAEzB,IAAM,QAAQ;AAAA,EACnB,CAAgB,mBAAI,GAAkB;AACxC;","names":[]}
@@ -0,0 +1,247 @@
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/ast-utils.ts
21
+ var ast_utils_exports = {};
22
+ __export(ast_utils_exports, {
23
+ ASTUtils: () => ASTUtils
24
+ });
25
+ module.exports = __toCommonJS(ast_utils_exports);
26
+ var import_utils = require("@typescript-eslint/utils");
27
+ var import_unique_by = require("./unique-by.cjs");
28
+ var ASTUtils = {
29
+ isNodeOfOneOf(node, types) {
30
+ return types.includes(node.type);
31
+ },
32
+ isIdentifier(node) {
33
+ return node.type === import_utils.AST_NODE_TYPES.Identifier;
34
+ },
35
+ isIdentifierWithName(node, name) {
36
+ return ASTUtils.isIdentifier(node) && node.name === name;
37
+ },
38
+ isIdentifierWithOneOfNames(node, name) {
39
+ return ASTUtils.isIdentifier(node) && name.includes(node.name);
40
+ },
41
+ isProperty(node) {
42
+ return node.type === import_utils.AST_NODE_TYPES.Property;
43
+ },
44
+ isObjectExpression(node) {
45
+ return node.type === import_utils.AST_NODE_TYPES.ObjectExpression;
46
+ },
47
+ isPropertyWithIdentifierKey(node, key) {
48
+ return ASTUtils.isProperty(node) && ASTUtils.isIdentifierWithName(node.key, key);
49
+ },
50
+ findPropertyWithIdentifierKey(properties, key) {
51
+ return properties.find(
52
+ (x) => ASTUtils.isPropertyWithIdentifierKey(x, key)
53
+ );
54
+ },
55
+ getNestedIdentifiers(node) {
56
+ const identifiers = [];
57
+ if (ASTUtils.isIdentifier(node)) {
58
+ identifiers.push(node);
59
+ }
60
+ if ("arguments" in node) {
61
+ node.arguments.forEach((x) => {
62
+ identifiers.push(...ASTUtils.getNestedIdentifiers(x));
63
+ });
64
+ }
65
+ if ("elements" in node) {
66
+ node.elements.forEach((x) => {
67
+ if (x !== null) {
68
+ identifiers.push(...ASTUtils.getNestedIdentifiers(x));
69
+ }
70
+ });
71
+ }
72
+ if ("properties" in node) {
73
+ node.properties.forEach((x) => {
74
+ identifiers.push(...ASTUtils.getNestedIdentifiers(x));
75
+ });
76
+ }
77
+ if ("expressions" in node) {
78
+ node.expressions.forEach((x) => {
79
+ identifiers.push(...ASTUtils.getNestedIdentifiers(x));
80
+ });
81
+ }
82
+ if (node.type === import_utils.AST_NODE_TYPES.Property) {
83
+ identifiers.push(...ASTUtils.getNestedIdentifiers(node.value));
84
+ }
85
+ if (node.type === import_utils.AST_NODE_TYPES.SpreadElement) {
86
+ identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument));
87
+ }
88
+ if (node.type === import_utils.AST_NODE_TYPES.MemberExpression) {
89
+ identifiers.push(...ASTUtils.getNestedIdentifiers(node.object));
90
+ }
91
+ if (node.type === import_utils.AST_NODE_TYPES.UnaryExpression) {
92
+ identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument));
93
+ }
94
+ if (node.type === import_utils.AST_NODE_TYPES.ChainExpression) {
95
+ identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression));
96
+ }
97
+ if (node.type === import_utils.AST_NODE_TYPES.TSNonNullExpression) {
98
+ identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression));
99
+ }
100
+ return identifiers;
101
+ },
102
+ isAncestorIsCallee(identifier) {
103
+ let previousNode = identifier;
104
+ let currentNode = identifier.parent;
105
+ while (currentNode !== void 0) {
106
+ if (currentNode.type === import_utils.AST_NODE_TYPES.CallExpression && currentNode.callee === previousNode) {
107
+ return true;
108
+ }
109
+ if (currentNode.type !== import_utils.AST_NODE_TYPES.MemberExpression) {
110
+ return false;
111
+ }
112
+ previousNode = currentNode;
113
+ currentNode = currentNode.parent;
114
+ }
115
+ return false;
116
+ },
117
+ traverseUpOnly(identifier, allowedNodeTypes) {
118
+ const parent = identifier.parent;
119
+ if (parent !== void 0 && allowedNodeTypes.includes(parent.type)) {
120
+ return ASTUtils.traverseUpOnly(parent, allowedNodeTypes);
121
+ }
122
+ return identifier;
123
+ },
124
+ isDeclaredInNode(params) {
125
+ const { functionNode, reference, scopeManager } = params;
126
+ const scope = scopeManager.acquire(functionNode);
127
+ if (scope === null) {
128
+ return false;
129
+ }
130
+ return scope.set.has(reference.identifier.name);
131
+ },
132
+ getExternalRefs(params) {
133
+ const { scopeManager, sourceCode, node } = params;
134
+ const scope = scopeManager.acquire(node);
135
+ if (scope === null) {
136
+ return [];
137
+ }
138
+ const references = scope.references.filter((x) => x.isRead() && !scope.set.has(x.identifier.name)).map((x) => {
139
+ const referenceNode = ASTUtils.traverseUpOnly(x.identifier, [
140
+ import_utils.AST_NODE_TYPES.MemberExpression,
141
+ import_utils.AST_NODE_TYPES.Identifier
142
+ ]);
143
+ return {
144
+ variable: x,
145
+ node: referenceNode,
146
+ text: sourceCode.getText(referenceNode)
147
+ };
148
+ });
149
+ const localRefIds = new Set(
150
+ [...scope.set.values()].map((x) => sourceCode.getText(x.identifiers[0]))
151
+ );
152
+ const externalRefs = references.filter(
153
+ (x) => x.variable.resolved === null || !localRefIds.has(x.text)
154
+ );
155
+ return (0, import_unique_by.uniqueBy)(externalRefs, (x) => x.text).map((x) => x.variable);
156
+ },
157
+ mapKeyNodeToText(node, sourceCode) {
158
+ return sourceCode.getText(
159
+ ASTUtils.traverseUpOnly(node, [
160
+ import_utils.AST_NODE_TYPES.MemberExpression,
161
+ import_utils.AST_NODE_TYPES.Identifier
162
+ ])
163
+ );
164
+ },
165
+ isValidReactComponentOrHookName(identifier) {
166
+ return identifier !== null && /^(use|[A-Z])/.test(identifier.name);
167
+ },
168
+ getFunctionAncestor(context) {
169
+ return context.getAncestors().find((x) => {
170
+ var _a;
171
+ if (x.type === import_utils.AST_NODE_TYPES.FunctionDeclaration) {
172
+ return true;
173
+ }
174
+ return ((_a = x.parent) == null ? void 0 : _a.type) === import_utils.AST_NODE_TYPES.VariableDeclarator && x.parent.id.type === import_utils.AST_NODE_TYPES.Identifier && ASTUtils.isNodeOfOneOf(x, [
175
+ import_utils.AST_NODE_TYPES.FunctionDeclaration,
176
+ import_utils.AST_NODE_TYPES.FunctionExpression,
177
+ import_utils.AST_NODE_TYPES.ArrowFunctionExpression
178
+ ]);
179
+ });
180
+ },
181
+ getReferencedExpressionByIdentifier(params) {
182
+ var _a, _b, _c;
183
+ const { node, context } = params;
184
+ const resolvedNode = (_c = (_b = (_a = context.getScope().references.find((ref) => ref.identifier === node)) == null ? void 0 : _a.resolved) == null ? void 0 : _b.defs[0]) == null ? void 0 : _c.node;
185
+ if ((resolvedNode == null ? void 0 : resolvedNode.type) !== import_utils.AST_NODE_TYPES.VariableDeclarator) {
186
+ return null;
187
+ }
188
+ return resolvedNode.init;
189
+ },
190
+ getNestedReturnStatements(node) {
191
+ const returnStatements = [];
192
+ if (node.type === import_utils.AST_NODE_TYPES.ReturnStatement) {
193
+ returnStatements.push(node);
194
+ }
195
+ if ("body" in node && node.body !== void 0 && node.body !== null) {
196
+ Array.isArray(node.body) ? node.body.forEach((x) => {
197
+ returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
198
+ }) : returnStatements.push(
199
+ ...ASTUtils.getNestedReturnStatements(node.body)
200
+ );
201
+ }
202
+ if ("consequent" in node) {
203
+ Array.isArray(node.consequent) ? node.consequent.forEach((x) => {
204
+ returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
205
+ }) : returnStatements.push(
206
+ ...ASTUtils.getNestedReturnStatements(node.consequent)
207
+ );
208
+ }
209
+ if ("alternate" in node && node.alternate !== null) {
210
+ Array.isArray(node.alternate) ? node.alternate.forEach((x) => {
211
+ returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
212
+ }) : returnStatements.push(
213
+ ...ASTUtils.getNestedReturnStatements(node.alternate)
214
+ );
215
+ }
216
+ if ("cases" in node) {
217
+ node.cases.forEach((x) => {
218
+ returnStatements.push(...ASTUtils.getNestedReturnStatements(x));
219
+ });
220
+ }
221
+ if ("block" in node) {
222
+ returnStatements.push(...ASTUtils.getNestedReturnStatements(node.block));
223
+ }
224
+ if ("handler" in node && node.handler !== null) {
225
+ returnStatements.push(...ASTUtils.getNestedReturnStatements(node.handler));
226
+ }
227
+ if ("finalizer" in node && node.finalizer !== null) {
228
+ returnStatements.push(
229
+ ...ASTUtils.getNestedReturnStatements(node.finalizer)
230
+ );
231
+ }
232
+ if ("expression" in node && node.expression !== true && node.expression !== false) {
233
+ returnStatements.push(
234
+ ...ASTUtils.getNestedReturnStatements(node.expression)
235
+ );
236
+ }
237
+ if ("test" in node && node.test !== null) {
238
+ returnStatements.push(...ASTUtils.getNestedReturnStatements(node.test));
239
+ }
240
+ return returnStatements;
241
+ }
242
+ };
243
+ // Annotate the CommonJS export names for ESM import in node:
244
+ 0 && (module.exports = {
245
+ ASTUtils
246
+ });
247
+ //# sourceMappingURL=ast-utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/ast-utils.ts"],"sourcesContent":["import { AST_NODE_TYPES } from '@typescript-eslint/utils'\nimport { uniqueBy } from './unique-by'\nimport type { TSESLint, TSESTree } from '@typescript-eslint/utils'\nimport type TSESLintScopeManager from '@typescript-eslint/scope-manager'\nimport type { RuleContext } from '@typescript-eslint/utils/dist/ts-eslint'\n\nexport const ASTUtils = {\n isNodeOfOneOf<T extends AST_NODE_TYPES>(\n node: TSESTree.Node,\n types: readonly T[],\n ): node is TSESTree.Node & { type: T } {\n return types.includes(node.type as T)\n },\n isIdentifier(node: TSESTree.Node): node is TSESTree.Identifier {\n return node.type === AST_NODE_TYPES.Identifier\n },\n isIdentifierWithName(\n node: TSESTree.Node,\n name: string,\n ): node is TSESTree.Identifier {\n return ASTUtils.isIdentifier(node) && node.name === name\n },\n isIdentifierWithOneOfNames<T extends string[]>(\n node: TSESTree.Node,\n name: T,\n ): node is TSESTree.Identifier & { name: T[number] } {\n return ASTUtils.isIdentifier(node) && name.includes(node.name)\n },\n isProperty(node: TSESTree.Node): node is TSESTree.Property {\n return node.type === AST_NODE_TYPES.Property\n },\n isObjectExpression(node: TSESTree.Node): node is TSESTree.ObjectExpression {\n return node.type === AST_NODE_TYPES.ObjectExpression\n },\n isPropertyWithIdentifierKey(\n node: TSESTree.Node,\n key: string,\n ): node is TSESTree.Property {\n return (\n ASTUtils.isProperty(node) && ASTUtils.isIdentifierWithName(node.key, key)\n )\n },\n findPropertyWithIdentifierKey(\n properties: TSESTree.ObjectLiteralElement[],\n key: string,\n ): TSESTree.Property | undefined {\n return properties.find((x) =>\n ASTUtils.isPropertyWithIdentifierKey(x, key),\n ) as TSESTree.Property | undefined\n },\n getNestedIdentifiers(node: TSESTree.Node): TSESTree.Identifier[] {\n const identifiers: TSESTree.Identifier[] = []\n\n if (ASTUtils.isIdentifier(node)) {\n identifiers.push(node)\n }\n\n if ('arguments' in node) {\n node.arguments.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if ('elements' in node) {\n node.elements.forEach((x) => {\n if (x !== null) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n }\n })\n }\n\n if ('properties' in node) {\n node.properties.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if ('expressions' in node) {\n node.expressions.forEach((x) => {\n identifiers.push(...ASTUtils.getNestedIdentifiers(x))\n })\n }\n\n if (node.type === AST_NODE_TYPES.Property) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.value))\n }\n\n if (node.type === AST_NODE_TYPES.SpreadElement) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument))\n }\n\n if (node.type === AST_NODE_TYPES.MemberExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.object))\n }\n\n if (node.type === AST_NODE_TYPES.UnaryExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.argument))\n }\n\n if (node.type === AST_NODE_TYPES.ChainExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression))\n }\n\n if (node.type === AST_NODE_TYPES.TSNonNullExpression) {\n identifiers.push(...ASTUtils.getNestedIdentifiers(node.expression))\n }\n\n return identifiers\n },\n isAncestorIsCallee(identifier: TSESTree.Node) {\n let previousNode = identifier\n let currentNode = identifier.parent\n\n while (currentNode !== undefined) {\n if (\n currentNode.type === AST_NODE_TYPES.CallExpression &&\n currentNode.callee === previousNode\n ) {\n return true\n }\n\n if (currentNode.type !== AST_NODE_TYPES.MemberExpression) {\n return false\n }\n\n previousNode = currentNode\n currentNode = currentNode.parent\n }\n\n return false\n },\n traverseUpOnly(\n identifier: TSESTree.Node,\n allowedNodeTypes: AST_NODE_TYPES[],\n ): TSESTree.Node {\n const parent = identifier.parent\n\n if (parent !== undefined && allowedNodeTypes.includes(parent.type)) {\n return ASTUtils.traverseUpOnly(parent, allowedNodeTypes)\n }\n\n return identifier\n },\n isDeclaredInNode(params: {\n functionNode: TSESTree.Node\n reference: TSESLintScopeManager.Reference\n scopeManager: TSESLint.Scope.ScopeManager\n }) {\n const { functionNode, reference, scopeManager } = params\n const scope = scopeManager.acquire(functionNode)\n\n if (scope === null) {\n return false\n }\n\n return scope.set.has(reference.identifier.name)\n },\n getExternalRefs(params: {\n scopeManager: TSESLint.Scope.ScopeManager\n sourceCode: Readonly<TSESLint.SourceCode>\n node: TSESTree.Node\n }): TSESLint.Scope.Reference[] {\n const { scopeManager, sourceCode, node } = params\n const scope = scopeManager.acquire(node)\n\n if (scope === null) {\n return []\n }\n\n const references = scope.references\n .filter((x) => x.isRead() && !scope.set.has(x.identifier.name))\n .map((x) => {\n const referenceNode = ASTUtils.traverseUpOnly(x.identifier, [\n AST_NODE_TYPES.MemberExpression,\n AST_NODE_TYPES.Identifier,\n ])\n\n return {\n variable: x,\n node: referenceNode,\n text: sourceCode.getText(referenceNode),\n }\n })\n\n const localRefIds = new Set(\n [...scope.set.values()].map((x) => sourceCode.getText(x.identifiers[0])),\n )\n\n const externalRefs = references.filter(\n (x) => x.variable.resolved === null || !localRefIds.has(x.text),\n )\n\n return uniqueBy(externalRefs, (x) => x.text).map((x) => x.variable)\n },\n mapKeyNodeToText(\n node: TSESTree.Node,\n sourceCode: Readonly<TSESLint.SourceCode>,\n ) {\n return sourceCode.getText(\n ASTUtils.traverseUpOnly(node, [\n AST_NODE_TYPES.MemberExpression,\n AST_NODE_TYPES.Identifier,\n ]),\n )\n },\n isValidReactComponentOrHookName(identifier: TSESTree.Identifier | null) {\n return identifier !== null && /^(use|[A-Z])/.test(identifier.name)\n },\n getFunctionAncestor(\n context: Readonly<RuleContext<string, readonly unknown[]>>,\n ) {\n return context.getAncestors().find((x) => {\n if (x.type === AST_NODE_TYPES.FunctionDeclaration) {\n return true\n }\n\n return (\n x.parent?.type === AST_NODE_TYPES.VariableDeclarator &&\n x.parent.id.type === AST_NODE_TYPES.Identifier &&\n ASTUtils.isNodeOfOneOf(x, [\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n ])\n )\n })\n },\n getReferencedExpressionByIdentifier(params: {\n node: TSESTree.Node\n context: Readonly<RuleContext<string, readonly unknown[]>>\n }) {\n const { node, context } = params\n\n const resolvedNode = context\n .getScope()\n .references.find((ref) => ref.identifier === node)?.resolved\n ?.defs[0]?.node\n\n if (resolvedNode?.type !== AST_NODE_TYPES.VariableDeclarator) {\n return null\n }\n\n return resolvedNode.init\n },\n getNestedReturnStatements(node: TSESTree.Node): TSESTree.ReturnStatement[] {\n const returnStatements: TSESTree.ReturnStatement[] = []\n\n if (node.type === AST_NODE_TYPES.ReturnStatement) {\n returnStatements.push(node)\n }\n\n if ('body' in node && node.body !== undefined && node.body !== null) {\n Array.isArray(node.body)\n ? node.body.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.body),\n )\n }\n\n if ('consequent' in node) {\n Array.isArray(node.consequent)\n ? node.consequent.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.consequent),\n )\n }\n\n if ('alternate' in node && node.alternate !== null) {\n Array.isArray(node.alternate)\n ? node.alternate.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n : returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.alternate),\n )\n }\n\n if ('cases' in node) {\n node.cases.forEach((x) => {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(x))\n })\n }\n\n if ('block' in node) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.block))\n }\n\n if ('handler' in node && node.handler !== null) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.handler))\n }\n\n if ('finalizer' in node && node.finalizer !== null) {\n returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.finalizer),\n )\n }\n\n if (\n 'expression' in node &&\n node.expression !== true &&\n node.expression !== false\n ) {\n returnStatements.push(\n ...ASTUtils.getNestedReturnStatements(node.expression),\n )\n }\n\n if ('test' in node && node.test !== null) {\n returnStatements.push(...ASTUtils.getNestedReturnStatements(node.test))\n }\n\n return returnStatements\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,uBAAyB;AAKlB,IAAM,WAAW;AAAA,EACtB,cACE,MACA,OACqC;AACrC,WAAO,MAAM,SAAS,KAAK,IAAS;AAAA,EACtC;AAAA,EACA,aAAa,MAAkD;AAC7D,WAAO,KAAK,SAAS,4BAAe;AAAA,EACtC;AAAA,EACA,qBACE,MACA,MAC6B;AAC7B,WAAO,SAAS,aAAa,IAAI,KAAK,KAAK,SAAS;AAAA,EACtD;AAAA,EACA,2BACE,MACA,MACmD;AACnD,WAAO,SAAS,aAAa,IAAI,KAAK,KAAK,SAAS,KAAK,IAAI;AAAA,EAC/D;AAAA,EACA,WAAW,MAAgD;AACzD,WAAO,KAAK,SAAS,4BAAe;AAAA,EACtC;AAAA,EACA,mBAAmB,MAAwD;AACzE,WAAO,KAAK,SAAS,4BAAe;AAAA,EACtC;AAAA,EACA,4BACE,MACA,KAC2B;AAC3B,WACE,SAAS,WAAW,IAAI,KAAK,SAAS,qBA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A0B,KAAK,SAAS;AAAA,MACtD;AAAA,IACN;AAEA,QAAI,WAAW,MAAM;AACnB,WAAK,MAAM,QAAQ,CAAC,MAAM;AACxB,yBAAiB,KAAK,GAAG,SAAS,0BAA0B,CAAC,CAAC;AAAA,MAChE,CAAC;AAAA,IACH;AAEA,QAAI,WAAW,MAAM;AACnB,uBAAiB,KAAK,GAAG,SAAS,0BAA0B,KAAK,KAAK,CAAC;AAAA,IACzE;AAEA,QAAI,aAAa,QAAQ,KAAK,YAAY,MAAM;AAC9C,uBAAiB,KAAK,GAAG,SAAS,0BAA0B,KAAK,OAAO,CAAC;AAAA,IAC3E;AAEA,QAAI,eAAe,QAAQ,KAAK,cAAc,MAAM;AAClD,uBAAiB;AAAA,QACf,GAAG,SAAS,0BAA0B,KAAK,SAAS;AAAA,MACtD;AAAA,IACF;AAEA,QACE,gBAAgB,QAChB,KAAK,eAAe,QACpB,KAAK,eAAe,OACpB;AACA,uBAAiB;AAAA,QACf,GAAG,SAAS,0BAA0B,KAAK,UAAU;AAAA,MACvD;AAAA,IACF;AAEA,QAAI,UAAU,QAAQ,KAAK,SAAS,MAAM;AACxC,uBAAiB,KAAK,GAAG,SAAS,0BAA0B,KAAK,IAAI,CAAC;AAAA,IACxE;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,41 @@
1
+ import { AST_NODE_TYPES, TSESTree, TSESLint } from '@typescript-eslint/utils';
2
+ import TSESLintScopeManager from '@typescript-eslint/scope-manager';
3
+ import { RuleContext } from '@typescript-eslint/utils/dist/ts-eslint';
4
+
5
+ declare const ASTUtils: {
6
+ isNodeOfOneOf<T extends AST_NODE_TYPES>(node: TSESTree.Node, types: readonly T[]): node is TSESTree.Node & {
7
+ type: T;
8
+ };
9
+ isIdentifier(node: TSESTree.Node): node is TSESTree.Identifier;
10
+ isIdentifierWithName(node: TSESTree.Node, name: string): node is TSESTree.Identifier;
11
+ isIdentifierWithOneOfNames<T_1 extends string[]>(node: TSESTree.Node, name: T_1): node is TSESTree.Identifier & {
12
+ name: T_1[number];
13
+ };
14
+ isProperty(node: TSESTree.Node): node is TSESTree.Property;
15
+ isObjectExpression(node: TSESTree.Node): node is TSESTree.ObjectExpression;
16
+ isPropertyWithIdentifierKey(node: TSESTree.Node, key: string): node is TSESTree.Property;
17
+ findPropertyWithIdentifierKey(properties: TSESTree.ObjectLiteralElement[], key: string): TSESTree.Property | undefined;
18
+ getNestedIdentifiers(node: TSESTree.Node): TSESTree.Identifier[];
19
+ isAncestorIsCallee(identifier: TSESTree.Node): boolean;
20
+ traverseUpOnly(identifier: TSESTree.Node, allowedNodeTypes: AST_NODE_TYPES[]): TSESTree.Node;
21
+ isDeclaredInNode(params: {
22
+ functionNode: TSESTree.Node;
23
+ reference: TSESLintScopeManager.Reference;
24
+ scopeManager: TSESLint.Scope.ScopeManager;
25
+ }): boolean;
26
+ getExternalRefs(params: {
27
+ scopeManager: TSESLint.Scope.ScopeManager;
28
+ sourceCode: Readonly<TSESLint.SourceCode>;
29
+ node: TSESTree.Node;
30
+ }): TSESLint.Scope.Reference[];
31
+ mapKeyNodeToText(node: TSESTree.Node, sourceCode: Readonly<TSESLint.SourceCode>): string;
32
+ isValidReactComponentOrHookName(identifier: TSESTree.Identifier | null): boolean;
33
+ getFunctionAncestor(context: Readonly<RuleContext<string, readonly unknown[]>>): TSESTree.Node | undefined;
34
+ getReferencedExpressionByIdentifier(params: {
35
+ node: TSESTree.Node;
36
+ context: Readonly<RuleContext<string, readonly unknown[]>>;
37
+ }): TSESTree.Expression | null;
38
+ getNestedReturnStatements(node: TSESTree.Node): TSESTree.ReturnStatement[];
39
+ };
40
+
41
+ export { ASTUtils };
@@ -0,0 +1,41 @@
1
+ import { AST_NODE_TYPES, TSESTree, TSESLint } from '@typescript-eslint/utils';
2
+ import TSESLintScopeManager from '@typescript-eslint/scope-manager';
3
+ import { RuleContext } from '@typescript-eslint/utils/dist/ts-eslint';
4
+
5
+ declare const ASTUtils: {
6
+ isNodeOfOneOf<T extends AST_NODE_TYPES>(node: TSESTree.Node, types: readonly T[]): node is TSESTree.Node & {
7
+ type: T;
8
+ };
9
+ isIdentifier(node: TSESTree.Node): node is TSESTree.Identifier;
10
+ isIdentifierWithName(node: TSESTree.Node, name: string): node is TSESTree.Identifier;
11
+ isIdentifierWithOneOfNames<T_1 extends string[]>(node: TSESTree.Node, name: T_1): node is TSESTree.Identifier & {
12
+ name: T_1[number];
13
+ };
14
+ isProperty(node: TSESTree.Node): node is TSESTree.Property;
15
+ isObjectExpression(node: TSESTree.Node): node is TSESTree.ObjectExpression;
16
+ isPropertyWithIdentifierKey(node: TSESTree.Node, key: string): node is TSESTree.Property;
17
+ findPropertyWithIdentifierKey(properties: TSESTree.ObjectLiteralElement[], key: string): TSESTree.Property | undefined;
18
+ getNestedIdentifiers(node: TSESTree.Node): TSESTree.Identifier[];
19
+ isAncestorIsCallee(identifier: TSESTree.Node): boolean;
20
+ traverseUpOnly(identifier: TSESTree.Node, allowedNodeTypes: AST_NODE_TYPES[]): TSESTree.Node;
21
+ isDeclaredInNode(params: {
22
+ functionNode: TSESTree.Node;
23
+ reference: TSESLintScopeManager.Reference;
24
+ scopeManager: TSESLint.Scope.ScopeManager;
25
+ }): boolean;
26
+ getExternalRefs(params: {
27
+ scopeManager: TSESLint.Scope.ScopeManager;
28
+ sourceCode: Readonly<TSESLint.SourceCode>;
29
+ node: TSESTree.Node;
30
+ }): TSESLint.Scope.Reference[];
31
+ mapKeyNodeToText(node: TSESTree.Node, sourceCode: Readonly<TSESLint.SourceCode>): string;
32
+ isValidReactComponentOrHookName(identifier: TSESTree.Identifier | null): boolean;
33
+ getFunctionAncestor(context: Readonly<RuleContext<string, readonly unknown[]>>): TSESTree.Node | undefined;
34
+ getReferencedExpressionByIdentifier(params: {
35
+ node: TSESTree.Node;
36
+ context: Readonly<RuleContext<string, readonly unknown[]>>;
37
+ }): TSESTree.Expression | null;
38
+ getNestedReturnStatements(node: TSESTree.Node): TSESTree.ReturnStatement[];
39
+ };
40
+
41
+ export { ASTUtils };