From 710765ea7a3b7f0d2e37309d547faceae4d55367 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 20 Sep 2024 12:57:25 +0200 Subject: [PATCH] style: use prettier --- .prettierignore | 5 ++ biome.json | 49 ---------------- package.json | 5 +- pnpm-lock.yaml | 91 ----------------------------- src/core/config/loader.ts | 8 ++- src/core/scan.ts | 1 - src/rollup/plugins/public-assets.ts | 2 - src/rollup/plugins/replace.ts | 1 - test/fixture/routes/assets/all.ts | 1 - 9 files changed, 12 insertions(+), 151 deletions(-) delete mode 100644 biome.json diff --git a/.prettierignore b/.prettierignore index dd449725e1..a1671b6e4f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,6 @@ *.md +**/*.gen.ts +node_modules +pnpm-lock.yaml +**/.docs +**/dist/** diff --git a/biome.json b/biome.json deleted file mode 100644 index 76b29540c8..0000000000 --- a/biome.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/1.8.0/schema.json", - "formatter": { - "indentStyle": "space", - "ignore": ["**/*.gen.ts", "./package.json"] - }, - "linter": { - "enabled": true, - "rules": { - "suspicious": { - "noExplicitAny": "off", - "noImplicitAnyLet": "off", - "noAssignInExpressions": "off", - "noConfusingVoidType": "off", - "noEmptyInterface": "off" - }, - "style": { - "noNonNullAssertion": "off", - "noArguments": "off", - "useTemplate": "off", - "noUnusedTemplateLiteral": "off", - "noParameterAssign": "off", - "useShorthandFunctionType": "off" - }, - "complexity": { - "noBannedTypes": "off", - "useArrowFunction": "off", - "noUselessEmptyExport": "off" - }, - "performance": { - "noDelete": "off" - } - } - }, - "organizeImports": { - "enabled": true - }, - "javascript": { - "formatter": { - "trailingCommas": "es5", - "arrowParentheses": "always" - } - }, - "vcs": { - "enabled": true, - "clientKind": "git", - "useIgnoreFile": true - } -} diff --git a/package.json b/package.json index c706bd1c0b..2a8062f7e5 100644 --- a/package.json +++ b/package.json @@ -80,8 +80,8 @@ "dev": "pnpm nitro dev playground", "dev:build": "pnpm nitro build playground", "dev:start": "node playground/.output/server/index.mjs", - "lint": "eslint --cache . && biome check .", - "lint:fix": "eslint --cache --fix . && biome check . --write", + "lint": "eslint --cache . && prettier -c .", + "lint:fix": "eslint --cache --fix . && prettier -w .", "nitro": "NODE_OPTIONS=\"--enable-source-maps\" jiti ./src/cli/index.ts", "prepack": "pnpm build", "gen-mirror": "pnpm jiti scripts/gen-mirror.ts", @@ -172,7 +172,6 @@ "devDependencies": { "@azure/functions": "^3.5.1", "@azure/static-web-apps-cli": "^1.1.10", - "@biomejs/biome": "^1.9.2", "@cloudflare/workers-types": "^4.20240919.0", "@deno/types": "^0.0.1", "@scalar/api-reference": "^1.25.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3a9d59502d..2b781db25b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -227,9 +227,6 @@ importers: '@azure/static-web-apps-cli': specifier: ^1.1.10 version: 1.1.10 - '@biomejs/biome': - specifier: ^1.9.2 - version: 1.9.2 '@cloudflare/workers-types': specifier: ^4.20240919.0 version: 4.20240919.0 @@ -577,59 +574,6 @@ packages: '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - '@biomejs/biome@1.9.2': - resolution: {integrity: sha512-4j2Gfwft8Jqp1X0qLYvK4TEy4xhTo4o6rlvJPsjPeEame8gsmbGQfOPBkw7ur+7/Z/f0HZmCZKqbMvR7vTXQYQ==} - engines: {node: '>=14.21.3'} - hasBin: true - - '@biomejs/cli-darwin-arm64@1.9.2': - resolution: {integrity: sha512-rbs9uJHFmhqB3Td0Ro+1wmeZOHhAPTL3WHr8NtaVczUmDhXkRDWScaxicG9+vhSLj1iLrW47itiK6xiIJy6vaA==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [darwin] - - '@biomejs/cli-darwin-x64@1.9.2': - resolution: {integrity: sha512-BlfULKijNaMigQ9GH9fqJVt+3JTDOSiZeWOQtG/1S1sa8Lp046JHG3wRJVOvekTPL9q/CNFW1NVG8J0JN+L1OA==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [darwin] - - '@biomejs/cli-linux-arm64-musl@1.9.2': - resolution: {integrity: sha512-ZATvbUWhNxegSALUnCKWqetTZqrK72r2RsFD19OK5jXDj/7o1hzI1KzDNG78LloZxftrwr3uI9SqCLh06shSZw==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [linux] - - '@biomejs/cli-linux-arm64@1.9.2': - resolution: {integrity: sha512-T8TJuSxuBDeQCQzxZu2o3OU4eyLumTofhCxxFd3+aH2AEWVMnH7Z/c3QP1lHI5RRMBP9xIJeMORqDQ5j+gVZzw==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [linux] - - '@biomejs/cli-linux-x64-musl@1.9.2': - resolution: {integrity: sha512-CjPM6jT1miV5pry9C7qv8YJk0FIZvZd86QRD3atvDgfgeh9WQU0k2Aoo0xUcPdTnoz0WNwRtDicHxwik63MmSg==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [linux] - - '@biomejs/cli-linux-x64@1.9.2': - resolution: {integrity: sha512-T0cPk3C3Jr2pVlsuQVTBqk2qPjTm8cYcTD9p/wmR9MeVqui1C/xTVfOIwd3miRODFMrJaVQ8MYSXnVIhV9jTjg==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [linux] - - '@biomejs/cli-win32-arm64@1.9.2': - resolution: {integrity: sha512-2x7gSty75bNIeD23ZRPXyox6Z/V0M71ObeJtvQBhi1fgrvPdtkEuw7/0wEHg6buNCubzOFuN9WYJm6FKoUHfhg==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [win32] - - '@biomejs/cli-win32-x64@1.9.2': - resolution: {integrity: sha512-JC3XvdYcjmu1FmAehVwVV0SebLpeNTnO2ZaMdGCSOdS7f8O9Fq14T2P1gTG1Q29Q8Dt1S03hh0IdVpIZykOL8g==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [win32] - '@cloudflare/kv-asset-handler@0.3.4': resolution: {integrity: sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==} engines: {node: '>=16.13'} @@ -6392,41 +6336,6 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} - '@biomejs/biome@1.9.2': - optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.9.2 - '@biomejs/cli-darwin-x64': 1.9.2 - '@biomejs/cli-linux-arm64': 1.9.2 - '@biomejs/cli-linux-arm64-musl': 1.9.2 - '@biomejs/cli-linux-x64': 1.9.2 - '@biomejs/cli-linux-x64-musl': 1.9.2 - '@biomejs/cli-win32-arm64': 1.9.2 - '@biomejs/cli-win32-x64': 1.9.2 - - '@biomejs/cli-darwin-arm64@1.9.2': - optional: true - - '@biomejs/cli-darwin-x64@1.9.2': - optional: true - - '@biomejs/cli-linux-arm64-musl@1.9.2': - optional: true - - '@biomejs/cli-linux-arm64@1.9.2': - optional: true - - '@biomejs/cli-linux-x64-musl@1.9.2': - optional: true - - '@biomejs/cli-linux-x64@1.9.2': - optional: true - - '@biomejs/cli-win32-arm64@1.9.2': - optional: true - - '@biomejs/cli-win32-x64@1.9.2': - optional: true - '@cloudflare/kv-asset-handler@0.3.4': dependencies: mime: 3.0.0 diff --git a/src/core/config/loader.ts b/src/core/config/loader.ts index 7cefa00475..6260437c0c 100644 --- a/src/core/config/loader.ts +++ b/src/core/config/loader.ts @@ -84,9 +84,11 @@ async function _loadUserConfig( "nitropack/" + "presets" )) as typeof import("nitropack/presets"); - const loadedConfig = await (opts.watch - ? watchConfig - : loadConfig)({ + const loadedConfig = await ( + opts.watch + ? watchConfig + : loadConfig + )({ name: "nitro", cwd: configOverrides.rootDir, dotenv: configOverrides.dev, diff --git a/src/core/scan.ts b/src/core/scan.ts index 8439e6562c..2f8238ba55 100644 --- a/src/core/scan.ts +++ b/src/core/scan.ts @@ -10,7 +10,6 @@ const suffixRegex = /\.(connect|delete|get|head|options|patch|post|put|trace)(\.(dev|prod|prerender))?$/; // prettier-ignore -// biome-ignore format: keep inline for better readability type MatchedMethodSuffix = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace"; type MatchedEnvSuffix = "dev" | "prod" | "prerender"; diff --git a/src/rollup/plugins/public-assets.ts b/src/rollup/plugins/public-assets.ts index 37619f9cbe..14c0d3a8a3 100644 --- a/src/rollup/plugins/public-assets.ts +++ b/src/rollup/plugins/public-assets.ts @@ -120,10 +120,8 @@ export function readAsset (id) { ); // prettier-ignore - // biome-ignore format: - type _serveStaticAsKey = Exclude | "true" | "false"; // prettier-ignore - // biome-ignore format: - const handlerName = readAssetHandler[nitro.options.serveStatic as _serveStaticAsKey] || "null"; const readAssetImport = `#nitro-internal-virtual/public-assets-${handlerName}`; diff --git a/src/rollup/plugins/replace.ts b/src/rollup/plugins/replace.ts index 55ea3cd505..c37f904f42 100644 --- a/src/rollup/plugins/replace.ts +++ b/src/rollup/plugins/replace.ts @@ -12,7 +12,6 @@ export function replace(options: RollupReplaceOptions): Plugin { renderChunk(code, chunk, options) { if (!NO_REPLACE_RE.test(code)) { // prettier-ignore - // biome-ignore format: keep ts-ignore working // @ts-ignore return (_plugin.renderChunk as () => any).call(this, code, chunk, options ); } diff --git a/test/fixture/routes/assets/all.ts b/test/fixture/routes/assets/all.ts index d788d592ee..58b16b9843 100644 --- a/test/fixture/routes/assets/all.ts +++ b/test/fixture/routes/assets/all.ts @@ -9,7 +9,6 @@ export default eventHandler(async (event) => { meta: await serverAssets.getMeta(key), data: await serverAssets.getItem(key).then((r) => // prettier-ignore - // biome-ignore format: eslint compatibility typeof r === "string" ? r.slice(0, 32) : (isPureObject(r) ? r : ``) ), };