Files
supabase/apps/studio/scripts/ratchet-rules.json
T
Ivan VasilovandClaude Opus 4.8 3d1d34bbc7 chore(studio): add valtio and react-hook-form ESLint ratchet rules (#48037)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Chore / tooling — adds new ESLint rules for `valtio` and
`react-hook-form`.

## What is the current behavior?

Studio uses `valtio` and `react-hook-form` heavily, but neither
library's dedicated ESLint plugin was installed, so their common API
pitfalls were only caught at runtime.

## What is the new behavior?

Adds `eslint-plugin-valtio` and `eslint-plugin-react-hook-form` (6 rules
total) as `warn`, wired into the existing lint ratchet
(`scripts/ratchet-rules.json` + baselines) so current violations are
grandfathered and only new ones fail CI — no existing code is changed.
Since `eslint-plugin-react-hook-form@0.3.1` still calls the removed
ESLint 8 `context.getScope()`, it is wrapped with `fixupPluginRules`
from `@eslint/compat` so its rules run under flat config / ESLint 9.

## Additional context

Baselines captured: `valtio/state-snapshot-rule` (1),
`valtio/avoid-this-in-proxy` (1), `react-hook-form/no-use-watch` (77),
and the three recommended react-hook-form rules (0 each).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Code Quality**
* Expanded linting for Valtio state usage, including safer proxy usage
and snapshot-related patterns.
* Added React Hook Form lint rules to encourage safer form state
handling and discourage problematic watch usage.
* Updated accessibility lint configuration and improved ESLint
reliability by enabling an ESLint 8→9 compatibility shim for affected
rules.

* **Maintenance**
* Updated ESLint rule baselines and ratcheting settings to match newly
enabled rules.
  * Added required ESLint plugins to the Studio linting setup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 14:29:21 +02:00

26 lines
802 B
JSON

[
"react-hooks/exhaustive-deps",
"import/no-anonymous-default-export",
"@tanstack/query/exhaustive-deps",
"@typescript-eslint/no-explicit-any",
"no-restricted-imports",
"no-restricted-exports",
"react/no-unstable-nested-components",
"jsx-a11y/aria-props",
"jsx-a11y/aria-proptypes",
"jsx-a11y/role-supports-aria-props",
"jsx-a11y/anchor-has-content",
"jsx-a11y/control-has-associated-label",
"jsx-a11y/label-has-associated-control",
"jsx-a11y/aria-role",
"jsx-a11y/no-redundant-roles",
"jsx-a11y/no-aria-hidden-on-focusable",
"jsx-a11y/tabindex-no-positive",
"jsx-a11y/anchor-is-valid",
"jsx-a11y/heading-has-content",
"jsx-a11y/no-distracting-elements",
"supabase/require-explicit-tabindex",
"valtio/state-snapshot-rule",
"react-hook-form/no-use-watch"
]