@blumintinc/eslint-plugin-blumint 1.7.3 → 1.8.1
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/README.md +83 -61
- package/lib/index.js +85 -1
- package/lib/rules/enforce-assert-throws.js +48 -3
- package/lib/rules/enforce-assertSafe-object-key.d.ts +2 -0
- package/lib/rules/enforce-assertSafe-object-key.js +284 -0
- package/lib/rules/enforce-centralized-mock-firestore.js +192 -14
- package/lib/rules/enforce-css-media-queries.d.ts +5 -0
- package/lib/rules/enforce-css-media-queries.js +87 -0
- package/lib/rules/enforce-dynamic-imports.d.ts +9 -0
- package/lib/rules/enforce-dynamic-imports.js +84 -0
- package/lib/rules/enforce-firestore-facade.js +8 -0
- package/lib/rules/enforce-id-capitalization.d.ts +6 -0
- package/lib/rules/enforce-id-capitalization.js +78 -0
- package/lib/rules/enforce-microdiff.d.ts +3 -0
- package/lib/rules/enforce-microdiff.js +379 -0
- package/lib/rules/enforce-mui-rounded-icons.d.ts +1 -0
- package/lib/rules/enforce-mui-rounded-icons.js +54 -0
- package/lib/rules/enforce-object-literal-as-const.d.ts +4 -0
- package/lib/rules/enforce-object-literal-as-const.js +88 -0
- package/lib/rules/enforce-positive-naming.d.ts +1 -0
- package/lib/rules/enforce-positive-naming.js +387 -0
- package/lib/rules/enforce-props-argument-name.d.ts +8 -0
- package/lib/rules/enforce-props-argument-name.js +182 -0
- package/lib/rules/enforce-react-type-naming.d.ts +3 -0
- package/lib/rules/enforce-react-type-naming.js +191 -0
- package/lib/rules/enforce-render-hits-memoization.js +155 -26
- package/lib/rules/enforce-singular-type-names.d.ts +2 -0
- package/lib/rules/enforce-singular-type-names.js +112 -0
- package/lib/rules/enforce-timestamp-now.d.ts +1 -0
- package/lib/rules/enforce-timestamp-now.js +223 -0
- package/lib/rules/enforce-verb-noun-naming.js +5 -2
- package/lib/rules/ensure-pointer-events-none.d.ts +1 -0
- package/lib/rules/ensure-pointer-events-none.js +211 -0
- package/lib/rules/extract-global-constants.d.ts +1 -1
- package/lib/rules/extract-global-constants.js +109 -1
- package/lib/rules/global-const-style.js +3 -2
- package/lib/rules/key-only-outermost-element.d.ts +3 -0
- package/lib/rules/key-only-outermost-element.js +152 -0
- package/lib/rules/no-always-true-false-conditions.d.ts +3 -0
- package/lib/rules/no-always-true-false-conditions.js +1221 -0
- package/lib/rules/no-circular-references.d.ts +1 -0
- package/lib/rules/no-circular-references.js +523 -0
- package/lib/rules/no-firestore-jest-mock.js +27 -4
- package/lib/rules/no-hungarian.d.ts +5 -0
- package/lib/rules/no-hungarian.js +223 -0
- package/lib/rules/no-mock-firebase-admin.js +20 -7
- package/lib/rules/no-object-values-on-strings.d.ts +2 -0
- package/lib/rules/no-object-values-on-strings.js +294 -0
- package/lib/rules/no-type-assertion-returns.d.ts +9 -0
- package/lib/rules/no-type-assertion-returns.js +299 -0
- package/lib/rules/no-unnecessary-destructuring.d.ts +5 -0
- package/lib/rules/no-unnecessary-destructuring.js +69 -0
- package/lib/rules/no-unnecessary-verb-suffix.d.ts +1 -0
- package/lib/rules/no-unnecessary-verb-suffix.js +203 -0
- package/lib/rules/no-unused-props.js +10 -5
- package/lib/rules/no-unused-usestate.d.ts +8 -0
- package/lib/rules/no-unused-usestate.js +84 -0
- package/lib/rules/omit-index-html.d.ts +7 -0
- package/lib/rules/omit-index-html.js +91 -0
- package/lib/rules/prefer-clone-deep.js +294 -22
- package/lib/rules/prefer-fragment-component.js +265 -34
- package/lib/rules/prefer-global-router-state-key.d.ts +5 -0
- package/lib/rules/prefer-global-router-state-key.js +89 -0
- package/lib/rules/prefer-usememo-over-useeffect-usestate.d.ts +5 -0
- package/lib/rules/prefer-usememo-over-useeffect-usestate.js +129 -0
- package/lib/rules/prefer-utility-function-over-private-static.d.ts +1 -0
- package/lib/rules/prefer-utility-function-over-private-static.js +77 -0
- package/lib/rules/react-usememo-should-be-component.d.ts +1 -0
- package/lib/rules/react-usememo-should-be-component.js +623 -0
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -57,66 +57,88 @@ Or use the recommended config:
|
|
|
57
57
|
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
58
58
|
💭 Requires [type information](https://typescript-eslint.io/linting/typed-linting).
|
|
59
59
|
|
|
60
|
-
| Name
|
|
61
|
-
|
|
|
62
|
-
| [array-methods-this-context](docs/rules/array-methods-this-context.md)
|
|
63
|
-
| [avoid-utils-directory](docs/rules/avoid-utils-directory.md)
|
|
64
|
-
| [class-methods-read-top-to-bottom](docs/rules/class-methods-read-top-to-bottom.md)
|
|
65
|
-
| [consistent-callback-naming](docs/rules/consistent-callback-naming.md)
|
|
66
|
-
| [dynamic-https-errors](docs/rules/dynamic-https-errors.md)
|
|
67
|
-
| [enforce-assert-throws](docs/rules/enforce-assert-throws.md)
|
|
68
|
-
| [enforce-
|
|
69
|
-
| [enforce-
|
|
70
|
-
| [enforce-
|
|
71
|
-
| [enforce-
|
|
72
|
-
| [enforce-
|
|
73
|
-
| [enforce-
|
|
74
|
-
| [enforce-firestore-
|
|
75
|
-
| [enforce-firestore-
|
|
76
|
-
| [enforce-
|
|
77
|
-
| [enforce-
|
|
78
|
-
| [enforce-
|
|
79
|
-
| [enforce-
|
|
80
|
-
| [enforce-
|
|
81
|
-
| [enforce-
|
|
82
|
-
| [enforce-
|
|
83
|
-
| [
|
|
84
|
-
| [
|
|
85
|
-
| [
|
|
86
|
-
| [
|
|
87
|
-
| [
|
|
88
|
-
| [
|
|
89
|
-
| [
|
|
90
|
-
| [
|
|
91
|
-
| [
|
|
92
|
-
| [
|
|
93
|
-
| [
|
|
94
|
-
| [
|
|
95
|
-
| [no-
|
|
96
|
-
| [no-
|
|
97
|
-
| [no-
|
|
98
|
-
| [no-
|
|
99
|
-
| [no-
|
|
100
|
-
| [no-
|
|
101
|
-
| [no-
|
|
102
|
-
| [no-
|
|
103
|
-
| [no-
|
|
104
|
-
| [no-
|
|
105
|
-
| [no-
|
|
106
|
-
| [no-
|
|
107
|
-
| [
|
|
108
|
-
| [
|
|
109
|
-
| [
|
|
110
|
-
| [
|
|
111
|
-
| [
|
|
112
|
-
| [
|
|
113
|
-
| [
|
|
114
|
-
| [
|
|
115
|
-
| [
|
|
116
|
-
| [
|
|
117
|
-
| [
|
|
118
|
-
| [
|
|
119
|
-
| [
|
|
120
|
-
| [
|
|
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 or call process.exit(1) | ✅ | | | |
|
|
68
|
+
| [enforce-assertSafe-object-key](docs/rules/enforce-assertSafe-object-key.md) | Enforce the use of assertSafe(id) when accessing object properties with computed keys that involve string interpolation or explicit string conversion. | ✅ | | 🔧 | |
|
|
69
|
+
| [enforce-callable-types](docs/rules/enforce-callable-types.md) | Enforce Params and Response type exports in callable functions | ✅ | | | |
|
|
70
|
+
| [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. | ✅ | | | |
|
|
71
|
+
| [enforce-centralized-mock-firestore](docs/rules/enforce-centralized-mock-firestore.md) | Enforce usage of centralized mockFirestore from predefined location | ✅ | | 🔧 | |
|
|
72
|
+
| [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. | ✅ | | | |
|
|
73
|
+
| [enforce-exported-function-types](docs/rules/enforce-exported-function-types.md) | Enforce exporting types for function props and return values | ✅ | | | |
|
|
74
|
+
| [enforce-firestore-doc-ref-generic](docs/rules/enforce-firestore-doc-ref-generic.md) | Enforce generic argument for Firestore DocumentReference, CollectionReference and CollectionGroup | ✅ | | | 💭 |
|
|
75
|
+
| [enforce-firestore-facade](docs/rules/enforce-firestore-facade.md) | Enforce usage of Firestore facades instead of direct Firestore methods | ✅ | | | |
|
|
76
|
+
| [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. | ✅ | | | |
|
|
77
|
+
| [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. | ✅ | | 🔧 | |
|
|
78
|
+
| [enforce-identifiable-firestore-type](docs/rules/enforce-identifiable-firestore-type.md) | Enforce that Firestore type definitions extend Identifiable and match their folder name | ✅ | | | |
|
|
79
|
+
| [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. | ✅ | | 🔧 | |
|
|
80
|
+
| [enforce-microdiff](docs/rules/enforce-microdiff.md) | Enforce using microdiff for object and array comparison operations | ✅ | | 🔧 | |
|
|
81
|
+
| [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. | ✅ | | | |
|
|
82
|
+
| [enforce-object-literal-as-const](docs/rules/enforce-object-literal-as-const.md) | Enforce that object literals returned from functions should be marked with `as const` to ensure type safety and immutability. | ✅ | | 🔧 | |
|
|
83
|
+
| [enforce-positive-naming](docs/rules/enforce-positive-naming.md) | Enforce positive variable naming patterns and avoid negative naming | ✅ | | | |
|
|
84
|
+
| [enforce-props-argument-name](docs/rules/enforce-props-argument-name.md) | Enforce using "Props" suffix in type names for parameter objects | ✅ | | 🔧 | |
|
|
85
|
+
| [enforce-realtimedb-path-utils](docs/rules/enforce-realtimedb-path-utils.md) | Enforce usage of utility functions for Realtime Database paths | ✅ | | | |
|
|
86
|
+
| [enforce-render-hits-memoization](docs/rules/enforce-render-hits-memoization.md) | Enforce proper memoization and usage of useRenderHits and renderHits | ✅ | | | |
|
|
87
|
+
| [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. | ✅ | | 🔧 | |
|
|
88
|
+
| [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). | ✅ | | | |
|
|
89
|
+
| [enforce-timestamp-now](docs/rules/enforce-timestamp-now.md) | Enforce the use of Timestamp.now() for getting the current timestamp in backend code. This rule prevents using alternatives like Timestamp.fromDate(new Date()) or other date creation patterns that could lead to inconsistency. | ✅ | | 🔧 | |
|
|
90
|
+
| [enforce-verb-noun-naming](docs/rules/enforce-verb-noun-naming.md) | Enforce verb phrases for functions and methods | ✅ | | | |
|
|
91
|
+
| [export-if-in-doubt](docs/rules/export-if-in-doubt.md) | All top-level const definitions, type definitions, and functions should be exported | | | | |
|
|
92
|
+
| [extract-global-constants](docs/rules/extract-global-constants.md) | Extract static constants and functions to the global scope when possible, and enforce type narrowing with as const for numeric literals in loops | ✅ | | | |
|
|
93
|
+
| [generic-starts-with-t](docs/rules/generic-starts-with-t.md) | Enforce TypeScript generic types to start with T | ✅ | | | |
|
|
94
|
+
| [global-const-style](docs/rules/global-const-style.md) | Enforce UPPER_SNAKE_CASE and as const for global static constants | ✅ | | 🔧 | |
|
|
95
|
+
| [no-always-true-false-conditions](docs/rules/no-always-true-false-conditions.md) | Detect conditions that are always truthy or always falsy | ✅ | | | |
|
|
96
|
+
| [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. | ✅ | | | |
|
|
97
|
+
| [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. | ✅ | | | |
|
|
98
|
+
| [no-class-instance-destructuring](docs/rules/no-class-instance-destructuring.md) | Disallow destructuring of class instances to prevent loss of `this` context | ✅ | | 🔧 | |
|
|
99
|
+
| [no-complex-cloud-params](docs/rules/no-complex-cloud-params.md) | Disallow passing complex objects to cloud functions | ✅ | | | |
|
|
100
|
+
| [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. | ✅ | | | |
|
|
101
|
+
| [no-conditional-literals-in-jsx](docs/rules/no-conditional-literals-in-jsx.md) | Disallow use of conditional literals in JSX code | ✅ | | | |
|
|
102
|
+
| [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. | ✅ | | 🔧 | 💭 |
|
|
103
|
+
| [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. | ✅ | | 🔧 | |
|
|
104
|
+
| [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) | ✅ | | | |
|
|
105
|
+
| [no-firestore-jest-mock](docs/rules/no-firestore-jest-mock.md) | Prevent importing firestore-jest-mock in test files | ✅ | | 🔧 | |
|
|
106
|
+
| [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 | | ✅ | | |
|
|
107
|
+
| [no-hungarian](docs/rules/no-hungarian.md) | Disallow Hungarian notation in variable names | ✅ | | 🔧 | |
|
|
108
|
+
| [no-jsx-in-hooks](docs/rules/no-jsx-in-hooks.md) | Prevent hooks from returning JSX | ✅ | | | |
|
|
109
|
+
| [no-jsx-whitespace-literal](docs/rules/no-jsx-whitespace-literal.md) | Disallow the use of {" "} elements in JSX code | ✅ | | | |
|
|
110
|
+
| [no-memoize-on-static](docs/rules/no-memoize-on-static.md) | Prevent using @Memoize() decorator on static methods | ✅ | | | |
|
|
111
|
+
| [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. | ✅ | | | |
|
|
112
|
+
| [no-mixed-firestore-transactions](docs/rules/no-mixed-firestore-transactions.md) | Prevent mixing transactional and non-transactional Firestore operations within a transaction | ✅ | | | |
|
|
113
|
+
| [no-mock-firebase-admin](docs/rules/no-mock-firebase-admin.md) | Prevent mocking of functions/src/config/firebaseAdmin | ✅ | | | |
|
|
114
|
+
| [no-redundant-param-types](docs/rules/no-redundant-param-types.md) | Disallow redundant parameter type annotations | ✅ | | 🔧 | |
|
|
115
|
+
| [no-type-assertion-returns](docs/rules/no-type-assertion-returns.md) | Enforce typing variables before returning them, rather than using type assertions or explicit return types | ✅ | | 🔧 | |
|
|
116
|
+
| [no-unnecessary-verb-suffix](docs/rules/no-unnecessary-verb-suffix.md) | Prevent unnecessary verb suffixes in function and method names | ✅ | | 🔧 | |
|
|
117
|
+
| [no-unpinned-dependencies](docs/rules/no-unpinned-dependencies.md) | Enforces pinned dependencies | ✅ | | 🔧 | |
|
|
118
|
+
| [no-unsafe-firestore-spread](docs/rules/no-unsafe-firestore-spread.md) | Prevent unsafe object/array spreads in Firestore updates | ✅ | | 🔧 | |
|
|
119
|
+
| [no-unused-props](docs/rules/no-unused-props.md) | Detect unused props in React component type definitions | ✅ | | 🔧 | |
|
|
120
|
+
| [no-unused-usestate](docs/rules/no-unused-usestate.md) | Disallow unused useState hooks | ✅ | | 🔧 | |
|
|
121
|
+
| [no-useless-fragment](docs/rules/no-useless-fragment.md) | Prevent unnecessary use of React fragments | | | 🔧 | |
|
|
122
|
+
| [prefer-batch-operations](docs/rules/prefer-batch-operations.md) | Enforce using setAll() and overwriteAll() instead of multiple set() or overwrite() calls | ✅ | | 🔧 | |
|
|
123
|
+
| [prefer-clone-deep](docs/rules/prefer-clone-deep.md) | Prefer using cloneDeep over nested spread copying | ✅ | | 🔧 | |
|
|
124
|
+
| [prefer-destructuring-no-class](docs/rules/prefer-destructuring-no-class.md) | Enforce destructuring when accessing object properties, except for class instances | ✅ | | 🔧 | |
|
|
125
|
+
| [prefer-fragment-component](docs/rules/prefer-fragment-component.md) | Enforce using Fragment imported from react over shorthand fragments and React.Fragment | ✅ | | 🔧 | |
|
|
126
|
+
| [prefer-fragment-shorthand](docs/rules/prefer-fragment-shorthand.md) | Prefer <> shorthand for <React.Fragment> | | | 🔧 | |
|
|
127
|
+
| [prefer-global-router-state-key](docs/rules/prefer-global-router-state-key.md) | Enforce using global constants or type-safe functions for useRouterState key parameter | | ✅ | | |
|
|
128
|
+
| [prefer-settings-object](docs/rules/prefer-settings-object.md) | Enforce using a settings object for functions with multiple parameters | ✅ | | 🔧 | |
|
|
129
|
+
| [prefer-type-over-interface](docs/rules/prefer-type-over-interface.md) | Prefer using type alias over interface | ✅ | | 🔧 | |
|
|
130
|
+
| [prefer-utility-function-over-private-static](docs/rules/prefer-utility-function-over-private-static.md) | Enforce abstraction of private static methods into utility functions | ✅ | | | |
|
|
131
|
+
| [react-usememo-should-be-component](docs/rules/react-usememo-should-be-component.md) | Enforce that useMemo hooks returning React nodes should be abstracted into separate React components | ✅ | | | |
|
|
132
|
+
| [require-dynamic-firebase-imports](docs/rules/require-dynamic-firebase-imports.md) | Enforce dynamic imports for Firebase dependencies | ✅ | | 🔧 | |
|
|
133
|
+
| [require-hooks-default-params](docs/rules/require-hooks-default-params.md) | Enforce React hooks with optional parameters to default to an empty object | ✅ | | 🔧 | |
|
|
134
|
+
| [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 | ✅ | | | |
|
|
135
|
+
| [require-image-optimized](docs/rules/require-image-optimized.md) | Enforce using ImageOptimized component instead of next/image or img tags | ✅ | | 🔧 | |
|
|
136
|
+
| [require-memo](docs/rules/require-memo.md) | React components must be memoized | ✅ | | 🔧 | |
|
|
137
|
+
| [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. | ✅ | | | |
|
|
138
|
+
| [semantic-function-prefixes](docs/rules/semantic-function-prefixes.md) | Enforce semantic function prefixes over generic ones like "get" and "update" | ✅ | | | |
|
|
139
|
+
| [sync-onwrite-name-func](docs/rules/sync-onwrite-name-func.md) | Ensure that the name field matches the func field in onWrite handlers | ✅ | | 🔧 | |
|
|
140
|
+
| [use-custom-link](docs/rules/use-custom-link.md) | Enforce using src/components/Link instead of next/link | ✅ | | 🔧 | |
|
|
141
|
+
| [use-custom-memo](docs/rules/use-custom-memo.md) | Enforce using src/util/memo instead of React memo | ✅ | | 🔧 | |
|
|
142
|
+
| [use-custom-router](docs/rules/use-custom-router.md) | Enforce using src/hooks/routing/useRouter instead of next/router | ✅ | | 🔧 | |
|
|
121
143
|
|
|
122
144
|
<!-- end auto-generated rules list -->
|
package/lib/index.js
CHANGED
|
@@ -11,6 +11,8 @@ const enforce_identifiable_firestore_type_1 = require("./rules/enforce-identifia
|
|
|
11
11
|
const enforce_callback_memo_1 = __importDefault(require("./rules/enforce-callback-memo"));
|
|
12
12
|
const enforce_callable_types_1 = require("./rules/enforce-callable-types");
|
|
13
13
|
const enforce_dynamic_firebase_imports_1 = require("./rules/enforce-dynamic-firebase-imports");
|
|
14
|
+
const enforce_mui_rounded_icons_1 = require("./rules/enforce-mui-rounded-icons");
|
|
15
|
+
const enforce_react_type_naming_1 = require("./rules/enforce-react-type-naming");
|
|
14
16
|
const export_if_in_doubt_1 = require("./rules/export-if-in-doubt");
|
|
15
17
|
const extract_global_constants_1 = require("./rules/extract-global-constants");
|
|
16
18
|
const generic_starts_with_t_1 = require("./rules/generic-starts-with-t");
|
|
@@ -19,6 +21,7 @@ const no_async_array_filter_1 = require("./rules/no-async-array-filter");
|
|
|
19
21
|
const no_async_foreach_1 = require("./rules/no-async-foreach");
|
|
20
22
|
const no_conditional_literals_in_jsx_1 = require("./rules/no-conditional-literals-in-jsx");
|
|
21
23
|
const no_filter_without_return_1 = require("./rules/no-filter-without-return");
|
|
24
|
+
const no_hungarian_1 = require("./rules/no-hungarian");
|
|
22
25
|
const no_misused_switch_case_1 = require("./rules/no-misused-switch-case");
|
|
23
26
|
const no_unpinned_dependencies_1 = require("./rules/no-unpinned-dependencies");
|
|
24
27
|
const no_unused_props_1 = require("./rules/no-unused-props");
|
|
@@ -70,10 +73,33 @@ const require_hooks_default_params_1 = require("./rules/require-hooks-default-pa
|
|
|
70
73
|
const prefer_destructuring_no_class_1 = require("./rules/prefer-destructuring-no-class");
|
|
71
74
|
const enforce_render_hits_memoization_1 = require("./rules/enforce-render-hits-memoization");
|
|
72
75
|
const prefer_fragment_component_1 = require("./rules/prefer-fragment-component");
|
|
76
|
+
const react_usememo_should_be_component_1 = require("./rules/react-usememo-should-be-component");
|
|
77
|
+
const no_unnecessary_verb_suffix_1 = require("./rules/no-unnecessary-verb-suffix");
|
|
78
|
+
const enforce_assertSafe_object_key_1 = require("./rules/enforce-assertSafe-object-key");
|
|
79
|
+
const enforce_object_literal_as_const_1 = require("./rules/enforce-object-literal-as-const");
|
|
80
|
+
const enforce_positive_naming_1 = require("./rules/enforce-positive-naming");
|
|
81
|
+
const no_type_assertion_returns_1 = require("./rules/no-type-assertion-returns");
|
|
82
|
+
const prefer_utility_function_over_private_static_1 = require("./rules/prefer-utility-function-over-private-static");
|
|
83
|
+
const enforce_microdiff_1 = require("./rules/enforce-microdiff");
|
|
84
|
+
const enforce_timestamp_now_1 = require("./rules/enforce-timestamp-now");
|
|
85
|
+
const no_always_true_false_conditions_1 = require("./rules/no-always-true-false-conditions");
|
|
86
|
+
const enforce_props_argument_name_1 = require("./rules/enforce-props-argument-name");
|
|
87
|
+
const prefer_global_router_state_key_1 = require("./rules/prefer-global-router-state-key");
|
|
88
|
+
const prefer_usememo_over_useeffect_usestate_1 = require("./rules/prefer-usememo-over-useeffect-usestate");
|
|
89
|
+
const enforce_dynamic_imports_1 = __importDefault(require("./rules/enforce-dynamic-imports"));
|
|
90
|
+
const ensure_pointer_events_none_1 = require("./rules/ensure-pointer-events-none");
|
|
91
|
+
const no_object_values_on_strings_1 = require("./rules/no-object-values-on-strings");
|
|
92
|
+
const key_only_outermost_element_1 = require("./rules/key-only-outermost-element");
|
|
93
|
+
const no_unnecessary_destructuring_1 = require("./rules/no-unnecessary-destructuring");
|
|
94
|
+
const enforce_singular_type_names_1 = require("./rules/enforce-singular-type-names");
|
|
95
|
+
const enforce_css_media_queries_1 = require("./rules/enforce-css-media-queries");
|
|
96
|
+
const omit_index_html_1 = require("./rules/omit-index-html");
|
|
97
|
+
const enforce_id_capitalization_1 = require("./rules/enforce-id-capitalization");
|
|
98
|
+
const no_unused_usestate_1 = require("./rules/no-unused-usestate");
|
|
73
99
|
module.exports = {
|
|
74
100
|
meta: {
|
|
75
101
|
name: '@blumintinc/eslint-plugin-blumint',
|
|
76
|
-
version: '1.
|
|
102
|
+
version: '1.8.1',
|
|
77
103
|
},
|
|
78
104
|
parseOptions: {
|
|
79
105
|
ecmaVersion: 2020,
|
|
@@ -82,6 +108,7 @@ module.exports = {
|
|
|
82
108
|
recommended: {
|
|
83
109
|
plugins: ['@blumintinc/blumint'],
|
|
84
110
|
rules: {
|
|
111
|
+
'@blumintinc/blumint/key-only-outermost-element': 'error',
|
|
85
112
|
'@blumintinc/blumint/avoid-utils-directory': 'error',
|
|
86
113
|
'@blumintinc/blumint/enforce-firestore-path-utils': 'error',
|
|
87
114
|
'@blumintinc/blumint/no-jsx-whitespace-literal': 'error',
|
|
@@ -89,10 +116,12 @@ module.exports = {
|
|
|
89
116
|
'@blumintinc/blumint/class-methods-read-top-to-bottom': 'error',
|
|
90
117
|
'@blumintinc/blumint/consistent-callback-naming': 'error',
|
|
91
118
|
'@blumintinc/blumint/dynamic-https-errors': 'error',
|
|
119
|
+
'@blumintinc/blumint/enforce-mui-rounded-icons': 'error',
|
|
92
120
|
'@blumintinc/blumint/enforce-identifiable-firestore-type': 'error',
|
|
93
121
|
'@blumintinc/blumint/enforce-callback-memo': 'error',
|
|
94
122
|
'@blumintinc/blumint/enforce-callable-types': 'error',
|
|
95
123
|
'@blumintinc/blumint/enforce-dynamic-firebase-imports': 'error',
|
|
124
|
+
'@blumintinc/blumint/enforce-react-type-naming': 'error',
|
|
96
125
|
// '@blumintinc/blumint/export-if-in-doubt': 'warn',
|
|
97
126
|
'@blumintinc/blumint/extract-global-constants': 'error',
|
|
98
127
|
'@blumintinc/blumint/generic-starts-with-t': 'error',
|
|
@@ -101,6 +130,7 @@ module.exports = {
|
|
|
101
130
|
'@blumintinc/blumint/no-async-foreach': 'error',
|
|
102
131
|
'@blumintinc/blumint/no-conditional-literals-in-jsx': 'error',
|
|
103
132
|
'@blumintinc/blumint/no-filter-without-return': 'error',
|
|
133
|
+
'@blumintinc/blumint/no-hungarian': 'error',
|
|
104
134
|
'@blumintinc/blumint/no-misused-switch-case': 'error',
|
|
105
135
|
'@blumintinc/blumint/no-unpinned-dependencies': 'error',
|
|
106
136
|
'@blumintinc/blumint/no-unused-props': 'error',
|
|
@@ -149,18 +179,49 @@ module.exports = {
|
|
|
149
179
|
'@blumintinc/blumint/prefer-destructuring-no-class': 'error',
|
|
150
180
|
'@blumintinc/blumint/enforce-render-hits-memoization': 'error',
|
|
151
181
|
'@blumintinc/blumint/prefer-fragment-component': 'error',
|
|
182
|
+
'@blumintinc/blumint/react-usememo-should-be-component': 'error',
|
|
183
|
+
'@blumintinc/blumint/no-unnecessary-verb-suffix': 'error',
|
|
184
|
+
'@blumintinc/blumint/enforce-assertSafe-object-key': 'error',
|
|
185
|
+
'@blumintinc/blumint/enforce-object-literal-as-const': 'error',
|
|
186
|
+
'@blumintinc/blumint/enforce-positive-naming': 'error',
|
|
187
|
+
'@blumintinc/blumint/no-type-assertion-returns': 'error',
|
|
188
|
+
'@blumintinc/blumint/prefer-utility-function-over-private-static': 'error',
|
|
189
|
+
'@blumintinc/blumint/enforce-microdiff': 'error',
|
|
190
|
+
'@blumintinc/blumint/enforce-timestamp-now': 'error',
|
|
191
|
+
'@blumintinc/blumint/no-always-true-false-conditions': 'error',
|
|
192
|
+
'@blumintinc/blumint/enforce-props-argument-name': 'error',
|
|
193
|
+
'@blumintinc/blumint/prefer-global-router-state-key': 'error',
|
|
194
|
+
'@blumintinc/blumint/prefer-usememo-over-useeffect-usestate': 'error',
|
|
195
|
+
'@blumintinc/blumint/enforce-dynamic-imports': [
|
|
196
|
+
'error',
|
|
197
|
+
{
|
|
198
|
+
libraries: ['@stream-io/video-react-sdk', 'some-heavy-lib*'],
|
|
199
|
+
allowImportType: true,
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
'@blumintinc/blumint/ensure-pointer-events-none': 'error',
|
|
203
|
+
'@blumintinc/blumint/no-object-values-on-strings': 'error',
|
|
204
|
+
'@blumintinc/blumint/no-unnecessary-destructuring': 'error',
|
|
205
|
+
'@blumintinc/blumint/enforce-singular-type-names': 'error',
|
|
206
|
+
'@blumintinc/blumint/enforce-css-media-queries': 'error',
|
|
207
|
+
'@blumintinc/blumint/omit-index-html': 'error',
|
|
208
|
+
'@blumintinc/blumint/enforce-id-capitalization': 'error',
|
|
209
|
+
'@blumintinc/blumint/no-unused-usestate': 'error',
|
|
152
210
|
},
|
|
153
211
|
},
|
|
154
212
|
},
|
|
155
213
|
rules: {
|
|
214
|
+
'key-only-outermost-element': key_only_outermost_element_1.keyOnlyOutermostElement,
|
|
156
215
|
'array-methods-this-context': array_methods_this_context_1.arrayMethodsThisContext,
|
|
157
216
|
'class-methods-read-top-to-bottom': class_methods_read_top_to_bottom_1.classMethodsReadTopToBottom,
|
|
158
217
|
'consistent-callback-naming': consistent_callback_naming_1.default,
|
|
159
218
|
'dynamic-https-errors': dynamic_https_errors_1.dynamicHttpsErrors,
|
|
160
219
|
'enforce-identifiable-firestore-type': enforce_identifiable_firestore_type_1.enforceIdentifiableFirestoreType,
|
|
161
220
|
'enforce-callback-memo': enforce_callback_memo_1.default,
|
|
221
|
+
'enforce-react-type-naming': enforce_react_type_naming_1.enforceReactTypeNaming,
|
|
162
222
|
'enforce-callable-types': enforce_callable_types_1.enforceCallableTypes,
|
|
163
223
|
'enforce-dynamic-firebase-imports': enforce_dynamic_firebase_imports_1.enforceFirebaseImports,
|
|
224
|
+
'enforce-mui-rounded-icons': enforce_mui_rounded_icons_1.enforceMuiRoundedIcons,
|
|
164
225
|
'export-if-in-doubt': export_if_in_doubt_1.exportIfInDoubt,
|
|
165
226
|
'extract-global-constants': extract_global_constants_1.extractGlobalConstants,
|
|
166
227
|
'generic-starts-with-t': generic_starts_with_t_1.genericStartsWithT,
|
|
@@ -169,6 +230,7 @@ module.exports = {
|
|
|
169
230
|
'no-async-foreach': no_async_foreach_1.noAsyncForEach,
|
|
170
231
|
'no-conditional-literals-in-jsx': no_conditional_literals_in_jsx_1.noConditionalLiteralsInJsx,
|
|
171
232
|
'no-filter-without-return': no_filter_without_return_1.noFilterWithoutReturn,
|
|
233
|
+
'no-hungarian': no_hungarian_1.noHungarian,
|
|
172
234
|
'no-misused-switch-case': no_misused_switch_case_1.noMisusedSwitchCase,
|
|
173
235
|
'no-unpinned-dependencies': no_unpinned_dependencies_1.noUnpinnedDependencies,
|
|
174
236
|
'no-unused-props': no_unused_props_1.noUnusedProps,
|
|
@@ -220,6 +282,28 @@ module.exports = {
|
|
|
220
282
|
'prefer-destructuring-no-class': prefer_destructuring_no_class_1.preferDestructuringNoClass,
|
|
221
283
|
'enforce-render-hits-memoization': enforce_render_hits_memoization_1.enforceRenderHitsMemoization,
|
|
222
284
|
'prefer-fragment-component': prefer_fragment_component_1.preferFragmentComponent,
|
|
285
|
+
'react-usememo-should-be-component': react_usememo_should_be_component_1.reactUseMemoShouldBeComponent,
|
|
286
|
+
'no-unnecessary-verb-suffix': no_unnecessary_verb_suffix_1.noUnnecessaryVerbSuffix,
|
|
287
|
+
'enforce-assertSafe-object-key': enforce_assertSafe_object_key_1.enforceAssertSafeObjectKey,
|
|
288
|
+
'enforce-object-literal-as-const': enforce_object_literal_as_const_1.enforceObjectLiteralAsConst,
|
|
289
|
+
'enforce-positive-naming': enforce_positive_naming_1.enforcePositiveNaming,
|
|
290
|
+
'no-type-assertion-returns': no_type_assertion_returns_1.noTypeAssertionReturns,
|
|
291
|
+
'prefer-utility-function-over-private-static': prefer_utility_function_over_private_static_1.preferUtilityFunctionOverPrivateStatic,
|
|
292
|
+
'enforce-microdiff': enforce_microdiff_1.enforceMicrodiff,
|
|
293
|
+
'enforce-timestamp-now': enforce_timestamp_now_1.enforceTimestampNow,
|
|
294
|
+
'no-always-true-false-conditions': no_always_true_false_conditions_1.noAlwaysTrueFalseConditions,
|
|
295
|
+
'enforce-props-argument-name': enforce_props_argument_name_1.enforcePropsArgumentName,
|
|
296
|
+
'prefer-global-router-state-key': prefer_global_router_state_key_1.preferGlobalRouterStateKey,
|
|
297
|
+
'prefer-usememo-over-useeffect-usestate': prefer_usememo_over_useeffect_usestate_1.preferUseMemoOverUseEffectUseState,
|
|
298
|
+
'enforce-dynamic-imports': enforce_dynamic_imports_1.default,
|
|
299
|
+
'ensure-pointer-events-none': ensure_pointer_events_none_1.ensurePointerEventsNone,
|
|
300
|
+
'no-object-values-on-strings': no_object_values_on_strings_1.noObjectValuesOnStrings,
|
|
301
|
+
'no-unnecessary-destructuring': no_unnecessary_destructuring_1.noUnnecessaryDestructuring,
|
|
302
|
+
'enforce-singular-type-names': enforce_singular_type_names_1.enforceSingularTypeNames,
|
|
303
|
+
'enforce-css-media-queries': enforce_css_media_queries_1.enforceCssMediaQueries,
|
|
304
|
+
'omit-index-html': omit_index_html_1.omitIndexHtml,
|
|
305
|
+
'enforce-id-capitalization': enforce_id_capitalization_1.enforceIdCapitalization,
|
|
306
|
+
'no-unused-usestate': no_unused_usestate_1.noUnusedUseState,
|
|
223
307
|
},
|
|
224
308
|
};
|
|
225
309
|
//# 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
|
-
//
|
|
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
|