@blumintinc/eslint-plugin-blumint 1.7.3 β†’ 1.8.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 (38) hide show
  1. package/README.md +39 -62
  2. package/lib/index.js +37 -1
  3. package/lib/rules/enforce-assert-throws.js +48 -3
  4. package/lib/rules/enforce-assertSafe-object-key.d.ts +2 -0
  5. package/lib/rules/enforce-assertSafe-object-key.js +284 -0
  6. package/lib/rules/enforce-centralized-mock-firestore.js +192 -14
  7. package/lib/rules/enforce-firestore-facade.js +8 -0
  8. package/lib/rules/enforce-microdiff.d.ts +3 -0
  9. package/lib/rules/enforce-microdiff.js +379 -0
  10. package/lib/rules/enforce-object-literal-as-const.d.ts +4 -0
  11. package/lib/rules/enforce-object-literal-as-const.js +88 -0
  12. package/lib/rules/enforce-positive-naming.d.ts +1 -0
  13. package/lib/rules/enforce-positive-naming.js +363 -0
  14. package/lib/rules/enforce-props-argument-name.d.ts +8 -0
  15. package/lib/rules/enforce-props-argument-name.js +182 -0
  16. package/lib/rules/enforce-render-hits-memoization.js +155 -26
  17. package/lib/rules/enforce-timestamp-now.d.ts +1 -0
  18. package/lib/rules/enforce-timestamp-now.js +223 -0
  19. package/lib/rules/extract-global-constants.d.ts +1 -1
  20. package/lib/rules/extract-global-constants.js +109 -1
  21. package/lib/rules/global-const-style.js +3 -2
  22. package/lib/rules/no-always-true-false-conditions.d.ts +3 -0
  23. package/lib/rules/no-always-true-false-conditions.js +1202 -0
  24. package/lib/rules/no-firestore-jest-mock.js +27 -4
  25. package/lib/rules/no-mock-firebase-admin.js +20 -7
  26. package/lib/rules/no-type-assertion-returns.d.ts +9 -0
  27. package/lib/rules/no-type-assertion-returns.js +289 -0
  28. package/lib/rules/no-unnecessary-verb-suffix.d.ts +1 -0
  29. package/lib/rules/no-unnecessary-verb-suffix.js +203 -0
  30. package/lib/rules/prefer-clone-deep.js +294 -22
  31. package/lib/rules/prefer-fragment-component.js +265 -34
  32. package/lib/rules/prefer-global-router-state-key.d.ts +5 -0
  33. package/lib/rules/prefer-global-router-state-key.js +89 -0
  34. package/lib/rules/prefer-utility-function-over-private-static.d.ts +1 -0
  35. package/lib/rules/prefer-utility-function-over-private-static.js +77 -0
  36. package/lib/rules/react-usememo-should-be-component.d.ts +1 -0
  37. package/lib/rules/react-usememo-should-be-component.js +256 -0
  38. package/package.json +5 -5
package/README.md CHANGED
@@ -52,71 +52,48 @@ Or use the recommended config:
52
52
  <!-- begin auto-generated rules list -->
53
53
 
54
54
  πŸ’Ό Configurations enabled in.\
55
- ⚠️ Configurations set to warn in.\
56
55
  βœ… Set in the `recommended` configuration.\
57
56
  πŸ”§ Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
58
57
  πŸ’­ Requires [type information](https://typescript-eslint.io/linting/typed-linting).
59
58
 
60
- | NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  | Description | πŸ’Ό | ⚠️ | πŸ”§ | πŸ’­ |
61
- | :--------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :- | :- | :- | :- |
62
- | [array-methods-this-context](docs/rules/array-methods-this-context.md) | Prevent misuse of Array methods in OOP | βœ… | | | |
63
- | [avoid-utils-directory](docs/rules/avoid-utils-directory.md) | Enforce using util/ instead of utils/ directory | βœ… | | πŸ”§ | |
64
- | [class-methods-read-top-to-bottom](docs/rules/class-methods-read-top-to-bottom.md) | Ensures classes read linearly from top to bottom. | βœ… | | πŸ”§ | |
65
- | [consistent-callback-naming](docs/rules/consistent-callback-naming.md) | Enforce consistent naming conventions for callback props and functions | βœ… | | πŸ”§ | |
66
- | [dynamic-https-errors](docs/rules/dynamic-https-errors.md) | Dynamic error details should only be in the third argument of the HttpsError constructor. The second argument is hashed to produce a unique id. | βœ… | | | |
67
- | [enforce-assert-throws](docs/rules/enforce-assert-throws.md) | Enforce that functions with assert- prefix must throw an error | βœ… | | | |
68
- | [enforce-callable-types](docs/rules/enforce-callable-types.md) | Enforce Params and Response type exports in callable functions | βœ… | | | |
69
- | [enforce-callback-memo](docs/rules/enforce-callback-memo.md) | Enforce useCallback for inline functions and useMemo for objects/arrays containing functions in JSX props to prevent unnecessary re-renders. This improves React component performance by ensuring stable function references across renders and memoizing complex objects. | βœ… | | | |
70
- | [enforce-dynamic-firebase-imports](docs/rules/enforce-dynamic-firebase-imports.md) | Enforce dynamic importing for modules within the firebaseCloud directory to optimize initial bundle size. This ensures Firebase-related code is only loaded when needed, improving application startup time and reducing the main bundle size. | βœ… | | | |
71
- | [enforce-exported-function-types](docs/rules/enforce-exported-function-types.md) | Enforce exporting types for function props and return values | βœ… | | | |
72
- | [enforce-firestore-doc-ref-generic](docs/rules/enforce-firestore-doc-ref-generic.md) | Enforce generic argument for Firestore DocumentReference, CollectionReference and CollectionGroup | βœ… | | | πŸ’­ |
73
- | [enforce-firestore-facade](docs/rules/enforce-firestore-facade.md) | Enforce usage of Firestore facades instead of direct Firestore methods | βœ… | | | |
74
- | [enforce-firestore-path-utils](docs/rules/enforce-firestore-path-utils.md) | Enforce usage of utility functions for Firestore paths to ensure type safety, maintainability, and consistent path construction. This prevents errors from manual string concatenation and makes path changes easier to manage. | βœ… | | | |
75
- | [enforce-firestore-set-merge](docs/rules/enforce-firestore-set-merge.md) | Enforce using set() with { merge: true } instead of update() for Firestore operations to ensure consistent behavior. The update() method fails if the document does not exist, while set() with { merge: true } creates the document if needed and safely merges fields, making it more reliable and predictable. | βœ… | | πŸ”§ | |
76
- | [enforce-identifiable-firestore-type](docs/rules/enforce-identifiable-firestore-type.md) | Enforce that Firestore type definitions extend Identifiable and match their folder name | βœ… | | | |
77
- | [enforce-memoize-async](docs/rules/enforce-memoize-async.md) | Enforce @Memoize() decorator on async methods with 0-1 parameters to cache results and prevent redundant API calls or expensive computations. This improves performance by reusing previous results when the same parameters are provided, particularly useful for data fetching methods. | βœ… | | πŸ”§ | |
78
- | [enforce-mock-firestore](docs/rules/enforce-mock-firestore.md) | Enforce using the standardized mockFirestore utility instead of manual Firestore mocking or third-party mocks. This ensures consistent test behavior across the codebase, reduces boilerplate, and provides type-safe mocking of Firestore operations. | βœ… | | | |
79
- | [enforce-realtimedb-path-utils](docs/rules/enforce-realtimedb-path-utils.md) | Enforce usage of utility functions for Realtime Database paths | βœ… | | | |
80
- | [enforce-safe-stringify](docs/rules/enforce-safe-stringify.md) | Enforce using safe-stable-stringify instead of JSON.stringify to handle circular references and ensure deterministic output. JSON.stringify can throw errors on circular references and produce inconsistent output for objects with the same properties in different orders. safe-stable-stringify handles these cases safely. | βœ… | | πŸ”§ | |
81
- | [enforce-serializable-params](docs/rules/enforce-serializable-params.md) | Enforce serializable parameters in Firebase Callable/HTTPS Cloud Functions to prevent runtime errors. Firebase Functions can only pass JSON-serializable data, so using non-serializable types like Date, DocumentReference, or Map will cause failures. Use primitive types, plain objects, and arrays instead, converting complex types to their serializable representations (e.g., Date to ISO string). | βœ… | | | |
82
- | [enforce-verb-noun-naming](docs/rules/enforce-verb-noun-naming.md) | Enforce verb phrases for functions and methods | βœ… | | | |
83
- | [export-if-in-doubt](docs/rules/export-if-in-doubt.md) | All top-level const definitions, type definitions, and functions should be exported | | | | |
84
- | [extract-global-constants](docs/rules/extract-global-constants.md) | Extract static constants and functions to the global scope when possible | βœ… | | | |
85
- | [generic-starts-with-t](docs/rules/generic-starts-with-t.md) | Enforce TypeScript generic types to start with T | βœ… | | | |
86
- | [global-const-style](docs/rules/global-const-style.md) | Enforce UPPER_SNAKE_CASE and as const for global static constants | βœ… | | πŸ”§ | |
87
- | [no-async-array-filter](docs/rules/no-async-array-filter.md) | Disallow async callbacks in Array.filter() as they lead to incorrect filtering. Since async functions return Promises which are always truthy, the filter will keep all elements regardless of the async check's result. Use Promise.all() with map() first, then filter based on the resolved results. | βœ… | | | |
88
- | [no-async-foreach](docs/rules/no-async-foreach.md) | Disallow Array.forEach with an async callback function as it does not wait for promises to resolve. This can lead to race conditions and unexpected behavior. Use a standard for...of loop for sequential execution or Promise.all with map for concurrent execution. | βœ… | | | |
89
- | [no-class-instance-destructuring](docs/rules/no-class-instance-destructuring.md) | Disallow destructuring of class instances to prevent loss of `this` context | βœ… | | πŸ”§ | |
90
- | [no-complex-cloud-params](docs/rules/no-complex-cloud-params.md) | Disallow passing complex objects to cloud functions | βœ… | | | |
91
- | [no-compositing-layer-props](docs/rules/no-compositing-layer-props.md) | Warn when using CSS properties that trigger compositing layers, which can impact performance. Properties like transform, opacity, filter, and will-change create new GPU layers. While sometimes beneficial for animations, excessive layer creation can increase memory usage and hurt performance. Consider alternatives or explicitly document intentional layer promotion. | βœ… | | | |
92
- | [no-conditional-literals-in-jsx](docs/rules/no-conditional-literals-in-jsx.md) | Disallow use of conditional literals in JSX code | βœ… | | | |
93
- | [no-entire-object-hook-deps](docs/rules/no-entire-object-hook-deps.md) | Avoid using entire objects in React hook dependency arrays when only specific fields are used, as this can cause unnecessary re-renders. When a hook only uses obj.name but obj is in the deps array, any change to obj.age will trigger the hook. Use individual fields (obj.name) instead of the entire object. Requires TypeScript and `parserOptions.project` to be configured. | βœ… | | πŸ”§ | πŸ’­ |
94
- | [no-explicit-return-type](docs/rules/no-explicit-return-type.md) | Disallow explicit return type annotations on functions when TypeScript can infer them. This reduces code verbosity and maintenance burden while leveraging TypeScript's powerful type inference. Exceptions are made for type guard functions (using the `is` keyword), recursive functions, overloaded functions, interface methods, and abstract methods where explicit types improve clarity. | βœ… | | πŸ”§ | |
95
- | [no-filter-without-return](docs/rules/no-filter-without-return.md) | Disallow Array.filter callbacks without an explicit return (if part of a block statement) | βœ… | | | |
96
- | [no-firestore-object-arrays](docs/rules/no-firestore-object-arrays.md) | Disallow arrays of objects in Firestore type definitions to optimize performance and avoid unnecessary fetches | | βœ… | | |
97
- | [no-jsx-in-hooks](docs/rules/no-jsx-in-hooks.md) | Prevent hooks from returning JSX | βœ… | | | |
98
- | [no-jsx-whitespace-literal](docs/rules/no-jsx-whitespace-literal.md) | Disallow the use of {" "} elements in JSX code | βœ… | | | |
99
- | [no-memoize-on-static](docs/rules/no-memoize-on-static.md) | Prevent using @Memoize() decorator on static methods | βœ… | | | |
100
- | [no-misused-switch-case](docs/rules/no-misused-switch-case.md) | Prevent misuse of logical OR (\|\|) in switch case statements, which can lead to confusing and error-prone code. Instead of using OR operators in case expressions, use multiple case statements in sequence to handle multiple values. This improves code readability and follows the standard switch-case pattern. | βœ… | | | |
101
- | [no-mixed-firestore-transactions](docs/rules/no-mixed-firestore-transactions.md) | Prevent mixing transactional and non-transactional Firestore operations within a transaction | βœ… | | | |
102
- | [no-redundant-param-types](docs/rules/no-redundant-param-types.md) | Disallow redundant parameter type annotations | βœ… | | πŸ”§ | |
103
- | [no-unpinned-dependencies](docs/rules/no-unpinned-dependencies.md) | Enforces pinned dependencies | βœ… | | πŸ”§ | |
104
- | [no-unsafe-firestore-spread](docs/rules/no-unsafe-firestore-spread.md) | Prevent unsafe object/array spreads in Firestore updates | βœ… | | πŸ”§ | |
105
- | [no-unused-props](docs/rules/no-unused-props.md) | Detect unused props in React component type definitions | βœ… | | πŸ”§ | |
106
- | [no-useless-fragment](docs/rules/no-useless-fragment.md) | Prevent unnecessary use of React fragments | | | πŸ”§ | |
107
- | [prefer-batch-operations](docs/rules/prefer-batch-operations.md) | Enforce using setAll() and overwriteAll() instead of multiple set() or overwrite() calls | βœ… | | πŸ”§ | |
108
- | [prefer-fragment-shorthand](docs/rules/prefer-fragment-shorthand.md) | Prefer <> shorthand for <React.Fragment> | βœ… | | πŸ”§ | |
109
- | [prefer-settings-object](docs/rules/prefer-settings-object.md) | Enforce using a settings object for functions with multiple parameters | βœ… | | πŸ”§ | |
110
- | [prefer-type-over-interface](docs/rules/prefer-type-over-interface.md) | Prefer using type alias over interface | βœ… | | πŸ”§ | |
111
- | [require-dynamic-firebase-imports](docs/rules/require-dynamic-firebase-imports.md) | Enforce dynamic imports for Firebase dependencies | βœ… | | πŸ”§ | |
112
- | [require-https-error](docs/rules/require-https-error.md) | Enforce using proprietary HttpsError instead of throw new Error or firebase-admin HttpsError in functions/src | βœ… | | | |
113
- | [require-image-optimized](docs/rules/require-image-optimized.md) | Enforce using ImageOptimized component instead of next/image or img tags | βœ… | | πŸ”§ | |
114
- | [require-memo](docs/rules/require-memo.md) | React components must be memoized | βœ… | | πŸ”§ | |
115
- | [require-usememo-object-literals](docs/rules/require-usememo-object-literals.md) | Enforce using useMemo for inline object/array literals passed as props to JSX components to prevent unnecessary re-renders. When object/array literals are defined inline in JSX, they create new references on every render, causing child components to re-render even if the values haven't changed. Wrap them in useMemo to maintain referential equality. | βœ… | | | |
116
- | [semantic-function-prefixes](docs/rules/semantic-function-prefixes.md) | Enforce semantic function prefixes over generic ones like "get" and "update" | βœ… | | | |
117
- | [sync-onwrite-name-func](docs/rules/sync-onwrite-name-func.md) | Ensure that the name field matches the func field in onWrite handlers | βœ… | | πŸ”§ | |
118
- | [use-custom-link](docs/rules/use-custom-link.md) | Enforce using src/components/Link instead of next/link | βœ… | | πŸ”§ | |
119
- | [use-custom-memo](docs/rules/use-custom-memo.md) | Enforce using src/util/memo instead of React memo | βœ… | | πŸ”§ | |
120
- | [use-custom-router](docs/rules/use-custom-router.md) | Enforce using src/hooks/routing/useRouter instead of next/router | βœ… | | πŸ”§ | |
59
+ | NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  | Description | πŸ’Ό | πŸ”§ | πŸ’­ |
60
+ | :--------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------- | :- | :- | :- |
61
+ | [array-methods-this-context](docs/rules/array-methods-this-context.md) | Prevent misuse of Array methods in OOP | βœ… | | |
62
+ | [avoid-utils-directory](docs/rules/avoid-utils-directory.md) | Enforce using util/ instead of utils/ directory | βœ… | πŸ”§ | |
63
+ | [class-methods-read-top-to-bottom](docs/rules/class-methods-read-top-to-bottom.md) | Ensures classes read linearly from top to bottom. | βœ… | πŸ”§ | |
64
+ | [consistent-callback-naming](docs/rules/consistent-callback-naming.md) | Enforce consistent naming conventions for callback props and functions | βœ… | πŸ”§ | |
65
+ | [dynamic-https-errors](docs/rules/dynamic-https-errors.md) | Dynamic error details should only be in the third argument of the HttpsError constructor. The second argument is hashed to produce a unique id. | βœ… | | |
66
+ | [enforce-callable-types](docs/rules/enforce-callable-types.md) | Enforce Params and Response type exports in callable functions | βœ… | | |
67
+ | [enforce-callback-memo](docs/rules/enforce-callback-memo.md) | Enforce useCallback or useMemo for inline functions in JSX props | βœ… | | |
68
+ | [enforce-dynamic-firebase-imports](docs/rules/enforce-dynamic-firebase-imports.md) | Enforce dynamic importing for modules within the firebaseCloud directory | βœ… | | |
69
+ | [enforce-firestore-doc-ref-generic](docs/rules/enforce-firestore-doc-ref-generic.md) | Enforce generic argument for Firestore DocumentReference, CollectionReference and CollectionGroup | βœ… | | πŸ’­ |
70
+ | [enforce-firestore-path-utils](docs/rules/enforce-firestore-path-utils.md) | Enforce usage of utility functions for Firestore paths | βœ… | | |
71
+ | [enforce-identifiable-firestore-type](docs/rules/enforce-identifiable-firestore-type.md) | Enforce that Firestore type definitions extend Identifiable and match their folder name | βœ… | | |
72
+ | [enforce-mock-firestore](docs/rules/enforce-mock-firestore.md) | Enforce using mockFirestore over manual Firestore mocking | βœ… | | |
73
+ | [enforce-safe-stringify](docs/rules/enforce-safe-stringify.md) | Enforce using safe-stable-stringify instead of JSON.stringify | βœ… | πŸ”§ | |
74
+ | [export-if-in-doubt](docs/rules/export-if-in-doubt.md) | All top-level const definitions, type definitions, and functions should be exported | | | |
75
+ | [extract-global-constants](docs/rules/extract-global-constants.md) | Extract static constants and functions to the global scope when possible | βœ… | | |
76
+ | [generic-starts-with-t](docs/rules/generic-starts-with-t.md) | Enforce TypeScript generic types to start with T | βœ… | | |
77
+ | [global-const-style](docs/rules/global-const-style.md) | Enforce UPPER_SNAKE_CASE and as const for global static constants | βœ… | πŸ”§ | |
78
+ | [no-async-array-filter](docs/rules/no-async-array-filter.md) | Disallow async callbacks for Array.filter | βœ… | | |
79
+ | [no-async-foreach](docs/rules/no-async-foreach.md) | Disallow Array.forEach with an async callback function | βœ… | | |
80
+ | [no-compositing-layer-props](docs/rules/no-compositing-layer-props.md) | Warn when using CSS properties that trigger compositing layers | βœ… | | |
81
+ | [no-conditional-literals-in-jsx](docs/rules/no-conditional-literals-in-jsx.md) | Disallow use of conditional literals in JSX code | βœ… | | |
82
+ | [no-entire-object-hook-deps](docs/rules/no-entire-object-hook-deps.md) | Avoid using entire objects in React hook dependency arrays when only specific fields are used. Requires TypeScript and `parserOptions.project` to be configured. | βœ… | πŸ”§ | πŸ’­ |
83
+ | [no-filter-without-return](docs/rules/no-filter-without-return.md) | Disallow Array.filter callbacks without an explicit return (if part of a block statement) | βœ… | | |
84
+ | [no-jsx-whitespace-literal](docs/rules/no-jsx-whitespace-literal.md) | Disallow the use of {" "} elements in JSX code | βœ… | | |
85
+ | [no-misused-switch-case](docs/rules/no-misused-switch-case.md) | Prevent misuse of logical OR in switch case statements | βœ… | | |
86
+ | [no-unpinned-dependencies](docs/rules/no-unpinned-dependencies.md) | Enforces pinned dependencies | βœ… | πŸ”§ | |
87
+ | [no-unused-props](docs/rules/no-unused-props.md) | Detect unused props in React component type definitions | βœ… | πŸ”§ | |
88
+ | [no-useless-fragment](docs/rules/no-useless-fragment.md) | Prevent unnecessary use of React fragments | | πŸ”§ | |
89
+ | [prefer-fragment-shorthand](docs/rules/prefer-fragment-shorthand.md) | Prefer <> shorthand for <React.Fragment> | βœ… | πŸ”§ | |
90
+ | [prefer-type-over-interface](docs/rules/prefer-type-over-interface.md) | Prefer using type alias over interface | βœ… | πŸ”§ | |
91
+ | [require-dynamic-firebase-imports](docs/rules/require-dynamic-firebase-imports.md) | Enforce dynamic imports for Firebase dependencies | βœ… | πŸ”§ | |
92
+ | [require-https-error](docs/rules/require-https-error.md) | Enforce using proprietary HttpsError instead of throw new Error or firebase-admin HttpsError in functions/src | βœ… | | |
93
+ | [require-image-optimized](docs/rules/require-image-optimized.md) | Enforce using ImageOptimized component instead of next/image or img tags | βœ… | πŸ”§ | |
94
+ | [require-memo](docs/rules/require-memo.md) | React components must be memoized | βœ… | πŸ”§ | |
95
+ | [require-usememo-object-literals](docs/rules/require-usememo-object-literals.md) | Enforce using useMemo for inline object literals passed as props to JSX components | βœ… | | |
96
+ | [semantic-function-prefixes](docs/rules/semantic-function-prefixes.md) | Enforce semantic function prefixes over generic ones like "get" and "update" | βœ… | | |
97
+ | [use-custom-router](docs/rules/use-custom-router.md) | Enforce using src/hooks/routing/useRouter instead of next/router | βœ… | πŸ”§ | |
121
98
 
122
99
  <!-- end auto-generated rules list -->
package/lib/index.js CHANGED
@@ -70,10 +70,22 @@ const require_hooks_default_params_1 = require("./rules/require-hooks-default-pa
70
70
  const prefer_destructuring_no_class_1 = require("./rules/prefer-destructuring-no-class");
71
71
  const enforce_render_hits_memoization_1 = require("./rules/enforce-render-hits-memoization");
72
72
  const prefer_fragment_component_1 = require("./rules/prefer-fragment-component");
73
+ const react_usememo_should_be_component_1 = require("./rules/react-usememo-should-be-component");
74
+ const no_unnecessary_verb_suffix_1 = require("./rules/no-unnecessary-verb-suffix");
75
+ const enforce_assertSafe_object_key_1 = require("./rules/enforce-assertSafe-object-key");
76
+ const enforce_object_literal_as_const_1 = require("./rules/enforce-object-literal-as-const");
77
+ const enforce_positive_naming_1 = require("./rules/enforce-positive-naming");
78
+ const no_type_assertion_returns_1 = require("./rules/no-type-assertion-returns");
79
+ const prefer_utility_function_over_private_static_1 = require("./rules/prefer-utility-function-over-private-static");
80
+ const enforce_microdiff_1 = require("./rules/enforce-microdiff");
81
+ const enforce_timestamp_now_1 = require("./rules/enforce-timestamp-now");
82
+ const no_always_true_false_conditions_1 = require("./rules/no-always-true-false-conditions");
83
+ const enforce_props_argument_name_1 = require("./rules/enforce-props-argument-name");
84
+ const prefer_global_router_state_key_1 = require("./rules/prefer-global-router-state-key");
73
85
  module.exports = {
74
86
  meta: {
75
87
  name: '@blumintinc/eslint-plugin-blumint',
76
- version: '1.7.3',
88
+ version: '1.8.0',
77
89
  },
78
90
  parseOptions: {
79
91
  ecmaVersion: 2020,
@@ -149,6 +161,18 @@ module.exports = {
149
161
  '@blumintinc/blumint/prefer-destructuring-no-class': 'error',
150
162
  '@blumintinc/blumint/enforce-render-hits-memoization': 'error',
151
163
  '@blumintinc/blumint/prefer-fragment-component': 'error',
164
+ '@blumintinc/blumint/react-usememo-should-be-component': 'error',
165
+ '@blumintinc/blumint/no-unnecessary-verb-suffix': 'error',
166
+ '@blumintinc/blumint/enforce-assertSafe-object-key': 'error',
167
+ '@blumintinc/blumint/enforce-object-literal-as-const': 'error',
168
+ '@blumintinc/blumint/enforce-positive-naming': 'error',
169
+ '@blumintinc/blumint/no-type-assertion-returns': 'error',
170
+ '@blumintinc/blumint/prefer-utility-function-over-private-static': 'error',
171
+ '@blumintinc/blumint/enforce-microdiff': 'error',
172
+ '@blumintinc/blumint/enforce-timestamp-now': 'error',
173
+ '@blumintinc/blumint/no-always-true-false-conditions': 'error',
174
+ '@blumintinc/blumint/enforce-props-argument-name': 'error',
175
+ '@blumintinc/blumint/prefer-global-router-state-key': 'warn',
152
176
  },
153
177
  },
154
178
  },
@@ -220,6 +244,18 @@ module.exports = {
220
244
  'prefer-destructuring-no-class': prefer_destructuring_no_class_1.preferDestructuringNoClass,
221
245
  'enforce-render-hits-memoization': enforce_render_hits_memoization_1.enforceRenderHitsMemoization,
222
246
  'prefer-fragment-component': prefer_fragment_component_1.preferFragmentComponent,
247
+ 'react-usememo-should-be-component': react_usememo_should_be_component_1.reactUseMemoShouldBeComponent,
248
+ 'no-unnecessary-verb-suffix': no_unnecessary_verb_suffix_1.noUnnecessaryVerbSuffix,
249
+ 'enforce-assertSafe-object-key': enforce_assertSafe_object_key_1.enforceAssertSafeObjectKey,
250
+ 'enforce-object-literal-as-const': enforce_object_literal_as_const_1.enforceObjectLiteralAsConst,
251
+ 'enforce-positive-naming': enforce_positive_naming_1.enforcePositiveNaming,
252
+ 'no-type-assertion-returns': no_type_assertion_returns_1.noTypeAssertionReturns,
253
+ 'prefer-utility-function-over-private-static': prefer_utility_function_over_private_static_1.preferUtilityFunctionOverPrivateStatic,
254
+ 'enforce-microdiff': enforce_microdiff_1.enforceMicrodiff,
255
+ 'enforce-timestamp-now': enforce_timestamp_now_1.enforceTimestampNow,
256
+ 'no-always-true-false-conditions': no_always_true_false_conditions_1.noAlwaysTrueFalseConditions,
257
+ 'enforce-props-argument-name': enforce_props_argument_name_1.enforcePropsArgumentName,
258
+ 'prefer-global-router-state-key': prefer_global_router_state_key_1.preferGlobalRouterStateKey,
223
259
  },
224
260
  };
225
261
  //# sourceMappingURL=index.js.map
@@ -8,12 +8,12 @@ exports.enforceAssertThrows = (0, createRule_1.createRule)({
8
8
  meta: {
9
9
  type: 'problem',
10
10
  docs: {
11
- description: 'Enforce that functions with assert- prefix must throw an error',
11
+ description: 'Enforce that functions with assert- prefix must throw an error or call process.exit(1)',
12
12
  recommended: 'error',
13
13
  },
14
14
  schema: [],
15
15
  messages: {
16
- assertShouldThrow: 'Functions with assert- prefix must throw an error. Either rename the function or add a throw statement.',
16
+ assertShouldThrow: 'Functions with assert- prefix must throw an error or call process.exit(1). Either rename the function or add a throw/exit statement.',
17
17
  },
18
18
  },
19
19
  defaultOptions: [],
@@ -36,6 +36,32 @@ exports.enforceAssertThrows = (0, createRule_1.createRule)({
36
36
  }
37
37
  return false;
38
38
  }
39
+ function isProcessExit1(node) {
40
+ if (node.type === utils_1.AST_NODE_TYPES.CallExpression) {
41
+ const callee = node.callee;
42
+ if (callee.type === utils_1.AST_NODE_TYPES.MemberExpression &&
43
+ callee.object.type === utils_1.AST_NODE_TYPES.Identifier &&
44
+ callee.object.name === 'process' &&
45
+ callee.property.type === utils_1.AST_NODE_TYPES.Identifier &&
46
+ callee.property.name === 'exit') {
47
+ const args = node.arguments;
48
+ if (args.length === 1) {
49
+ const arg = args[0];
50
+ if (arg.type === utils_1.AST_NODE_TYPES.Literal && arg.value === 1) {
51
+ return true;
52
+ }
53
+ // Handle numeric literal 1 in different forms
54
+ if (arg.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
55
+ arg.operator === '+' &&
56
+ arg.argument.type === utils_1.AST_NODE_TYPES.Literal &&
57
+ arg.argument.value === 1) {
58
+ return true;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ return false;
64
+ }
39
65
  function hasThrowStatement(node) {
40
66
  let hasThrow = false;
41
67
  function walk(node) {
@@ -43,6 +69,13 @@ exports.enforceAssertThrows = (0, createRule_1.createRule)({
43
69
  hasThrow = true;
44
70
  return;
45
71
  }
72
+ // Check for process.exit(1)
73
+ if (node.type === utils_1.AST_NODE_TYPES.ExpressionStatement) {
74
+ if (isProcessExit1(node.expression)) {
75
+ hasThrow = true;
76
+ return;
77
+ }
78
+ }
46
79
  // Check for assertion function calls
47
80
  if (isAssertionCall(node)) {
48
81
  hasThrow = true;
@@ -56,8 +89,20 @@ exports.enforceAssertThrows = (0, createRule_1.createRule)({
56
89
  return;
57
90
  }
58
91
  }
59
- // Don't count throws in catch blocks that are just re-throwing
92
+ // Check catch blocks for process.exit(1)
60
93
  if (node.type === utils_1.AST_NODE_TYPES.CatchClause) {
94
+ walk(node.body);
95
+ return;
96
+ }
97
+ // Handle TryStatement specially
98
+ if (node.type === utils_1.AST_NODE_TYPES.TryStatement) {
99
+ walk(node.block);
100
+ if (node.handler) {
101
+ walk(node.handler);
102
+ }
103
+ if (node.finalizer) {
104
+ walk(node.finalizer);
105
+ }
61
106
  return;
62
107
  }
63
108
  // Handle BlockStatement specially
@@ -0,0 +1,2 @@
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
+ export declare const enforceAssertSafeObjectKey: TSESLint.RuleModule<"useAssertSafe", [], TSESLint.RuleListener>;