@blumintinc/eslint-plugin-blumint 1.20.20 → 1.20.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -223,7 +223,7 @@ function noFrontendImportsFromFunctionsPatterns(pattern) {
223
223
  module.exports = {
224
224
  meta: {
225
225
  name: '@blumintinc/eslint-plugin-blumint',
226
- version: '1.20.20',
226
+ version: '1.20.21',
227
227
  },
228
228
  parseOptions: {
229
229
  ecmaVersion: 2020,
@@ -184,6 +184,19 @@ exports.enforceQueryKeyTs = (0, createRule_1.createRule)({
184
184
  }
185
185
  return 'bound';
186
186
  }
187
+ /**
188
+ * A parameter binding holds a different value on every call, so no single
189
+ * `QUERY_KEY_*` constant can stand in for it: a hook that iterates a
190
+ * constant array of keys hands each one to a callback parameter by design
191
+ * (#1393). Reporting such an identifier demands a substitution that does not
192
+ * exist, and the enclosing function is where the caller — not this file —
193
+ * decides which key is passed.
194
+ */
195
+ function isParameterBinding(identifier) {
196
+ const variable = utils_1.ASTUtils.findVariable(scopeOf(identifier), identifier);
197
+ const definition = variable?.defs[0];
198
+ return definition?.type === utils_1.TSESLint.Scope.DefinitionType.Parameter;
199
+ }
187
200
  function queryKeysDeclarationsOf() {
188
201
  return importDeclarationsOf().filter((declaration) => isQueryKeysSource(String(declaration.source.value)));
189
202
  }
@@ -494,7 +507,8 @@ exports.enforceQueryKeyTs = (0, createRule_1.createRule)({
494
507
  : undefined,
495
508
  });
496
509
  }
497
- else if (keyValue.type === utils_1.AST_NODE_TYPES.Identifier) {
510
+ else if (keyValue.type === utils_1.AST_NODE_TYPES.Identifier &&
511
+ !isParameterBinding(keyValue)) {
498
512
  // Report variables that aren't from the correct source
499
513
  pendingReports.push({
500
514
  node: keyValue,
@@ -121,6 +121,28 @@ exports.preferGlobalRouterStateKey = (0, createRule_1.createRule)({
121
121
  function isValidQueryKeyConstant(name) {
122
122
  return name.startsWith('QUERY_KEY_');
123
123
  }
124
+ /**
125
+ * `SourceCode#getScope` supersedes the deprecated `context.getScope`; the
126
+ * fallback keeps the rule working on ESLint versions that predate it.
127
+ */
128
+ function scopeOf(node) {
129
+ const scoped = sourceCode;
130
+ return typeof scoped.getScope === 'function'
131
+ ? scoped.getScope(node)
132
+ : context.getScope();
133
+ }
134
+ /**
135
+ * A parameter binding holds a different value on every call, so no single
136
+ * `QUERY_KEY_*` constant can stand in for it: a hook that iterates a
137
+ * constant array of keys hands each one to a callback parameter by design
138
+ * (#1394). Reporting such an identifier demands a substitution that does not
139
+ * exist, and the caller — not this file — decides which key is passed.
140
+ */
141
+ function isParameterBinding(identifier) {
142
+ const variable = utils_1.ASTUtils.findVariable(scopeOf(identifier), identifier);
143
+ const definition = variable?.defs[0];
144
+ return definition?.type === utils_1.TSESLint.Scope.DefinitionType.Parameter;
145
+ }
124
146
  /**
125
147
  * Check if a node represents a valid query key usage
126
148
  */
@@ -408,7 +430,8 @@ exports.preferGlobalRouterStateKey = (0, createRule_1.createRule)({
408
430
  },
409
431
  });
410
432
  }
411
- else if (keyValue.type === utils_1.AST_NODE_TYPES.Identifier) {
433
+ else if (keyValue.type === utils_1.AST_NODE_TYPES.Identifier &&
434
+ !isParameterBinding(keyValue)) {
412
435
  context.report({
413
436
  node: keyValue,
414
437
  messageId: 'invalidQueryKeySource',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blumintinc/eslint-plugin-blumint",
3
- "version": "1.20.20",
3
+ "version": "1.20.21",
4
4
  "description": "Custom eslint rules for use within BluMint",
5
5
  "author": {
6
6
  "name": "Brodie McGuire",
@@ -1,4 +1,26 @@
1
1
  [
2
+ {
3
+ "version": "1.20.21",
4
+ "date": "2026-07-29T23:50:58.620Z",
5
+ "rules": [
6
+ {
7
+ "name": "enforce-querykey-ts",
8
+ "changeType": "fix",
9
+ "issues": [
10
+ 1393
11
+ ],
12
+ "summary": "exempt parameter bindings from the constant requirement (closes #1393)"
13
+ },
14
+ {
15
+ "name": "prefer-global-router-state-key",
16
+ "changeType": "fix",
17
+ "issues": [
18
+ 1394
19
+ ],
20
+ "summary": "exempt parameter bindings from the constant requirement (closes #1394)"
21
+ }
22
+ ]
23
+ },
2
24
  {
3
25
  "version": "1.20.20",
4
26
  "date": "2026-07-29T19:25:11.467Z",