The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(studio): add valtio and react-hook-form ESLint ratchet rules (#48037)
Ivan Vasilov3d1d34bbc7a0
diff --git a/apps/studio/.github/eslint-rule-baselines.json b/apps/studio/.github/eslint-rule-baselines.jsonindex 8a8bd15bd16..97ba9ff3652 100644--- a/apps/studio/.github/eslint-rule-baselines.json+++ b/apps/studio/.github/eslint-rule-baselines.json@@ -11,7 +11,7 @@"jsx-a11y/aria-proptypes": 0,"jsx-a11y/role-supports-aria-props": 0,"jsx-a11y/anchor-has-content": 0,- "jsx-a11y/control-has-associated-label": 249,+ "jsx-a11y/control-has-associated-label": 248,"jsx-a11y/label-has-associated-control": 36,"jsx-a11y/aria-role": 0,"jsx-a11y/no-redundant-roles": 4,@@ -19,7 +19,10 @@"jsx-a11y/tabindex-no-positive": 0,"jsx-a11y/anchor-is-valid": 7,"jsx-a11y/heading-has-content": 2,- "jsx-a11y/no-distracting-elements": 0+ "jsx-a11y/no-distracting-elements": 0,+ "supabase/require-explicit-tabindex": 0,+ "valtio/state-snapshot-rule": 1,+ "react-hook-form/no-use-watch": 76},"ruleFiles": {"react-hooks/exhaustive-deps": {@@ -871,7 +874,6 @@"components/interfaces/Database/Publications/PublicationsList.tsx": 1,"components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AnalyticsBucket/Fields.tsx": 2,"components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DuckLake/Fields.tsx": 2,- "components/interfaces/Database/Replication/DestinationPanel/DestinationForm/Snowflake/Fields.tsx": 1,"components/interfaces/Database/Replication/ReadReplicas/ReadReplicaRow.tsx": 1,"components/interfaces/Database/Replication/ReplicationPipelineStatus/ReplicationPipelineStatus.tsx": 1,"components/interfaces/Database/Replication/RowMenu.tsx": 1,@@ -1059,6 +1061,60 @@"jsx-a11y/heading-has-content": {"components/layouts/Scaffold.tsx": 2},- "jsx-a11y/no-distracting-elements": {}+ "jsx-a11y/no-distracting-elements": {},+ "supabase/require-explicit-tabindex": {},+ "valtio/state-snapshot-rule": {+ "state/storage-explorer.tsx": 1+ },+ "react-hook-form/no-use-watch": {+ "components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.tsx": 3,+ "components/interfaces/Account/Preferences/DeleteAccountButton.tsx": 1,+ "components/interfaces/Advisors/CreateRuleSheet.tsx": 1,+ "components/interfaces/Auth/AuditLogsForm.tsx": 1,+ "components/interfaces/Auth/BasicAuthSettingsForm.tsx": 2,+ "components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx": 1,+ "components/interfaces/Auth/Hooks/CreateHookSheet.tsx": 1,+ "components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx": 2,+ "components/interfaces/Auth/OAuthApps/CreateOrUpdateOAuthAppSheet.tsx": 1,+ "components/interfaces/Auth/OAuthApps/OAuthServerSettingsForm.tsx": 3,+ "components/interfaces/Auth/PerformanceSettingsForm.tsx": 1,+ "components/interfaces/Auth/RateLimits/RateLimits.tsx": 6,+ "components/interfaces/Auth/RedirectUrls/AddNewURLModal.tsx": 1,+ "components/interfaces/Auth/SmtpForm/SmtpForm.tsx": 2,+ "components/interfaces/Auth/ThirdPartyAuthForm/CreateAwsCognitoAuthDialog.tsx": 1,+ "components/interfaces/Auth/Users/BanUserModal.tsx": 1,+ "components/interfaces/Billing/Payment/PaymentMethods/NewPaymentMethodElement.tsx": 1,+ "components/interfaces/BranchManagement/CreateBranchModal.tsx": 1,+ "components/interfaces/Database/Extensions/EnableExtensionModal.tsx": 1,+ "components/interfaces/Database/Functions/CreateFunction/index.tsx": 1,+ "components/interfaces/Database/Policies/PolicyEditorPanel/index.tsx": 1,+ "components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx": 1,+ "components/interfaces/Database/Triggers/TriggerSheet.tsx": 1,+ "components/interfaces/DiskManagement/DiskManagementForm.tsx": 3,+ "components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionTesterSheet.tsx": 1,+ "components/interfaces/Integrations/Queues/QueuesSettings.tsx": 1,+ "components/interfaces/Integrations/Wrappers/CreateIcebergWrapperSheet.tsx": 1,+ "components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx": 2,+ "components/interfaces/Organization/BillingSettings/BillingEmail.tsx": 1,+ "components/interfaces/Organization/BillingSettings/CreditTopUp.tsx": 1,+ "components/interfaces/Organization/CloudMarketplace/NewAwsMarketplaceOrgForm.tsx": 1,+ "components/interfaces/Organization/NewOrg/NewOrgForm.tsx": 5,+ "components/interfaces/Organization/SSO/SSOConfig.tsx": 4,+ "components/interfaces/Organization/TeamSettings/InviteMemberButton.tsx": 1,+ "components/interfaces/Platform/Webhooks/PlatformWebhooksEndpointSheet.tsx": 2,+ "components/interfaces/Realtime/RealtimeSettings.tsx": 1,+ "components/interfaces/Settings/Database/ConnectionPooling/ConnectionPooling.tsx": 1,+ "components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessRuleSheet.tsx": 1,+ "components/interfaces/Settings/General/CustomDomainConfig/CustomDomainsConfigureHostname.tsx": 1,+ "components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx": 3,+ "components/interfaces/SignIn/ResetPasswordForm.tsx": 1,+ "components/interfaces/SignIn/SignInMfaForm.tsx": 1,+ "components/interfaces/SignIn/SignUpForm.tsx": 1,+ "components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/CreateTable/CreateTableSheet.tsx": 2,+ "components/interfaces/Storage/CreateBucketModal.tsx": 2,+ "components/interfaces/Storage/EditBucketModal.tsx": 2,+ "components/interfaces/Storage/StorageSettings/StorageSettings.tsx": 1,+ "components/interfaces/Support/LinkSupportTicketForm.tsx": 1+ }}}diff --git a/apps/studio/eslint.config.cjs b/apps/studio/eslint.config.cjsindex c61b3261ebb..c01030124c2 100644--- a/apps/studio/eslint.config.cjs+++ b/apps/studio/eslint.config.cjs@@ -1,6 +1,12 @@const { defineConfig } = require('eslint/config')+const { fixupPluginRules } = require('@eslint/compat')const barrelFiles = require('eslint-plugin-barrel-files')const jsxA11y = require('eslint-plugin-jsx-a11y')+const valtio = require('eslint-plugin-valtio')+// [email protected] (latest) still calls the ESLint 8+// `context.getScope()`, which ESLint 9 removed. fixupPluginRules shims the+// deprecated context methods so the rules run under flat config.+const reactHookForm = require('eslint-plugin-react-hook-form')const supabaseConfig = require('eslint-config-supabase/next')// Analytics SQL wire boundary — see the block below for context. Shared so the@@ -41,6 +47,8 @@ module.exports = defineConfig([plugins: {'barrel-files': barrelFiles,'jsx-a11y': jsxA11y,+ valtio,+ 'react-hook-form': fixupPluginRules(reactHookForm),},rules: {'@next/next/no-img-element': 'off',@@ -66,7 +74,10 @@ module.exports = defineConfig(['jsx-a11y/aria-proptypes': 'warn','jsx-a11y/role-supports-aria-props': 'warn','jsx-a11y/anchor-has-content': 'warn',- 'jsx-a11y/control-has-associated-label': ['warn', { controlComponents: ['Button', 'Switch'] }],+ 'jsx-a11y/control-has-associated-label': [+ 'warn',+ { controlComponents: ['Button', 'Switch'] },+ ],'jsx-a11y/label-has-associated-control': ['warn',{ labelComponents: ['Label'], controlComponents: ['Input', 'Switch'] },@@ -78,6 +89,12 @@ module.exports = defineConfig(['jsx-a11y/anchor-is-valid': 'warn','jsx-a11y/heading-has-content': 'warn','jsx-a11y/no-distracting-elements': 'warn',+ 'valtio/state-snapshot-rule': 'warn',+ 'valtio/avoid-this-in-proxy': 'error',+ 'react-hook-form/destructuring-formstate': 'error',+ 'react-hook-form/no-access-control': 'error',+ 'react-hook-form/no-nested-object-setvalue': 'error',+ 'react-hook-form/no-use-watch': 'warn',},},// Analytics SQL wire boundary: every call to a SQL-bearing analyticsdiff --git a/apps/studio/package.json b/apps/studio/package.jsonindex 837e9b4280d..082bcecfc09 100644--- a/apps/studio/package.json+++ b/apps/studio/package.json@@ -159,6 +159,7 @@},"devDependencies": {"@babel/core": "*",+ "@eslint/compat": "^2.1.0","@faker-js/faker": "^9.9.0","@graphql-codegen/cli": "5.0.5","@graphql-typed-document-node/core": "^3.2.0",@@ -198,6 +199,8 @@"eslint-config-supabase": "workspace:*","eslint-plugin-barrel-files": "^2.0.7","eslint-plugin-jsx-a11y": "^6.10.2",+ "eslint-plugin-react-hook-form": "^0.3.1",+ "eslint-plugin-valtio": "^0.8.0","graphql-ws": "5.14.1","import-in-the-middle": "^2.0.0","jsdom-testing-mocks": "^1.13.1",diff --git a/apps/studio/scripts/ratchet-rules.json b/apps/studio/scripts/ratchet-rules.jsonindex 4f0135b422e..80826ac1e4a 100644--- a/apps/studio/scripts/ratchet-rules.json+++ b/apps/studio/scripts/ratchet-rules.json@@ -18,5 +18,8 @@"jsx-a11y/tabindex-no-positive","jsx-a11y/anchor-is-valid","jsx-a11y/heading-has-content",- "jsx-a11y/no-distracting-elements"+ "jsx-a11y/no-distracting-elements",+ "supabase/require-explicit-tabindex",+ "valtio/state-snapshot-rule",+ "react-hook-form/no-use-watch"]diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 1fc7165af4e..c64b8b7953d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1238,6 +1238,9 @@ importers:'@babel/core':specifier: '*'version: 7.29.7([email protected])+ '@eslint/compat':+ specifier: ^2.1.0'@faker-js/faker':specifier: ^9.9.0version: 9.9.0@@ -1352,6 +1355,12 @@ importers:eslint-plugin-jsx-a11y:specifier: ^6.10.2+ eslint-plugin-react-hook-form:+ specifier: ^0.3.1+ version: 0.3.1+ eslint-plugin-valtio:+ specifier: ^0.8.0+ version: 0.8.0graphql-ws:specifier: 5.14.1version: 5.14.1([email protected])@@ -3786,6 +3795,15 @@ packages:resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}+ '@eslint/[email protected]':+ resolution: {integrity: sha512-LgaSCymEpw7tF53xvDw9SNsraPb1IBHxpdABIOM0hW8UAlP8znrjYtuxfR58FSJ3L9BhwD+FaPRFQpZq84Nh6g==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}+ peerDependencies:+ eslint: ^8.40 || 9 || 10+ peerDependenciesMeta:+ eslint:+ optional: true+'@eslint/[email protected]':resolution: {integrity: sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}@@ -3798,6 +3816,10 @@ packages:resolution: {integrity: sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ '@eslint/[email protected]':+ resolution: {integrity: sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}+'@eslint/[email protected]':resolution: {integrity: sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}@@ -11049,6 +11071,10 @@ packages:peerDependencies:eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9+ resolution: {integrity: sha512-+KHoQvjGa6gxxDaVTDPXmqOL+tJ2fWTBggBQTafoVTTe41xLnq94+ZXpb7oTDDRMP97UN908iIX3mNwQqnRxHw==}+ engines: {node: '>=0.10.0'}+resolution: {integrity: sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==}engines: {node: '>=10'}@@ -11067,6 +11093,10 @@ packages:eslint: '>6.6.0'turbo: '>2.0.0'+ resolution: {integrity: sha512-bsqtbNB2Vhp4jWExsV3lZRwFYoWCkBb6K1LUuRgItdN7SjOQlvTcNdm4u8CfHl2N76TM9kDuftnoVs/cXIyJLw==}+ engines: {node: '>=12.7.0'}+resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==}engines: {node: '>=8.0.0'}@@ -15515,6 +15545,10 @@ packages:resolution: {integrity: sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==}engines: {node: '>=9.3.0 || >=8.10.0 <9.0.0'}+ resolution: {integrity: sha512-LBnkqsDE7BZKvqylbmn7lTIVdpx4K/QCduRATpO5R+wtPmky/a8pN1bO2D6wXppn1497AJF9mNjqAXr6bdl9jg==}+ engines: {node: '>=0.10.5'}+resolution: {integrity: sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==}engines: {node: '>=0.10.5'}@@ -19141,6 +19175,12 @@ snapshots:'@eslint-community/[email protected]': {}+ dependencies:+ '@eslint/core': 1.2.1+ optionalDependencies:+ eslint: 9.37.0([email protected])([email protected])+'@eslint/[email protected]([email protected])':dependencies:'@eslint/object-schema': 2.1.6@@ -19157,6 +19197,10 @@ snapshots:dependencies:'@types/json-schema': 7.0.15+ '@eslint/[email protected]':+ dependencies:+ '@types/json-schema': 7.0.15+'@eslint/[email protected]([email protected])':dependencies:ajv: 6.14.0@@ -27401,6 +27445,10 @@ snapshots:safe-regex-test: 1.1.0string.prototype.includes: 2.0.1+ dependencies:+ requireindex: 1.1.0+dependencies:eslint: 9.37.0([email protected])([email protected])@@ -27433,6 +27481,8 @@ snapshots:eslint: 9.37.0([email protected])([email protected])turbo: 2.9.14+ [email protected]: {}+dependencies:esrecurse: 4.3.0@@ -33162,6 +33212,8 @@ snapshots:transitivePeerDependencies:- supports-color+ [email protected]: {}+