@blumintinc/eslint-plugin-blumint
Custom eslint rules for use at BluMint
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install @blumintinc/eslint-plugin-blumint:
npm install @blumintinc/eslint-plugin-blumint --save-dev
Usage
Add @blumintinc/blumint to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"@blumintinc/blumint"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"blumint/rule-name": "error"
}
}
Or use the recommended config:
{
"extends": ["some-other-plugin", "plugin:@blumintinc/blumint/recommended"]
}
Autonomous maintenance
This repo is maintained by an autonomous loop, not a human cutting releases on demand. See .claude/skills/repo-maintenance/SKILL.md for the operating model. Two contracts make it safe and self-healing:
- The maintainer (
/maintainer, backed byscripts/maintainer.ts) is the sole operator: it drains the open-issue queue (bugs before features, oldest first), self-merges fixes todevelop, and on an empty queue promotesdevelop → main(firing the release) then fast-forwardsdevelop. release-manifest.jsonis a strict, publishedversion → fixed-rulesmap (scripts/generate-release-manifest.js, a@semantic-release/execprepareCmd) so consumers re-enable disabled rules by exact rule name — never by parsing the changelog. It's only reliable because everyfix/featcommit's scope must be a real rule name: enforced by theblumint-rule-scopecommitlint rule and thevalidate-commit-scopesCI gate. One rule per fix/feat commit.
On publish, scripts/dispatch-agora-release.js fires a repository_dispatch to
agora, which bumps its pin and re-enables the now-fixed rules (FP-audited). The
full closed loop is documented in agora's .claude/skills/eslint-autonomy/SKILL.md.
Rules
💼 Configurations enabled in.
🚫 Configurations disabled in.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.
💭 Requires type information.
| Name | Description | 💼 | 🚫 | 🔧 | 💡 | 💭 |
|---|---|---|---|---|---|---|
| array-methods-this-context | Prevent misuse of Array methods in OOP | ✅ | ||||
| avoid-utils-directory | Enforce using util/ instead of utils/ directory | ✅ | ||||
| class-methods-read-top-to-bottom | Enforces a top-to-bottom class layout so callers lead into the helpers they rely on. | ✅ | 🔧 | |||
| consistent-callback-naming | Enforce consistent naming conventions for callback props and functions | ✅ | 🔧 | |||
| dynamic-https-errors | Keep HttpsError messages static and move request-specific details to the third argument so error identifiers remain stable and debugging context is preserved. | ✅ | ||||
| enforce-assert-safe-object-key | Enforce the use of assertSafe(id) when accessing object properties with computed keys that involve string interpolation or explicit string conversion. | ✅ | 🔧 | |||
| enforce-assert-throws | Enforce that functions with an assert prefix must throw an error or call process.exit(1), and functions that call assert-prefixed methods should themselves be assert-prefixed | ✅ | ||||
| enforce-boolean-naming-prefixes | Enforce consistent naming conventions for boolean values by requiring approved prefixes | ✅ | ||||
| enforce-callable-types | Enforce Props and Response type exports in callable functions | ✅ | ||||
| enforce-callback-memo | 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. | ✅ | ||||
| enforce-centralized-mock-firestore | Enforce usage of centralized mockFirestore from predefined location | ✅ | 🔧 | |||
| enforce-cloud-function-id-length | Ensures .f.ts file paths generate Firebase Cloud Function IDs within the 62-character limit | ✅ | ||||
| enforce-console-error | Enforce proper logging for useAlertDialog based on severity. When severity is "error", console.error must be included. When severity is "warning", console.warn must be included. This ensures all user-facing errors and warnings are properly logged to observability systems. | ✅ | ||||
| enforce-css-media-queries | Enforce CSS media queries over JS breakpoints | ✅ | ||||
| enforce-date-ttime | Enforce that any generic type parameter named TTime is explicitly set to Date in frontend code | ✅ | 🔧 | |||
| enforce-dynamic-file-naming | Enforce .dynamic.ts(x) file naming when @blumintinc/blumint/enforce-dynamic-imports or @blumintinc/blumint/require-dynamic-firebase-imports rule is disabled | |||||
| enforce-dynamic-firebase-imports | Require firebaseCloud modules to be loaded via dynamic import so Firebase code stays out of the initial bundle and only loads when needed. | ✅ | 🔧 | 💡 | ||
| enforce-dynamic-imports | Enforce dynamic imports for external libraries by default to optimize bundle size, unless explicitly ignored | ✅ | ||||
| enforce-early-destructuring | Hoist object destructuring out of React hooks so dependency arrays track the fields in use instead of the entire object. | ✅ | 🔧 | |||
| enforce-empty-object-check | Ensure object existence checks also guard against empty objects so that empty payloads are treated like missing data. | ✅ | 🔧 | |||
| enforce-exported-function-types | Enforce exporting types for function props and return values | ✅ | 🔧 | |||
| enforce-f-extension-for-entry-points | Enforce .f.ts extension for entry points | ✅ | ||||
| enforce-fieldpath-syntax-in-docsetter | Enforce the use of Firestore FieldPath syntax when passing documentData into DocSetter. Instead of using nested object syntax, developers should use dot notation for deeply nested fields. | ✅ | 🔧 | |||
| enforce-firestore-doc-ref-generic | Enforce generic argument for Firestore DocumentReference, CollectionReference and CollectionGroup | ✅ | ||||
| enforce-firestore-facade | Enforce usage of Firestore facades instead of direct Firestore methods | ✅ | ||||
| enforce-firestore-path-utils | 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. | ✅ | ||||
| enforce-firestore-rules-get-access | Ensure Firestore security rules use .get() with a default value instead of direct field access comparisons (e.g., resource.data.fieldX.fieldY != null). | ✅ | 🔧 | |||
| enforce-firestore-set-merge | 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. | ✅ | 🔧 | |||
| enforce-global-constants | Enforce global static constants for React components/hooks | ✅ | 🔧 | |||
| enforce-id-capitalization | Enforce the use of "ID" instead of "id" in user-facing text | ✅ | 🔧 | |||
| enforce-identifiable-firestore-type | Enforce that Firestore type definitions extend Identifiable and match their folder name | ✅ | ||||
| enforce-is-prefix-validators | Enforce the is (or other allowed predicate) prefix for exported validators in /validators//*.ts files | ✅ | ||||
| enforce-m3-sentence-case | Enforce Material Design 3 sentence-case capitalisation for user-facing text — flag Title Case and ALL CAPS strings in JSX text and configured string props. | ✅ | 💡 | |||
| enforce-memoize-async | Enforce @Memoize() decorator on async methods with 0-1 parameters to cache results and prevent redundant API calls or expensive computations. Without memoization, repeated calls trigger redundant requests or expensive computations, increasing latency. @Memoize() caches results by parameter, ensuring subsequent calls with identical inputs return immediately. | ✅ | 🔧 | |||
| enforce-memoize-getters | Enforce @Memoize() decorator on private class getters to avoid re-instantiation and preserve state across accesses. | ✅ | 🔧 | |||
| enforce-microdiff | Enforce using microdiff for object and array comparison operations | ✅ | 🔧 | |||
| enforce-mock-firestore | 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. | ✅ | ||||
| enforce-mui-rounded-icons | Enforce the use of -Rounded variant for MUI icons | ✅ | 🔧 | |||
| enforce-object-literal-as-const | Enforce that object literals returned from functions should be marked with as const to ensure type safety and immutability. | ✅ | 🔧 | |||
| enforce-positive-naming | Enforce positive naming for boolean variables and avoid negations | ✅ | ||||
| enforce-props-argument-name | Authoritative rule: parameters with types ending in "Props" should be named "props" (or prefixed variants when multiple Props params exist) | ✅ | 🔧 | |||
| enforce-props-naming-consistency | Prefer naming single "Props"-typed parameters as "props"; enforcement defers to enforce-props-argument-name for multi-Props cases | ✅ | 🔧 | |||
| enforce-querykey-ts | Enforce using centralized router state key constants from queryKeys.ts for useRouterState key parameter | ✅ | 🔧 | |||
| enforce-react-type-naming | Enforce naming conventions for React types | ✅ | 🔧 | |||
| enforce-realtimedb-path-utils | Enforce usage of utility functions for Realtime Database paths | ✅ | ||||
| enforce-render-hits-memoization | Enforce proper memoization and usage of useRenderHits and renderHits | ✅ | ||||
| enforce-safe-stringify | 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. | ✅ | 💡 | |||
| enforce-serializable-params | Enforce serializable parameters for Firebase callable/HTTPS functions. | ✅ | ||||
| enforce-single-exported-unit-per-file | Enforce that a .tsx/.jsx file exports at most one React component and any file exports at most one class | ✅ | ||||
| enforce-singular-type-names | Enforce TypeScript type names to be singular | ✅ | ||||
| enforce-snapshot-state-narrowing | Enforce correct narrowing of FirestoreSnapshotState variables. Falsy/truthy checks are semantic bugs because all string states are truthy; raw typeof narrowing to data bypasses the isSnapshotReady abstraction. | ✅ | 💡 | |||
| enforce-stable-hash-spread-props | Require stableHash wrapping when spread props rest objects are used in React hook dependency arrays to avoid re-renders triggered by new object references on every render. | ✅ | 🔧 | |||
| enforce-storage-context | Require storage access to go through the LocalStorage and SessionStorage context providers instead of direct browser APIs | ✅ | ||||
| enforce-timestamp-now | 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. | ✅ | 🔧 | |||
| enforce-transform-memoization | Enforce memoization of transformValue and transformOnChange in adaptValue | ✅ | ||||
| enforce-types-directory-placement | Enforce that type-only files (containing only type/interface/enum declarations) live under the canonical types directory | ✅ | ||||
| enforce-typescript-markdown-code-blocks | Ensure Markdown fenced code blocks without a language specifier default to typescript for consistent highlighting. | ✅ | 🔧 | |||
| enforce-unique-cursor-headers | Ensure files have exactly one cursor header containing required tags (e.g., @fileoverview) before any code | ✅ | 🔧 | |||
| enforce-use-flex-gap-on-wrap | Require useFlexGap on a MUI Stack that wraps and passes spacing, because margin-based spacing leaves the wrapped line with no row gap and a phantom leading indent | ✅ | 🔧 | |||
| enforce-verb-noun-naming | Enforce verb phrases for functions and methods | ✅ | ||||
| ensure-pointer-events-none | Ensure pointer-events: none is added to non-interactive pseudo-elements | ✅ | 🔧 | |||
| export-if-in-doubt | All top-level variable declarations, type definitions, and functions should be exported | ✅ | ||||
| extract-global-constants | Extract static constants and functions to the global scope when possible, and enforce type narrowing with as const for numeric literals in loops | ✅ | ||||
| fast-deep-equal-over-microdiff | Enforce using fast-deep-equal for equality checks instead of microdiff | ✅ | 🔧 | |||
| firestore-transaction-reads-before-writes | Enforce that all Firestore transaction read operations are performed before any write operations | ✅ | ||||
| flatten-push-calls | Consolidate consecutive push calls on the same array into a single push with multiple arguments. | ✅ | 🔧 | |||
| generic-starts-with-t | Enforce TypeScript generic type parameters to start with T so they stand out from runtime values. | ✅ | ||||
| global-const-style | Enforce UPPER_SNAKE_CASE and as const for global static constants | ✅ | 🔧 | |||
| jsdoc-above-field | Require JSDoc blocks to sit above fields instead of trailing inline so IDE hovers surface the documentation. | ✅ | 🔧 | |||
| key-only-outermost-element | Enforce that only the outermost element in list rendering has a key prop | ✅ | 🔧 | |||
| logical-top-to-bottom-grouping | Enforce logical top-to-bottom grouping of related statements | ✅ | 🔧 | |||
| memo-compare-deeply-complex-props | Suggest compareDeeply for memoized components that receive object/array props to avoid shallow comparison re-renders. | ✅ | 🔧 | 💭 | ||
| memo-nested-react-components | Disallow React components defined in render bodies, hooks, or passed as props | ✅ | ||||
| memoize-root-level-hocs | Prevent creating Higher-Order Components at the root level of React components/hooks without wrapping them in useMemo to keep wrapped component identities stable across renders. | ✅ | ||||
| no-always-true-false-conditions | Detect conditions that are always truthy or always falsy | ✅ | ||||
| no-array-length-in-deps | Detects array.length entries in React hook dependency arrays because length ignores content changes; auto-fixes by memoizing stableHash(array) with useMemo and depending on the hash instead. | ✅ | 🔧 | |||
| no-async-array-filter | Disallow async callbacks in Array.filter(). Async predicates return Promises that are always truthy to the filter, so no element is ever removed. Resolve async checks first (Promise.all + map) or use a synchronous predicate to decide which items to keep. | ✅ | ||||
| no-async-foreach | Disallow async callbacks to Array.forEach | ✅ | ||||
| no-circular-references | Disallow circular references in objects | ✅ | ||||
| no-class-instance-destructuring | Disallow destructuring of class instances to prevent loss of this context | ✅ | 🔧 | |||
| no-complex-cloud-params | Disallow passing complex objects to cloud functions | ✅ | ||||
| no-compositing-layer-props | Discourage CSS properties that force GPU compositing layers (e.g., transform, filter, will-change). Extra layers consume GPU memory and split rendering work, which slows scrolling and animation when sprinkled across a page. The rule inspects inline style objects and MUI sx props so layer promotion stays intentional rather than incidental. | ✅ | ||||
| no-conditional-literals-in-jsx | Disallow conditional string literals beside other JSX text to avoid fragmented text nodes, translation issues, and hydration mismatches. | ✅ | ||||
| no-console-error | Disallow console.error so errors flow through structured handling (HttpsError/useErrorAlert on frontend, structured loggers on backend). | ✅ | ||||
| no-curly-brackets-around-commented-properties | Disallow curly-brace blocks that only wrap commented-out members inside type declarations | ✅ | 🔧 | |||
| no-direct-function-state | Prevent passing a function directly to a useState setter — React will invoke it as a functional updater instead of storing it. Wrap in a thunk: setState(() => fn). | ✅ | 🔧 | |||
| no-empty-dependency-use-callbacks | Discourage useCallback([]) or useLatestCallback around static functions. Static callbacks do not need hook machinery—extract them to module-level utilities for clarity and to avoid unnecessary hook overhead. | ✅ | 🔧 | |||
| no-entire-object-hook-deps | Avoid using entire objects in React hook dependency arrays. | ✅ | 🔧 | 💭 | ||
| no-excessive-parent-chain | Discourage excessive use of the ref.parent property chain in Firestore and RealtimeDB change handlers | 💡 | ||||
| no-explicit-return-type | 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. | ✅ | 🔧 | |||
| no-fill-template-mutation | Disallow mutating the return value of fillTemplate() via string concatenation, template literals, or string method calls. The filled Algolia filter must be used verbatim so matchesTemplate() can regex-match it; post-fill modification silently breaks realtime hash parity. | ✅ | ||||
| no-filter-without-return | Disallow Array.filter callbacks without an explicit return (if part of a block statement) | ✅ | ||||
| no-firestore-jest-mock | Prevent importing firestore-jest-mock in test files | ✅ | 🔧 | |||
| no-firestore-object-arrays | Disallow arrays of object types in Firestore models. Prefer Record maps keyed by id with an index field, or subcollections/arrays of IDs. | ✅ | ||||
| no-handler-suffix | Disallow the generic "handler" suffix in callback names so names explain the action they perform | ✅ | ||||
| no-harness-coupled-disables | Disallow eslint-disable justifications that reference the agent development harness (worktree, cwd, stop-hook, claude) instead of the code’s own semantics. | ✅ | ||||
| no-hungarian | Disallow Hungarian notation in locally declared variables, types, and classes | ✅ | ||||
| no-inline-component-prop | Prevent inline function components defined in render from being passed to component-type props like CatalogWrapper to avoid remounts and UI flashes. | ✅ | ||||
| no-jsx-in-hooks | Prevent hooks from returning JSX | ✅ | ||||
| no-jsx-whitespace-literal | Disallow the use of {" "} elements in JSX code | ✅ | ||||
| no-margin-properties | Prevent margin properties (margin, marginLeft, marginRight, marginTop, marginBottom, mx, my, etc.) in MUI styling because margins fight container-controlled spacing, double gutters, and misaligned breakpoints; keep spacing centralized with padding, gap, or spacing props instead. | ✅ | ||||
| no-memoize-on-static | Prevent using @Memoize() decorator on static methods | ✅ | ||||
| no-misleading-boolean-prefixes | Reserve boolean-style prefixes (is/has/should) for functions that actually return boolean values to avoid misleading call sites. | ✅ | ||||
| no-misused-switch-case | 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. | ✅ | ||||
| no-mixed-firestore-transactions | Prevent mixing transactional and non-transactional Firestore operations within a transaction | ✅ | ||||
| no-mock-firebase-admin | Prevent direct mocking of firebaseAdmin; use shared test helpers instead | ✅ | ||||
| no-object-values-on-strings | Disallow Object.values() on strings as it treats strings as arrays of characters, which is likely unintended behavior. | ✅ | ||||
| no-overridable-method-calls-in-constructor | Disallow calling overridable methods in constructors to prevent unexpected behavior | ✅ | ||||
| no-passthrough-getters | Avoid getter methods that only re-expose nested properties on constructor-injected objects without adding behavior | ✅ | ||||
| no-portal-inside-tooltip | Disallow portal-rendering components (Dialog, Drawer, Menu, Popover, Portal, Modal) inside Tooltip wrapper components. React Portals preserve React-tree event bubbling, so a portal nested under a Tooltip leaves the tooltip orphaned over the modal. | ✅ | ||||
| no-redundant-annotation-assertion | Disallow combining a type annotation with an identical type assertion on the same value. Keep a single source of truth to avoid redundant type declarations that can drift apart. | ✅ | 🔧 | 💭 | ||
| no-redundant-boolean-callback-props | Disallow redundant boolean props that duplicate the semantic meaning of optional callback props, violating the Interface Segregation Principle. | ✅ | ||||
| no-redundant-param-types | Disallow redundant parameter type annotations | ✅ | 🔧 | |||
| no-redundant-this-params | Disallow passing class instance members (this.foo) into class instance methods; access the member from this inside the method instead. | ✅ | ||||
| no-redundant-usecallback-wrapper | Prevent wrapping already memoized/stable callbacks from hooks/contexts in an extra useCallback() | ✅ | 🔧 | |||
| no-render-function-components | Disallow declaring a local render* function that returns JSX and consuming it as a plain function (direct call or array-iteration callback); author it as a real component rendered with JSX instead | ✅ | ||||
| no-res-error-status-in-onrequest | Forbid sending 4xx/5xx Express responses inside onRequest handlers; throw structured HttpsError instances instead so the wrapper can format, log, and map errors consistently. | ✅ | ||||
| no-restricted-properties-fix | Disallow certain properties on certain objects, with special handling for Object.keys() and Object.values() | |||||
| [no-satisfies-in-frontend-bund |