@blumintinc/eslint-plugin-blumint 1.5.1 → 1.5.3

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.
@@ -89,6 +89,18 @@ function getObjectUsagesInHook(hookBody, objectName) {
89
89
  }
90
90
  });
91
91
  }
92
+ else if (node.type === utils_1.AST_NODE_TYPES.JSXElement || node.type === utils_1.AST_NODE_TYPES.JSXFragment) {
93
+ // If we find a JSX element, check its attributes for spread operator
94
+ if (node.type === utils_1.AST_NODE_TYPES.JSXElement) {
95
+ node.openingElement.attributes.forEach((attr) => {
96
+ if (attr.type === utils_1.AST_NODE_TYPES.JSXSpreadAttribute &&
97
+ attr.argument.type === utils_1.AST_NODE_TYPES.Identifier &&
98
+ attr.argument.name === objectName) {
99
+ needsEntireObject = true;
100
+ }
101
+ });
102
+ }
103
+ }
92
104
  else if (node.type === utils_1.AST_NODE_TYPES.SpreadElement) {
93
105
  // If we find a spread operator with our target object, consider it as accessing all properties
94
106
  if (node.argument.type === utils_1.AST_NODE_TYPES.Identifier &&
@@ -48,6 +48,9 @@ exports.preferSettingsObject = (0, createRule_1.createRule)({
48
48
  create(context, [options]) {
49
49
  const finalOptions = { ...defaultOptions, ...options };
50
50
  function getParameterType(param) {
51
+ if (param.type === utils_1.AST_NODE_TYPES.AssignmentPattern) {
52
+ return getParameterType(param.left);
53
+ }
51
54
  if (param.type === utils_1.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
52
55
  const typeNode = param.typeAnnotation.typeAnnotation;
53
56
  if (typeNode.type === utils_1.AST_NODE_TYPES.TSTypeReference) {
@@ -55,6 +58,12 @@ exports.preferSettingsObject = (0, createRule_1.createRule)({
55
58
  ? typeNode.typeName.name
56
59
  : 'unknown';
57
60
  }
61
+ if (typeNode.type === utils_1.AST_NODE_TYPES.TSStringKeyword)
62
+ return 'string';
63
+ if (typeNode.type === utils_1.AST_NODE_TYPES.TSNumberKeyword)
64
+ return 'number';
65
+ if (typeNode.type === utils_1.AST_NODE_TYPES.TSBooleanKeyword)
66
+ return 'boolean';
58
67
  return typeNode.type;
59
68
  }
60
69
  return 'unknown';
@@ -95,7 +104,7 @@ exports.preferSettingsObject = (0, createRule_1.createRule)({
95
104
  if (shouldIgnoreNode(node))
96
105
  return;
97
106
  const params = node.params;
98
- // Check for too many parameters
107
+ // Check for too many parameters first
99
108
  const minParams = finalOptions.minimumParameters !== undefined
100
109
  ? finalOptions.minimumParameters
101
110
  : defaultOptions.minimumParameters;
@@ -107,7 +116,7 @@ exports.preferSettingsObject = (0, createRule_1.createRule)({
107
116
  });
108
117
  return;
109
118
  }
110
- // Check for same type parameters if enabled
119
+ // Then check for same type parameters if enabled
111
120
  if (finalOptions.checkSameTypeParameters && params.length >= 2) {
112
121
  if (hasSameTypeParameters(params)) {
113
122
  context.report({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blumintinc/eslint-plugin-blumint",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Custom eslint rules for use within BluMint",
5
5
  "author": {
6
6
  "name": "Brodie McGuire",