From d5b2974d9f2129c86b6dd70ca595f43aeb03d389 Mon Sep 17 00:00:00 2001 From: Fleny Date: Wed, 20 Aug 2025 22:03:42 +0200 Subject: [PATCH] chore: use `biome check` instead of separate lint and format commands (#4320) --- .github/workflows/lib-check.yml | 2 +- README.md | 9 +++------ package.json | 5 ++--- packages/benchmarks/package.json | 3 +-- packages/bot/package.json | 3 +-- packages/discordeno/package.json | 3 +-- packages/gateway/package.json | 3 +-- packages/rest/package.json | 3 +-- packages/types/package.json | 3 +-- packages/utils/package.json | 3 +-- turbo.json | 5 +---- website/docs/contributing.md | 12 ++++++------ website/package.json | 3 +-- 13 files changed, 21 insertions(+), 36 deletions(-) diff --git a/.github/workflows/lib-check.yml b/.github/workflows/lib-check.yml index 97299b122..5129f83e1 100644 --- a/.github/workflows/lib-check.yml +++ b/.github/workflows/lib-check.yml @@ -72,7 +72,7 @@ jobs: path: .turbo key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - name: Check Formatting - run: yarn lint --cache-dir=".turbo" + run: yarn check:all test-type-unit-and-integration-test: name: Typecheck Tests diff --git a/README.md b/README.md index 2a2ae0529..044443e28 100644 --- a/README.md +++ b/README.md @@ -137,14 +137,11 @@ yarn test:unit Other useful information are available on the [website under the contributing documentation](https://discordeno.js.org/docs/contributing) Other useful scripts -(if you run in the package's directory, you need build dist before for test and types before for lint/fmt. Running in root directory should automatically do it for you) +(if you run in a package's directory, you need to build dist before test and build types before check. Running in root directory should automatically do it for you) ```sh -# check style -yarn lint - -# format code -yarn fmt +# format and lint the code +yarn check # check type yarn test:type diff --git a/package.json b/package.json index 89042fd9b..1a2f5b8c6 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,8 @@ "test:e2e": "turbo test:e2e", "test:type": "turbo build:type", "test:test-type": "turbo test:test-type", - "fmt": "turbo fmt", - "lint": "turbo lint", - "format": "biome format --write", + "check": "turbo check", + "check:all": "biome check --write", "postinstall": "husky" }, "devDependencies": { diff --git a/packages/benchmarks/package.json b/packages/benchmarks/package.json index 5709e3674..3b9b66fe0 100644 --- a/packages/benchmarks/package.json +++ b/packages/benchmarks/package.json @@ -17,8 +17,7 @@ "scripts": { "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "release-build": "yarn build && yarn build:type", - "fmt": "biome format --write", - "lint": "biome lint --write", + "check": "biome check --write", "build": "swc src --strip-leading-paths --delete-dir-on-start --out-dir dist", "build-message": "swc src/generateMessage.ts --strip-leading-paths -C sourceMaps=false --out-dir ../../scripts", "bench": "node dist/index.js" diff --git a/packages/bot/package.json b/packages/bot/package.json index d6587b083..c58849639 100644 --- a/packages/bot/package.json +++ b/packages/bot/package.json @@ -22,8 +22,7 @@ "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "release-build": "yarn build && yarn build:type", - "fmt": "biome format --write", - "lint": "biome lint --write", + "check": "biome check --write", "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno", "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'", diff --git a/packages/discordeno/package.json b/packages/discordeno/package.json index ce6aa7bed..a427c6dce 100644 --- a/packages/discordeno/package.json +++ b/packages/discordeno/package.json @@ -22,8 +22,7 @@ "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "release-build": "yarn build && yarn build:type", - "fmt": "biome format --write", - "lint": "biome lint --write", + "check": "biome check --write", "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno", "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'", diff --git a/packages/gateway/package.json b/packages/gateway/package.json index 83acdd960..cc5de7455 100644 --- a/packages/gateway/package.json +++ b/packages/gateway/package.json @@ -22,8 +22,7 @@ "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "release-build": "yarn build && yarn build:type", - "fmt": "biome format --write", - "lint": "biome lint --write", + "check": "biome check --write", "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway", "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'", diff --git a/packages/rest/package.json b/packages/rest/package.json index 8db6d0b06..7f53d0b98 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -22,8 +22,7 @@ "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "release-build": "yarn build && yarn build:type", - "fmt": "biome format --write", - "lint": "biome lint --write", + "check": "biome check --write", "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest", "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'", diff --git a/packages/types/package.json b/packages/types/package.json index a36b782d6..519a8bc5c 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -22,8 +22,7 @@ "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "release-build": "yarn build && yarn build:type", - "fmt": "biome format --write", - "lint": "biome lint --write", + "check": "biome check --write", "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils", "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'", diff --git a/packages/utils/package.json b/packages/utils/package.json index 12c0e0b4e..9e7e9e430 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -22,8 +22,7 @@ "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build:type": "tsc --skipDefaultLibCheck --declaration --emitDeclarationOnly --declarationDir dist/types", "release-build": "yarn build && yarn build:type", - "fmt": "biome format --write", - "lint": "biome lint --write", + "check": "biome check --write", "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils", "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'", diff --git a/turbo.json b/turbo.json index 2f02bfc3e..a65608828 100644 --- a/turbo.json +++ b/turbo.json @@ -35,12 +35,9 @@ "outputs": ["coverage/**"], "env": ["DISCORD_TOKEN", "E2E_TEST_GUILD_ID"] }, - "lint": { + "check": { "dependsOn": ["build:type"], "cache": false - }, - "fmt": { - "cache": false } } } diff --git a/website/docs/contributing.md b/website/docs/contributing.md index f348c22ac..709bb853a 100644 --- a/website/docs/contributing.md +++ b/website/docs/contributing.md @@ -125,15 +125,15 @@ This will invoke the Typescript compiler (tsc) to compile the type definitions ( This will run both the `build` script and `build:type` one. -#### `yarn fmt` +#### `yarn check` -This will format your code to match the rest of the codebase. +This will do all the checking, linting and formatting to make sure your code follows the linting and formatting rules in place. -This will run every time you make a commit. If you disable this you should still run it manually before creating the pr +Every time you make a commit a check will also run. If you disable this you should still run it manually before creating the pr -#### `yarn lint` +#### `yarn check:all` -This will do all the checking and linting to make sure your code is in a useable state. There is also one other key thing to note about this. When you change something in the `@discordeno/types` package, you can run `yarn lint` to rebuild all the types. +This is a script that only exists in the root of the repository. It will check all the files in repo including examples, website, etc #### `yarn test:unit` @@ -185,5 +185,5 @@ This requires you have setup the required environment variables, see above for m - If the contribution is relatively small go ahead and do it! If it is a larger change, I would highly recommend you read the guides we have on the website in order to understand our library better before undertaking such a big action. - If an issue exists for the contribution you want to make, leave a comment on it so no one else begins working on it as well. If an issue does NOT exist for the contribution, then create an issue first before working on it to get some feedback to decide whether it is worth doing. -- Formatting and linting will be automatically handled by Husky and lint-staged. However, if it doesn't work you can format by doing `yarn fmt` and you can lint by doing `yarn lint`. +- Formatting and linting will be automatically handled by Husky and lint-staged. However, if it doesn't work you can format and lint by doing `yarn check` - If you want to edit a docker app (rest proxy for example), the website or some examples you will need to run `yarn` to install the dependencies of those diff --git a/website/package.json b/website/package.json index 092fa214a..5bb7332ba 100644 --- a/website/package.json +++ b/website/package.json @@ -13,8 +13,7 @@ "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", "typecheck": "tsc", - "lint": "biome lint --write", - "format": "biome format --write" + "check": "biome check --write" }, "dependencies": { "@docusaurus/core": "^3.8.1",