The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: Add `prettier` plugin for sorting imports (#41608)
Ivan Vasilov07b9702be353
diff --git a/.prettierrc b/.prettierrcdeleted file mode 100644index 58dc1645bf8..00000000000--- a/.prettierrc+++ /dev/null@@ -1,16 +0,0 @@-{- "trailingComma": "es5",- "tabWidth": 2,- "semi": false,- "singleQuote": true,- "printWidth": 100,- "endOfLine": "lf",- "sqlKeywordCase": "lower",- "plugins": ["prettier-plugin-sql-cst"],- "overrides": [- {- "files": "**/*.json",- "options": { "parser": "json" }- }- ]-}diff --git a/apps/studio/package.json b/apps/studio/package.jsonindex cd42c66525a..7bae02cb2a8 100644--- a/apps/studio/package.json+++ b/apps/studio/package.json@@ -19,8 +19,6 @@"deploy:staging": "VERCEL_ORG_ID=team_E6KJ1W561hMTjon1QSwOh0WO VERCEL_PROJECT_ID=QmcmhbiAtCMFTAHCuGgQscNbke4TzgWULECctNcKmxWCoT vercel --prod -A .vercel/staging.json","pretypecheck": "next typegen","typecheck": "tsc --noEmit",- "prettier:check": "prettier --cache --check .",- "prettier:write": "prettier --cache --write .","build:deno-types": "tsx scripts/deno-types.ts","build:graphql-types": "tsx scripts/download-graphql-schema.mts && pnpm graphql-codegen --config scripts/codegen.ts","build:graphql-types:watch": "pnpm graphql-codegen --config scripts/codegen.ts --watch",diff --git a/apps/www/package.json b/apps/www/package.jsonindex b51a178eb94..35408414142 100644--- a/apps/www/package.json+++ b/apps/www/package.json@@ -14,7 +14,6 @@"pretypecheck": "next typegen","typecheck": "pnpm run content:build && tsc --noEmit","content:build": "node scripts/generateStaticContent.mjs",- "prettier": "prettier --cache --write \"./{pages,components,lib,stores,styles,tests}/**/*.{ts,tsx,md,js,jsx,json}\"","postbuild": "node ./internals/generate-sitemap.mjs && ./../../scripts/upload-static-assets.sh"},"dependencies": {diff --git a/package.json b/package.jsonindex b266c2bf463..2e7f7100660 100644--- a/package.json+++ b/package.json@@ -22,8 +22,8 @@"dev:design-system": "turbo run dev --filter=design-system --parallel","lint": "turbo run lint","typecheck": "turbo --continue typecheck",- "test:prettier": "prettier --cache --check '{apps,packages}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'",- "format": "prettier --cache --write '{apps,packages}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'",+ "test:prettier": "SORT_IMPORTS=false prettier --cache --check '{apps,packages}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'",+ "format": "SORT_IMPORTS=false prettier --cache --write '{apps,packages}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'","test:docs": "turbo run test --filter=docs","test:ui": "turbo run test --filter=ui","test:ui-patterns": "turbo run test --filter=ui-patterns",@@ -44,6 +44,7 @@},"devDependencies": {"@aws-sdk/client-secrets-manager": "^3.823.0",+ "@trivago/prettier-plugin-sort-imports": "^6.0.0","@types/node": "catalog:","eslint": "^9.0.0","prettier": "3.2.4",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c036b5e83dc..0efb56d357b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -77,6 +77,8 @@ overrides:'@smithy/config-resolver': ^4.4.0esbuild: ^0.25.2nodemailer: ^7.0.11+ lodash-es: ^4.17.23+ lodash: ^4.17.23payload>undici: ^7.18.2preact: 10.26.10refractor>prismjs: ^1.30.0@@ -85,8 +87,6 @@ overrides:tmp: ^0.2.4vinxi>vite: ^7.1.11vinxi>h3: ^1.15.5- lodash-es: ^4.17.23- lodash: ^4.17.23importers:@@ -95,6 +95,9 @@ importers:'@aws-sdk/client-secrets-manager':specifier: ^3.823.0version: 3.823.0+ '@trivago/prettier-plugin-sort-imports':+ specifier: ^6.0.0'@types/node':specifier: 'catalog:'version: 22.13.14@@ -557,7 +560,7 @@ importers:nuqs:specifier: ^1.19.1- version: 1.19.1([email protected](@babel/[email protected]([email protected]))(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])([email protected]))+ version: 1.19.1([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])([email protected]))openai:specifier: ^4.75.1@@ -9299,6 +9302,25 @@ packages:resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==}engines: {node: '>= 10'}+ '@trivago/[email protected]':+ resolution: {integrity: sha512-Xarx55ow0R8oC7ViL5fPmDsg1EBa1dVhyZFVbFXNtPPJyW2w9bJADIla8YFSaNG9N06XfcklA9O9vmw4noNxkQ==}+ engines: {node: '>= 20'}+ peerDependencies:+ '@vue/compiler-sfc': 3.x+ prettier: 2.x - 3.x+ prettier-plugin-ember-template-tag: '>= 2.0.0'+ prettier-plugin-svelte: 3.x+ svelte: 4.x || 5.x+ peerDependenciesMeta:+ '@vue/compiler-sfc':+ optional: true+ prettier-plugin-ember-template-tag:+ optional: true+ prettier-plugin-svelte:+ optional: true+ svelte:+ optional: true+'@ts-morph/[email protected]':resolution: {integrity: sha512-m7Lllj9n/S6sOkCkRftpM7L24uvmfXQFedlW/4hENcuJH1HHm9u5EgxZb9uVjQSCGrbBWBkOGgcTxNg36r6ywA==}@@ -14088,6 +14110,9 @@ packages:engines: {node: '>=10'}hasBin: true+ resolution: {integrity: sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==}+resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==}engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}@@ -15160,10 +15185,6 @@ packages:resolution: {integrity: sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==}hasBin: true- resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==}- engines: {node: 20 || >=22}-resolution: {integrity: sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==}engines: {node: 20 || >=22}@@ -16030,6 +16051,9 @@ packages:resolution: {integrity: sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==}engines: {node: '>=0.8'}+ resolution: {integrity: sha512-4s6vd6dx1AotCx/RCI2m7t7GCh5bDRUtGNvRfHSP2wbBQdMi67pPe7mtzmgwcaQ8VKK/6IB7Glfyu3qdZJPybQ==}+resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==}engines: {node: '>=4'}@@ -16056,6 +16080,9 @@ packages:resolution: {integrity: sha512-EuCycjZtfPcjWk7KTksnJ5xPMvWGA/6i4zrLYhRG0hGvC3GPU/jGUj3Cy+ZR0v30duV3e23R95T1lE2+lsndSw==}+ resolution: {integrity: sha512-HlsyYdMBnbPQ9Jr/VgJ1YF4scnldvJpJxCVx6KgqPL4dxppsWrJHCIIxQXMJrqGnsRkNPATbeMJ8Yxu7JMsYcA==}+resolution: {integrity: sha512-bCgsFI+GeGWPAvAiUv63ZorMeif3/U0zaXABGJbOWt5OH2KCaPHF6S+0ok4aqM9RuIPGyZdx9tR9l13PsW4AYQ==}engines: {node: '>=14.13.0'}@@ -28788,6 +28815,22 @@ snapshots:'@tootallnate/[email protected]':optional: true+ dependencies:+ '@babel/generator': 7.28.3+ '@babel/parser': 7.28.4+ '@babel/traverse': 7.28.4([email protected])+ '@babel/types': 7.28.4+ javascript-natural-sort: 0.7.1+ lodash-es: 4.17.23+ minimatch: 9.0.5+ parse-imports-exports: 0.2.4+ prettier: 3.2.4+ optionalDependencies:+ '@vue/compiler-sfc': 3.5.21+ transitivePeerDependencies:+ - supports-color+'@ts-morph/[email protected]':dependencies:fast-glob: 3.3.3@@ -33295,7 +33338,7 @@ snapshots:cosmiconfig: 9.0.0([email protected])graphql: 16.11.0jiti: 2.5.1- minimatch: 10.0.1+ minimatch: 10.1.1string-env-interpolation: 1.0.1tslib: 2.8.1transitivePeerDependencies:@@ -34333,6 +34376,8 @@ snapshots:filelist: 1.0.4minimatch: 3.1.2+ [email protected]: {}+dependencies:chalk: 4.1.2@@ -36066,10 +36111,6 @@ snapshots:- dependencies:- brace-expansion: 2.0.2-dependencies:'@isaacs/brace-expansion': 5.0.0@@ -36733,7 +36774,7 @@ snapshots:- [email protected]([email protected](@babel/[email protected]([email protected]))(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])([email protected])):+ [email protected]([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])([email protected])):dependencies:mitt: 3.0.1next: 15.5.10(@babel/[email protected]([email protected]))(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])@@ -37264,6 +37305,10 @@ snapshots:map-cache: 0.2.2path-root: 0.1.1+ dependencies:+ parse-statements: 1.0.11+dependencies:error-ex: 1.3.2@@ -37292,6 +37337,8 @@ snapshots:dependencies:protocols: 2.0.2+ [email protected]: {}+dependencies:'@types/parse-path': 7.1.0diff --git a/prettier.config.mjs b/prettier.config.mjsnew file mode 100644index 00000000000..1e6299b3470--- /dev/null+++ b/prettier.config.mjs@@ -0,0 +1,31 @@+let options = {+ trailingComma: 'es5',+ tabWidth: 2,+ semi: false,+ singleQuote: true,+ printWidth: 100,+ endOfLine: 'lf',+ sqlKeywordCase: 'lower',+ plugins: ['prettier-plugin-sql-cst'],+ overrides: [+ {+ files: '**/*.json',+ options: { parser: 'json' },+ },+ ],+}++// Disable sorting imports when running a prettier command in CI. This is to make the sorting work in editors+// for easier migration.+if (process.env.SORT_IMPORTS !== 'false') {+ options = {+ ...options,+ plugins: [...options.plugins, '@trivago/prettier-plugin-sort-imports'],+ importOrder: ['<THIRD_PARTY_MODULES>', '^(@|\.{1,2})\/(.*)$'],+ importOrderSeparation: true,+ importOrderSortSpecifiers: true,+ importOrderSideEffects: false,+ }+}++export default options