@blumintinc/eslint-plugin-blumint 1.12.6 → 1.13.0

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 (141) hide show
  1. package/README.md +140 -99
  2. package/lib/index.js +111 -17
  3. package/lib/rules/array-methods-this-context.js +20 -2
  4. package/lib/rules/avoid-utils-directory.js +11 -2
  5. package/lib/rules/dynamic-https-errors.d.ts +3 -1
  6. package/lib/rules/dynamic-https-errors.js +48 -10
  7. package/lib/rules/enforce-assert-safe-object-key.d.ts +8 -0
  8. package/lib/rules/{enforce-assertSafe-object-key.js → enforce-assert-safe-object-key.js} +51 -95
  9. package/lib/rules/enforce-assert-throws.d.ts +3 -1
  10. package/lib/rules/enforce-assert-throws.js +493 -51
  11. package/lib/rules/enforce-boolean-naming-prefixes.d.ts +3 -1
  12. package/lib/rules/enforce-boolean-naming-prefixes.js +832 -39
  13. package/lib/rules/enforce-callable-types.js +4 -4
  14. package/lib/rules/enforce-callback-memo.js +143 -18
  15. package/lib/rules/enforce-centralized-mock-firestore.js +4 -1
  16. package/lib/rules/enforce-console-error.d.ts +3 -0
  17. package/lib/rules/enforce-console-error.js +250 -0
  18. package/lib/rules/enforce-css-media-queries.js +24 -46
  19. package/lib/rules/enforce-dynamic-firebase-imports.js +100 -19
  20. package/lib/rules/enforce-dynamic-imports.js +1 -1
  21. package/lib/rules/enforce-exported-function-types.js +3 -3
  22. package/lib/rules/enforce-fieldpath-syntax-in-docsetter.d.ts +2 -0
  23. package/lib/rules/enforce-fieldpath-syntax-in-docsetter.js +212 -0
  24. package/lib/rules/enforce-firestore-doc-ref-generic.js +335 -0
  25. package/lib/rules/enforce-firestore-facade.js +347 -157
  26. package/lib/rules/enforce-firestore-rules-get-access.d.ts +3 -0
  27. package/lib/rules/enforce-firestore-rules-get-access.js +109 -0
  28. package/lib/rules/enforce-global-constants.d.ts +4 -1
  29. package/lib/rules/enforce-global-constants.js +240 -12
  30. package/lib/rules/enforce-memoize-async.d.ts +2 -1
  31. package/lib/rules/enforce-memoize-async.js +96 -27
  32. package/lib/rules/enforce-memoize-getters.d.ts +3 -0
  33. package/lib/rules/enforce-memoize-getters.js +123 -0
  34. package/lib/rules/enforce-microdiff.js +2 -1
  35. package/lib/rules/enforce-positive-naming.js +5 -7
  36. package/lib/rules/enforce-props-argument-name.d.ts +2 -7
  37. package/lib/rules/enforce-props-argument-name.js +165 -151
  38. package/lib/rules/enforce-props-naming-consistency.d.ts +2 -0
  39. package/lib/rules/enforce-props-naming-consistency.js +145 -0
  40. package/lib/rules/enforce-querykey-ts.d.ts +9 -0
  41. package/lib/rules/enforce-querykey-ts.js +274 -0
  42. package/lib/rules/enforce-singular-type-names.js +9 -5
  43. package/lib/rules/enforce-typescript-markdown-code-blocks.d.ts +1 -0
  44. package/lib/rules/enforce-typescript-markdown-code-blocks.js +96 -0
  45. package/lib/rules/enforce-verb-noun-naming.js +85 -10
  46. package/lib/rules/extract-global-constants.js +57 -45
  47. package/lib/rules/fast-deep-equal-over-microdiff.d.ts +2 -1
  48. package/lib/rules/fast-deep-equal-over-microdiff.js +356 -78
  49. package/lib/rules/firestore-transaction-reads-before-writes.d.ts +1 -0
  50. package/lib/rules/firestore-transaction-reads-before-writes.js +231 -0
  51. package/lib/rules/generic-starts-with-t.js +8 -2
  52. package/lib/rules/memoize-root-level-hocs.d.ts +7 -0
  53. package/lib/rules/memoize-root-level-hocs.js +242 -0
  54. package/lib/rules/no-array-length-in-deps.d.ts +12 -0
  55. package/lib/rules/no-array-length-in-deps.js +308 -0
  56. package/lib/rules/no-async-array-filter.js +5 -2
  57. package/lib/rules/no-complex-cloud-params.js +15 -2
  58. package/lib/rules/no-compositing-layer-props.js +4 -2
  59. package/lib/rules/no-entire-object-hook-deps.d.ts +3 -1
  60. package/lib/rules/no-entire-object-hook-deps.js +317 -63
  61. package/lib/rules/no-excessive-parent-chain.d.ts +5 -0
  62. package/lib/rules/no-excessive-parent-chain.js +273 -0
  63. package/lib/rules/no-firestore-object-arrays.js +345 -30
  64. package/lib/rules/no-hungarian.js +13 -13
  65. package/lib/rules/no-margin-properties.d.ts +7 -1
  66. package/lib/rules/no-margin-properties.js +16 -3
  67. package/lib/rules/no-misleading-boolean-prefixes.d.ts +7 -0
  68. package/lib/rules/no-misleading-boolean-prefixes.js +327 -0
  69. package/lib/rules/no-overridable-method-calls-in-constructor.d.ts +1 -0
  70. package/lib/rules/no-overridable-method-calls-in-constructor.js +260 -0
  71. package/lib/rules/no-passthrough-getters.d.ts +4 -0
  72. package/lib/rules/no-passthrough-getters.js +170 -0
  73. package/lib/rules/no-redundant-usecallback-wrapper.d.ts +8 -0
  74. package/lib/rules/no-redundant-usecallback-wrapper.js +315 -0
  75. package/lib/rules/no-restricted-properties-fix.d.ts +12 -0
  76. package/lib/rules/no-restricted-properties-fix.js +172 -0
  77. package/lib/rules/no-separate-loading-state.d.ts +8 -0
  78. package/lib/rules/no-separate-loading-state.js +142 -0
  79. package/lib/rules/no-stale-state-across-await.d.ts +1 -0
  80. package/lib/rules/no-stale-state-across-await.js +185 -0
  81. package/lib/rules/no-static-constants-in-dynamic-files.d.ts +3 -0
  82. package/lib/rules/no-static-constants-in-dynamic-files.js +149 -0
  83. package/lib/rules/no-try-catch-already-exists-in-transaction.d.ts +1 -0
  84. package/lib/rules/no-try-catch-already-exists-in-transaction.js +342 -0
  85. package/lib/rules/no-type-assertion-returns.js +6 -0
  86. package/lib/rules/no-undefined-null-passthrough.js +166 -19
  87. package/lib/rules/no-unnecessary-verb-suffix.js +0 -2
  88. package/lib/rules/no-unsafe-firestore-spread.js +8 -5
  89. package/lib/rules/no-unused-props.d.ts +3 -0
  90. package/lib/rules/no-unused-props.js +213 -78
  91. package/lib/rules/optimize-object-boolean-conditions.d.ts +1 -0
  92. package/lib/rules/optimize-object-boolean-conditions.js +234 -0
  93. package/lib/rules/parallelize-async-operations.d.ts +8 -0
  94. package/lib/rules/parallelize-async-operations.js +375 -0
  95. package/lib/rules/prefer-batch-operations.js +199 -33
  96. package/lib/rules/prefer-block-comments-for-declarations.js +13 -3
  97. package/lib/rules/prefer-document-flattening.d.ts +4 -0
  98. package/lib/rules/prefer-document-flattening.js +239 -0
  99. package/lib/rules/prefer-field-paths-in-transforms.d.ts +7 -0
  100. package/lib/rules/prefer-field-paths-in-transforms.js +250 -0
  101. package/lib/rules/prefer-fragment-component.js +3 -3
  102. package/lib/rules/prefer-global-router-state-key.d.ts +7 -3
  103. package/lib/rules/prefer-global-router-state-key.js +230 -31
  104. package/lib/rules/prefer-next-dynamic.d.ts +9 -0
  105. package/lib/rules/prefer-next-dynamic.js +366 -0
  106. package/lib/rules/prefer-nullish-coalescing-boolean-props.d.ts +1 -0
  107. package/lib/rules/prefer-nullish-coalescing-boolean-props.js +430 -0
  108. package/lib/rules/prefer-nullish-coalescing-override.d.ts +6 -0
  109. package/lib/rules/prefer-nullish-coalescing-override.js +182 -0
  110. package/lib/rules/prefer-params-over-parent-id.d.ts +5 -0
  111. package/lib/rules/prefer-params-over-parent-id.js +228 -0
  112. package/lib/rules/prefer-settings-object.js +23 -15
  113. package/lib/rules/prefer-type-alias-over-typeof-constant.d.ts +3 -0
  114. package/lib/rules/prefer-type-alias-over-typeof-constant.js +259 -0
  115. package/lib/rules/prefer-url-tostring-over-tojson.d.ts +2 -0
  116. package/lib/rules/prefer-url-tostring-over-tojson.js +166 -0
  117. package/lib/rules/prefer-use-deep-compare-memo.d.ts +4 -0
  118. package/lib/rules/prefer-use-deep-compare-memo.js +428 -0
  119. package/lib/rules/prefer-usecallback-over-usememo-for-functions.js +24 -1
  120. package/lib/rules/prefer-usememo-over-useeffect-usestate.js +24 -5
  121. package/lib/rules/react-usememo-should-be-component.d.ts +2 -1
  122. package/lib/rules/react-usememo-should-be-component.js +144 -78
  123. package/lib/rules/require-dynamic-firebase-imports.js +2 -1
  124. package/lib/rules/require-image-optimized.js +1 -1
  125. package/lib/rules/require-memo.js +11 -1
  126. package/lib/rules/require-usememo-object-literals.js +7 -1
  127. package/lib/rules/semantic-function-prefixes.js +38 -18
  128. package/lib/rules/sync-onwrite-name-func.js +5 -1
  129. package/lib/rules/test-file-location-enforcement.d.ts +1 -0
  130. package/lib/rules/test-file-location-enforcement.js +57 -0
  131. package/lib/rules/use-custom-link.js +6 -1
  132. package/lib/rules/use-custom-router.js +6 -1
  133. package/lib/rules/use-latest-callback.d.ts +3 -0
  134. package/lib/rules/use-latest-callback.js +270 -0
  135. package/lib/utils/ASTHelpers.js +10 -0
  136. package/lib/utils/createRule.js +1 -1
  137. package/lib/utils/graph/ClassGraphSorterReadability.js +1 -1
  138. package/lib/utils/ruleTester.d.ts +1 -0
  139. package/lib/utils/ruleTester.js +4 -1
  140. package/package.json +21 -14
  141. package/lib/rules/enforce-assertSafe-object-key.d.ts +0 -2
@@ -4,81 +4,280 @@ exports.preferGlobalRouterStateKey = void 0;
4
4
  const utils_1 = require("@typescript-eslint/utils");
5
5
  const createRule_1 = require("../utils/createRule");
6
6
  /**
7
- * Rule to enforce best practices for the `key` parameter in `useRouterState` hook calls.
8
- * Encourages type safety and maintainability by using global constants or type-safe functions.
7
+ * Rule to enforce the use of centralized router state key constants imported from
8
+ * `src/util/routing/queryKeys.ts` instead of arbitrary string literals when calling
9
+ * router methods that accept key parameters.
9
10
  */
10
11
  exports.preferGlobalRouterStateKey = (0, createRule_1.createRule)({
11
12
  name: 'prefer-global-router-state-key',
12
13
  meta: {
13
- type: 'suggestion',
14
+ type: 'problem',
14
15
  docs: {
15
- description: 'Enforce using global constants or type-safe functions for useRouterState key parameter',
16
- recommended: 'warn',
16
+ description: 'Enforce using centralized router state key constants from queryKeys.ts for useRouterState key parameter',
17
+ recommended: 'error',
17
18
  },
19
+ fixable: 'code',
18
20
  schema: [],
19
21
  messages: {
20
- preferGlobalRouterStateKey: 'Prefer using a global constant or type-safe function for useRouterState key parameter instead of string literals',
22
+ preferGlobalRouterStateKey: 'Router state key {{keyValue}} is a string literal. String literals bypass the shared queryKeys.ts QUERY_KEY_* constants, which leads to duplicate router cache entries and makes allowed keys hard to discover. Import the corresponding QUERY_KEY_* constant from "@/util/routing/queryKeys" (or its approved re-export) and pass that to useRouterState instead.',
23
+ invalidQueryKeySource: 'Router state key variable "{{variableName}}" is not sourced from queryKeys.ts. useRouterState keys must come from QUERY_KEY_* exports so routing cache keys stay stable and traceable. Import the matching constant from "@/util/routing/queryKeys" (or its approved re-export) and use that value here instead of {{variableName}}.',
21
24
  },
22
25
  },
23
26
  defaultOptions: [],
24
27
  create(context) {
28
+ const sourceCode = context.getSourceCode();
29
+ // Track imports from queryKeys.ts
30
+ const queryKeyImports = new Map();
31
+ // Track namespace imports (import * as QueryKeys from ...)
32
+ const namespaceImports = new Map();
33
+ // Track default imports (import queryKeys from ...)
34
+ const defaultImports = new Map();
35
+ // Track re-exports and variable assignments
36
+ const variableAssignments = new Map();
37
+ const validQueryKeySources = new Set([
38
+ 'util/routing/queryKeys',
39
+ 'constants',
40
+ 'constants/index',
41
+ ]);
25
42
  /**
26
- * Checks if a node contains a string literal that should be reported
43
+ * Check if a source path refers to queryKeys.ts or re-exports from it
27
44
  */
28
- function containsStringLiteral(node) {
45
+ function isQueryKeysSource(source) {
46
+ const normalized = source
47
+ .replace(/^@\/|^src\//, '')
48
+ .replace(/^(\.\/|\.\.\/)+/, '');
49
+ return (validQueryKeySources.has(normalized) ||
50
+ normalized.endsWith('util/routing/queryKeys'));
51
+ }
52
+ /**
53
+ * Check if an identifier is a valid QUERY_KEY constant
54
+ */
55
+ function isValidQueryKeyConstant(name) {
56
+ return name.startsWith('QUERY_KEY_');
57
+ }
58
+ /**
59
+ * Check if a node represents a valid query key usage
60
+ */
61
+ function isValidQueryKeyUsage(node) {
62
+ if (node.type === utils_1.AST_NODE_TYPES.Identifier) {
63
+ // Check direct imports
64
+ const importInfo = queryKeyImports.get(node.name);
65
+ if (importInfo && isQueryKeysSource(importInfo.source)) {
66
+ return isValidQueryKeyConstant(importInfo.imported);
67
+ }
68
+ // Check if it's a variable derived from a query key constant
69
+ const assignment = variableAssignments.get(node.name);
70
+ if (assignment) {
71
+ return isValidQueryKeyUsage(assignment);
72
+ }
73
+ }
74
+ // Allow member expressions accessing query key constants
75
+ if (node.type === utils_1.AST_NODE_TYPES.MemberExpression) {
76
+ if (node.object.type === utils_1.AST_NODE_TYPES.Identifier) {
77
+ // Check namespace imports (QueryKeys.QUERY_KEY_USER)
78
+ const namespaceSource = namespaceImports.get(node.object.name);
79
+ if (namespaceSource && isQueryKeysSource(namespaceSource)) {
80
+ if (node.property.type === utils_1.AST_NODE_TYPES.Identifier) {
81
+ return isValidQueryKeyConstant(node.property.name);
82
+ }
83
+ return false; // Invalid property access on namespace import
84
+ }
85
+ // Check default imports (queryKeys.QUERY_KEY_USER)
86
+ const defaultSource = defaultImports.get(node.object.name);
87
+ if (defaultSource && isQueryKeysSource(defaultSource)) {
88
+ return true; // Allow any property access on default imports
89
+ }
90
+ // Check regular imports
91
+ const importInfo = queryKeyImports.get(node.object.name);
92
+ if (importInfo && isQueryKeysSource(importInfo.source)) {
93
+ return true;
94
+ }
95
+ }
96
+ }
97
+ // Allow template literals if they use valid query keys
98
+ if (node.type === utils_1.AST_NODE_TYPES.TemplateLiteral) {
99
+ if (node.expressions.length > 0) {
100
+ return node.expressions.some((expr) => isValidQueryKeyUsage(expr));
101
+ }
102
+ // Template literals with no expressions are just static strings
103
+ return false;
104
+ }
105
+ // Allow binary expressions if they use valid query keys
106
+ if (node.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
107
+ node.operator === '+') {
108
+ return (isValidQueryKeyUsage(node.left) || isValidQueryKeyUsage(node.right));
109
+ }
110
+ // Allow conditional expressions if both branches use valid query keys
111
+ if (node.type === utils_1.AST_NODE_TYPES.ConditionalExpression) {
112
+ return (isValidQueryKeyUsage(node.consequent) &&
113
+ isValidQueryKeyUsage(node.alternate));
114
+ }
115
+ // Allow function calls that might return query keys
116
+ if (node.type === utils_1.AST_NODE_TYPES.CallExpression) {
117
+ return true; // Permissive for function calls
118
+ }
119
+ // Allow type assertions (key as const)
120
+ if (node.type === utils_1.AST_NODE_TYPES.TSAsExpression) {
121
+ return isValidQueryKeyUsage(node.expression);
122
+ }
123
+ if (node.type === utils_1.AST_NODE_TYPES.MemberExpression) {
124
+ return false;
125
+ }
126
+ return false;
127
+ }
128
+ /**
129
+ * Check if a node contains string literals that should be reported
130
+ */
131
+ function containsInvalidStringLiteral(node) {
29
132
  // Direct string literal
30
133
  if (node.type === utils_1.AST_NODE_TYPES.Literal &&
31
134
  typeof node.value === 'string') {
32
135
  return true;
33
136
  }
34
- // String concatenation with + operator
137
+ // String concatenation with + operator containing literals
35
138
  if (node.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
36
- node.operator === '+' &&
37
- (containsStringLiteral(node.left) || containsStringLiteral(node.right))) {
38
- return true;
139
+ node.operator === '+') {
140
+ return (containsInvalidStringLiteral(node.left) ||
141
+ containsInvalidStringLiteral(node.right));
39
142
  }
40
143
  // Conditional (ternary) expression with string literals
41
- if (node.type === utils_1.AST_NODE_TYPES.ConditionalExpression &&
42
- (containsStringLiteral(node.consequent) ||
43
- containsStringLiteral(node.alternate))) {
44
- return true;
144
+ if (node.type === utils_1.AST_NODE_TYPES.ConditionalExpression) {
145
+ return (containsInvalidStringLiteral(node.consequent) ||
146
+ containsInvalidStringLiteral(node.alternate));
45
147
  }
46
- // Template literal with static parts
148
+ // Template literal with static parts (but allow if it uses query key variables)
47
149
  if (node.type === utils_1.AST_NODE_TYPES.TemplateLiteral) {
48
- // Only report if there's a meaningful static part in the template
49
- // This allows dynamic templates like `${prefix}-${id}` but catches `static-${id}`
150
+ // If no expressions, it's just a static template literal
151
+ if (node.expressions.length === 0) {
152
+ return true;
153
+ }
50
154
  const hasSignificantStaticPart = node.quasis.some((quasi) => {
51
155
  const content = quasi.value.raw.trim();
52
- // Allow common separators like '-', '_', ':', '/' as they're just joining dynamic parts
53
156
  return content.length > 0 && !/^[-_:/.]+$/.test(content);
54
157
  });
55
- return hasSignificantStaticPart;
158
+ if (hasSignificantStaticPart) {
159
+ return !node.expressions.every((expr) => isValidQueryKeyUsage(expr));
160
+ }
56
161
  }
57
162
  return false;
58
163
  }
164
+ /**
165
+ * Generate auto-fix suggestion for string literals
166
+ */
167
+ function generateAutoFix(keyValue) {
168
+ const normalizedKey = keyValue
169
+ .toUpperCase()
170
+ .replace(/[^A-Z0-9]/g, '_')
171
+ .replace(/_+/g, '_')
172
+ .replace(/^_|_$/g, '');
173
+ return `QUERY_KEY_${normalizedKey}`;
174
+ }
59
175
  return {
176
+ // Track imports from queryKeys.ts
177
+ ImportDeclaration(node) {
178
+ if (node.source.type === utils_1.AST_NODE_TYPES.Literal &&
179
+ typeof node.source.value === 'string') {
180
+ const source = node.source.value;
181
+ if (isQueryKeysSource(source)) {
182
+ node.specifiers.forEach((spec) => {
183
+ if (spec.type === utils_1.AST_NODE_TYPES.ImportSpecifier) {
184
+ const imported = spec.imported.name;
185
+ const local = spec.local.name;
186
+ queryKeyImports.set(local, { source, imported });
187
+ }
188
+ else if (spec.type === utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier) {
189
+ namespaceImports.set(spec.local.name, source);
190
+ }
191
+ else if (spec.type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier) {
192
+ defaultImports.set(spec.local.name, source);
193
+ }
194
+ });
195
+ }
196
+ }
197
+ },
198
+ // Track variable declarations that might derive from query key constants
199
+ VariableDeclarator(node) {
200
+ if (node.id.type === utils_1.AST_NODE_TYPES.Identifier && node.init) {
201
+ variableAssignments.set(node.id.name, node.init);
202
+ }
203
+ },
204
+ // Track assignment expressions
205
+ AssignmentExpression(node) {
206
+ if (node.left.type === utils_1.AST_NODE_TYPES.Identifier &&
207
+ node.operator === '=') {
208
+ variableAssignments.set(node.left.name, node.right);
209
+ }
210
+ },
211
+ // Check useRouterState calls
60
212
  CallExpression(node) {
61
213
  // Check if this is a call to useRouterState
62
214
  if (node.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
63
215
  node.callee.name === 'useRouterState') {
64
- // Check if there are arguments
65
216
  if (node.arguments.length > 0) {
66
217
  const firstArg = node.arguments[0];
67
- // Check if the first argument is an object expression
68
218
  if (firstArg.type === utils_1.AST_NODE_TYPES.ObjectExpression) {
69
- // Find the key property in the object
70
219
  const keyProperty = firstArg.properties.find((prop) => prop.type === utils_1.AST_NODE_TYPES.Property &&
71
220
  prop.key.type === utils_1.AST_NODE_TYPES.Identifier &&
72
221
  prop.key.name === 'key');
73
- // If key property exists, check its value
74
222
  if (keyProperty && keyProperty.value) {
75
223
  const keyValue = keyProperty.value;
76
- // Check for string literals in various contexts
77
- if (containsStringLiteral(keyValue)) {
78
- context.report({
79
- node: keyValue,
80
- messageId: 'preferGlobalRouterStateKey',
81
- });
224
+ if (!isValidQueryKeyUsage(keyValue)) {
225
+ if (containsInvalidStringLiteral(keyValue)) {
226
+ context.report({
227
+ node: keyValue,
228
+ messageId: 'preferGlobalRouterStateKey',
229
+ data: {
230
+ keyValue: sourceCode.getText(keyValue),
231
+ },
232
+ fix(fixer) {
233
+ if (keyValue.type === utils_1.AST_NODE_TYPES.Literal &&
234
+ typeof keyValue.value === 'string') {
235
+ const suggestedConstant = generateAutoFix(keyValue.value);
236
+ if (suggestedConstant) {
237
+ const fixes = [];
238
+ // 1) Replace the literal with the constant
239
+ fixes.push(fixer.replaceText(keyValue, suggestedConstant));
240
+ // 2) Ensure an import exists for the suggested constant
241
+ const sourceCode = context.getSourceCode();
242
+ const alreadyImportedNamed = Array.from(queryKeyImports.values()).some((info) => isQueryKeysSource(info.source) &&
243
+ info.imported === suggestedConstant);
244
+ const hasNamespaceOrDefault = namespaceImports.size > 0 ||
245
+ defaultImports.size > 0;
246
+ if (!alreadyImportedNamed && !hasNamespaceOrDefault) {
247
+ const importText = `import { ${suggestedConstant} } from '@/util/routing/queryKeys';\n`;
248
+ const firstImport = sourceCode.ast.body.find((n) => n.type === utils_1.AST_NODE_TYPES.ImportDeclaration);
249
+ if (firstImport) {
250
+ fixes.push(fixer.insertTextBefore(firstImport, importText));
251
+ }
252
+ else {
253
+ fixes.push(fixer.insertTextBeforeRange([0, 0], importText));
254
+ }
255
+ }
256
+ return fixes;
257
+ }
258
+ }
259
+ return null;
260
+ },
261
+ });
262
+ }
263
+ else if (keyValue.type === utils_1.AST_NODE_TYPES.Identifier) {
264
+ context.report({
265
+ node: keyValue,
266
+ messageId: 'invalidQueryKeySource',
267
+ data: {
268
+ variableName: keyValue.name,
269
+ },
270
+ });
271
+ }
272
+ else if (keyValue.type === utils_1.AST_NODE_TYPES.MemberExpression) {
273
+ context.report({
274
+ node: keyValue,
275
+ messageId: 'invalidQueryKeySource',
276
+ data: {
277
+ variableName: sourceCode.getText(keyValue),
278
+ },
279
+ });
280
+ }
82
281
  }
83
282
  }
84
283
  }
@@ -0,0 +1,9 @@
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
+ type MessageIds = 'preferNextDynamic' | 'addNextDynamicImport' | 'removeUseDynamicImport';
3
+ type Options = [
4
+ {
5
+ useDynamicSources?: string[];
6
+ }?
7
+ ];
8
+ export declare const preferNextDynamic: TSESLint.RuleModule<MessageIds, Options, TSESLint.RuleListener>;
9
+ export {};