feat: code quality enforcement (hooks, ESLint rules, style guide)#336
Open
Just-Insane wants to merge 9 commits intodevfrom
Open
feat: code quality enforcement (hooks, ESLint rules, style guide)#336Just-Insane wants to merge 9 commits intodevfrom
Just-Insane wants to merge 9 commits intodevfrom
Conversation
… guards) - Add husky + lint-staged pre-commit hooks (eslint --fix, prettier --write) - Enable @typescript-eslint/consistent-type-definitions (type over interface) - Enable @typescript-eslint/consistent-type-imports (inline type imports) - Add ESLint rule banning direct localStorage in components/features - Apply type-imports codebase-wide lint fix (~500 files) - Add sentryStorage and mediaVolume utilities in src/app/state/ - Fix all direct localStorage violations in components/features
2bd7db5 to
746b872
Compare
The consistent-type-definitions and consistent-type-imports rules
converted two module augmentation patterns in ways TypeScript doesn't
support:
- slate.d.ts: import { type X } from augmented module breaks the
declare module augmentation; must use regular imports. Also reverts
interface CustomTypes to interface (type aliases don't support
declaration merging that Slate relies on).
- matrix-sdk-events.d.ts: type alias cannot merge with existing
interface declarations in matrix-js-sdk; must use interface.
Add eslint-disable-next-line comments to suppress the rules at these
specific locations where they must be violated.
- Add vitest coverage thresholds (statements/functions/lines: 1.5%, branches: 1%) — locked at current baseline, never to be lowered - Add 'coverage' CI job that runs pnpm test:coverage on every PR/push - Add 'missing-tests' CI job that comments on PRs listing any changed logic files that have no corresponding .test. file (advisory, not blocking, to allow deliberate exceptions)
|
worried bot sounds |
hazre
requested changes
Mar 17, 2026
Collaborator
Author
Will do - and those files are all touched by the PR, needed to be updated to pass the new lint rules |
Contributor
|
Collaborator
Author
|
@hazre should update a single comment now. Also, as mentioned, all of those files were touched (they needed to be updated to match the new quality rules). |
Contributor
Deploying with
|
| Status | Preview URL | Commit | Alias | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! | https://pr-336-sable.raspy-dream-bb1d.workers.dev | d6f6376 | pr-336 |
Tue, 17 Mar 2026 18:49:38 GMT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four layers of code quality enforcement to keep the codebase consistent.
Pre-commit hooks
husky+lint-staged— staged TS/JS files are auto-fixed with ESLint and formatted with Prettier on every commitESLint rules
@typescript-eslint/consistent-type-definitions— enforcestypealiases overinterfacedeclarations@typescript-eslint/consistent-type-imports— enforcesimport type/ inlinetypemodifier on type-only importsno-restricted-properties— bans directlocalStorageaccess insidesrc/app/components/**andsrc/app/features/**; use atoms or state utilities fromsrc/app/state/insteadCodebase-wide lint fix
pnpm lint:fixto enforce the two new type-import rules across ~500 existing files (0 new errors, 38 pre-existingno-consolewarnings remain)State utilities
src/app/state/sentryStorage.ts— centralises Sentry opt-in preference reads/writes (plain functions, not atoms, soinstrument.tscan call them synchronously before React mounts)src/app/state/mediaVolume.ts— centralises media volume persistenceTest coverage enforcement
vitest.config.tsand enforced by CI (pnpm test:coverage). Current baseline: ≥ 1.5% statements/functions/lines, ≥ 1% branches. These numbers are a floor — they should only ever be raised, never lowered..test.*counterpart. Advisory only — does not block merging. If tests aren't warranted (config tweaks, pure UI restyling), note it in the PR description.Docs
docs/CODE_QUALITY.md— canonical reference covering TypeScript conventions, import ordering, naming, React patterns, Jotai/localStorage state patterns, vanilla-extract styling, testing policy (coverage thresholds + missing-tests advisory), and a full enforcement-layer tableCONTRIBUTING.mdChecklist
pnpm lintpasses (0 errors)localStoragecalls in components/features removed.d.tsfiles exempted with targeted comments (no TS errors)vitest.config.tsquality-checks.ymlquality-checks.yml