@blumintinc/eslint-plugin-blumint 1.5.0 → 1.5.2

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
@@ -52,10 +52,14 @@ const enforce_memoize_async_1 = require("./rules/enforce-memoize-async");
52
52
  const enforce_exported_function_types_1 = require("./rules/enforce-exported-function-types");
53
53
  const no_redundant_param_types_1 = require("./rules/no-redundant-param-types");
54
54
  const no_class_instance_destructuring_1 = require("./rules/no-class-instance-destructuring");
55
+ const no_firestore_object_arrays_1 = require("./rules/no-firestore-object-arrays");
56
+ const no_memoize_on_static_1 = require("./rules/no-memoize-on-static");
57
+ const no_unsafe_firestore_spread_1 = require("./rules/no-unsafe-firestore-spread");
58
+ const no_jsx_in_hooks_1 = require("./rules/no-jsx-in-hooks");
55
59
  module.exports = {
56
60
  meta: {
57
61
  name: '@blumintinc/eslint-plugin-blumint',
58
- version: '1.5.0',
62
+ version: '1.5.2',
59
63
  },
60
64
  parseOptions: {
61
65
  ecmaVersion: 2020,
@@ -113,6 +117,10 @@ module.exports = {
113
117
  '@blumintinc/blumint/enforce-exported-function-types': 'error',
114
118
  '@blumintinc/blumint/no-redundant-param-types': 'error',
115
119
  '@blumintinc/blumint/no-class-instance-destructuring': 'error',
120
+ '@blumintinc/blumint/no-firestore-object-arrays': 'warn',
121
+ '@blumintinc/blumint/no-memoize-on-static': 'error',
122
+ '@blumintinc/blumint/no-unsafe-firestore-spread': 'error',
123
+ '@blumintinc/blumint/no-jsx-in-hooks': 'error',
116
124
  },
117
125
  },
118
126
  },
@@ -166,6 +174,10 @@ module.exports = {
166
174
  'enforce-exported-function-types': enforce_exported_function_types_1.enforceExportedFunctionTypes,
167
175
  'no-redundant-param-types': no_redundant_param_types_1.noRedundantParamTypes,
168
176
  'no-class-instance-destructuring': no_class_instance_destructuring_1.noClassInstanceDestructuring,
177
+ 'no-firestore-object-arrays': no_firestore_object_arrays_1.noFirestoreObjectArrays,
178
+ 'no-memoize-on-static': no_memoize_on_static_1.noMemoizeOnStatic,
179
+ 'no-unsafe-firestore-spread': no_unsafe_firestore_spread_1.noUnsafeFirestoreSpread,
180
+ 'no-jsx-in-hooks': no_jsx_in_hooks_1.noJsxInHooks,
169
181
  },
170
182
  };
171
183
  //# sourceMappingURL=index.js.map
@@ -40,17 +40,44 @@ exports.enforceExportedFunctionTypes = (0, createRule_1.createRule)({
40
40
  }
41
41
  return false;
42
42
  }
43
- function getTypeNames(node) {
43
+ function findTypeParameters(node) {
44
+ // Find all type parameters in scope
45
+ const typeParams = new Set();
46
+ let current = node;
47
+ while (current) {
48
+ // Handle type parameters in function declarations
49
+ if (current.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
50
+ current.type === utils_1.AST_NODE_TYPES.FunctionDeclaration) {
51
+ if ('typeParameters' in current && current.typeParameters) {
52
+ current.typeParameters.params.forEach((param) => {
53
+ if (param.type === utils_1.AST_NODE_TYPES.TSTypeParameter) {
54
+ typeParams.add(param.name.name);
55
+ }
56
+ });
57
+ }
58
+ }
59
+ current = current.parent;
60
+ }
61
+ return typeParams;
62
+ }
63
+ function getTypeNames(node, typeParams) {
44
64
  if (!node)
45
65
  return [];
66
+ // Initialize type parameters if not provided
67
+ if (!typeParams) {
68
+ typeParams = findTypeParameters(node);
69
+ }
46
70
  switch (node.type) {
47
71
  case utils_1.AST_NODE_TYPES.TSTypeReference:
48
72
  if (node.typeName.type === utils_1.AST_NODE_TYPES.Identifier) {
73
+ // Skip checking generic type parameters (e.g., T in <T extends DocumentData>)
74
+ if (typeParams.has(node.typeName.name))
75
+ return [];
49
76
  const names = [node.typeName.name];
50
- // For generic types like AuthenticatedRequest<Params>, check both the base type and type parameters
77
+ // For generic types like AuthenticatedRequest<Params>, check type arguments
51
78
  if ('typeParameters' in node && node.typeParameters) {
52
79
  node.typeParameters.params.forEach((param) => {
53
- names.push(...getTypeNames(param));
80
+ names.push(...getTypeNames(param, typeParams));
54
81
  });
55
82
  }
56
83
  return names;
@@ -35,8 +35,10 @@ exports.enforceMemoizeAsync = (0, createRule_1.createRule)({
35
35
  }
36
36
  },
37
37
  MethodDefinition(node) {
38
- // Only process async methods
39
- if (node.value.type !== utils_1.AST_NODE_TYPES.FunctionExpression || !node.value.async) {
38
+ // Only process async instance methods (skip static methods)
39
+ if (node.value.type !== utils_1.AST_NODE_TYPES.FunctionExpression ||
40
+ !node.value.async ||
41
+ node.static) {
40
42
  return;
41
43
  }
42
44
  // Skip methods with more than one parameter