From 871aaa032d4056b685d9bc9b0af703054a7dc837 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 10 May 2024 13:17:34 +0200 Subject: [PATCH] Migrate from perttier/eslint to biome --- .github/workflows/coding-style.yml | 15 ++-- front/.eslintrc.json | 38 --------- front/.prettierignore | 1 - front/biome.json | 52 ++++++++++++ front/package.json | 11 +-- front/yarn.lock | 128 +++++++++++++++++++++-------- renovate.json5 | 2 +- shell.nix | 3 +- 8 files changed, 153 insertions(+), 97 deletions(-) delete mode 100755 front/.eslintrc.json delete mode 100644 front/.prettierignore create mode 100644 front/biome.json diff --git a/.github/workflows/coding-style.yml b/.github/workflows/coding-style.yml index 25e15b0c..af7e2b84 100644 --- a/.github/workflows/coding-style.yml +++ b/.github/workflows/coding-style.yml @@ -25,18 +25,13 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: actions/setup-node@v4 + - name: Setup Biome + uses: biomejs/setup-biome@v2 with: - node-version: 18.x - cache: yarn - cache-dependency-path: front/yarn.lock + version: latest - - name: Install dependencies - run: yarn install --immutable - - - name: Lint - run: yarn lint && yarn format + - name: Run Biome + run: biome ci . scanner: name: "Lint scanner/autosync" diff --git a/front/.eslintrc.json b/front/.eslintrc.json deleted file mode 100755 index e7c4afae..00000000 --- a/front/.eslintrc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "prettier"], - "plugins": ["header"], - "settings": { - "next": { - "rootDir": "apps/web/" - } - }, - "rules": { - "@next/next/no-img-element": "off", - "header/header": [ - "error", - "block", - [ - "", - " * Kyoo - A portable and vast media library solution.", - " * Copyright (c) Kyoo.", - " *", - " * See AUTHORS.md and LICENSE file in the project root for full license information.", - " *", - " * Kyoo is free software: you can redistribute it and/or modify", - " * it under the terms of the GNU General Public License as published by", - " * the Free Software Foundation, either version 3 of the License, or", - " * any later version.", - " *", - " * Kyoo is distributed in the hope that it will be useful,", - " * but WITHOUT ANY WARRANTY; without even the implied warranty of", - " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", - " * GNU General Public License for more details.", - " *", - " * You should have received a copy of the GNU General Public License", - " * along with Kyoo. If not, see .", - " " - ], - 2 - ] - } -} diff --git a/front/.prettierignore b/front/.prettierignore deleted file mode 100644 index 61c3bc75..00000000 --- a/front/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -.yarn diff --git a/front/biome.json b/front/biome.json new file mode 100644 index 00000000..e9e88bf8 --- /dev/null +++ b/front/biome.json @@ -0,0 +1,52 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "tab", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 100, + "attributePosition": "auto", + "ignore": [ + "**/.yarn/**", + "**/.next/**", + "**/.expo/**" + ] + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "style": { + "noNonNullAssertion": "off", + "useImportType": "off", + "noParameterAssign": "off" + }, + "suspicious": { + "noExplicitAny": "off" + } + }, + "ignore": [ + "**/.yarn/**", + "**/.next/**", + "**/.expo/**" + ] + }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingComma": "all", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "quoteStyle": "double", + "attributePosition": "auto" + } + } +} diff --git a/front/package.json b/front/package.json index af68b360..3d6450f3 100644 --- a/front/package.json +++ b/front/package.json @@ -21,17 +21,8 @@ "apps/*", "packages/*" ], - "prettier": { - "useTabs": true, - "printWidth": 100, - "trailingComma": "all" - }, "devDependencies": { - "eslint": "8.56.0", - "eslint-config-next": "14.1.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-header": "^3.1.1", - "prettier": "^3.2.4", + "@biomejs/biome": "1.7.3", "typescript": "5.3.3" }, "packageManager": "yarn@3.2.4" diff --git a/front/yarn.lock b/front/yarn.lock index 0ca12690..36bbc020 100644 --- a/front/yarn.lock +++ b/front/yarn.lock @@ -1711,6 +1711,97 @@ __metadata: languageName: node linkType: hard +"@biomejs/biome@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/biome@npm:1.7.3" + dependencies: + "@biomejs/cli-darwin-arm64": 1.7.3 + "@biomejs/cli-darwin-x64": 1.7.3 + "@biomejs/cli-linux-arm64": 1.7.3 + "@biomejs/cli-linux-arm64-musl": 1.7.3 + "@biomejs/cli-linux-x64": 1.7.3 + "@biomejs/cli-linux-x64-musl": 1.7.3 + "@biomejs/cli-win32-arm64": 1.7.3 + "@biomejs/cli-win32-x64": 1.7.3 + dependenciesMeta: + "@biomejs/cli-darwin-arm64": + optional: true + "@biomejs/cli-darwin-x64": + optional: true + "@biomejs/cli-linux-arm64": + optional: true + "@biomejs/cli-linux-arm64-musl": + optional: true + "@biomejs/cli-linux-x64": + optional: true + "@biomejs/cli-linux-x64-musl": + optional: true + "@biomejs/cli-win32-arm64": + optional: true + "@biomejs/cli-win32-x64": + optional: true + bin: + biome: bin/biome + checksum: ad6a6585f1d6fcb9c060319c614b4437d715637ecedbe5f4d45f170f0532894654e7cf5c80420da38c8c626d76fef4b6334c7ee85e6c790bd5ad4f7aa49c5182 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-arm64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-darwin-arm64@npm:1.7.3" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-x64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-darwin-x64@npm:1.7.3" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@biomejs/cli-linux-arm64-musl@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-arm64-musl@npm:1.7.3" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@biomejs/cli-linux-arm64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-arm64@npm:1.7.3" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@biomejs/cli-linux-x64-musl@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-x64-musl@npm:1.7.3" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@biomejs/cli-linux-x64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-x64@npm:1.7.3" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@biomejs/cli-win32-arm64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-win32-arm64@npm:1.7.3" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-win32-x64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-win32-x64@npm:1.7.3" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@emotion/is-prop-valid@npm:^0.8.2": version: 0.8.8 resolution: "@emotion/is-prop-valid@npm:0.8.8" @@ -6950,17 +7041,6 @@ __metadata: languageName: node linkType: hard -"eslint-config-prettier@npm:^9.1.0": - version: 9.1.0 - resolution: "eslint-config-prettier@npm:9.1.0" - peerDependencies: - eslint: ">=7.0.0" - bin: - eslint-config-prettier: bin/cli.js - checksum: 9229b768c879f500ee54ca05925f31b0c0bafff3d9f5521f98ff05127356de78c81deb9365c86a5ec4efa990cb72b74df8612ae15965b14136044c73e1f6a907 - languageName: node - linkType: hard - "eslint-import-resolver-node@npm:^0.3.6, eslint-import-resolver-node@npm:^0.3.9": version: 0.3.9 resolution: "eslint-import-resolver-node@npm:0.3.9" @@ -7002,15 +7082,6 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-header@npm:^3.1.1": - version: 3.1.1 - resolution: "eslint-plugin-header@npm:3.1.1" - peerDependencies: - eslint: ">=7.7.0" - checksum: 2353e4ba011be81d5c27fbd79929e18dce118d7673a2f717b1ac5a0bceb33e06ec9a7c80a01dddc5804df75e2cc8eb475d268cd1abef5eab5088ede62e5ad246 - languageName: node - linkType: hard - "eslint-plugin-import@npm:^2.28.1": version: 2.29.1 resolution: "eslint-plugin-import@npm:2.29.1" @@ -7126,7 +7197,7 @@ __metadata: languageName: node linkType: hard -"eslint@npm:8.56.0, eslint@npm:^8.56.0": +"eslint@npm:^8.56.0": version: 8.56.0 resolution: "eslint@npm:8.56.0" dependencies: @@ -9577,11 +9648,7 @@ __metadata: version: 0.0.0-use.local resolution: "kyoo@workspace:." dependencies: - eslint: 8.56.0 - eslint-config-next: 14.1.0 - eslint-config-prettier: ^9.1.0 - eslint-plugin-header: ^3.1.1 - prettier: ^3.2.4 + "@biomejs/biome": 1.7.3 typescript: 5.3.3 languageName: unknown linkType: soft @@ -11378,15 +11445,6 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^3.2.4": - version: 3.2.4 - resolution: "prettier@npm:3.2.4" - bin: - prettier: bin/prettier.cjs - checksum: 6ec9385a836e0b9bac549e585101c086d1521c31d7b882d5c8bb7d7646da0693da5f31f4fff6dc080710e5e2d34c85e6fb2f8766876b3645c8be2f33b9c3d1a3 - languageName: node - linkType: hard - "pretty-bytes@npm:5.6.0": version: 5.6.0 resolution: "pretty-bytes@npm:5.6.0" diff --git a/renovate.json5 b/renovate.json5 index 520f132d..a6430424 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -1,6 +1,6 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:recommended", ":disableRateLimiting"], + "extends": ["config:recommended", ":disableRateLimiting", "regexManagers:biomeVersions"], "minimumReleaseAge": "5 days", "ignorePaths": ["**/front/**"], "packageRules": [ diff --git a/shell.nix b/shell.nix index 406c8321..e724203c 100644 --- a/shell.nix +++ b/shell.nix @@ -34,9 +34,8 @@ in libmediainfo ffmpeg-full postgresql_15 - eslint_d - prettierd pgformatter + biome ]; DOTNET_ROOT = "${dotnet}";