chore: use biome check instead of separate lint and format commands (#4320)

This commit is contained in:
Fleny
2025-08-20 22:03:42 +02:00
committed by GitHub
parent 49a8cd1aa6
commit d5b2974d9f
13 changed files with 21 additions and 36 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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": {

View File

@@ -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"

View File

@@ -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'",

View File

@@ -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'",

View File

@@ -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'",

View File

@@ -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'",

View File

@@ -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'",

View File

@@ -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'",

View File

@@ -35,12 +35,9 @@
"outputs": ["coverage/**"],
"env": ["DISCORD_TOKEN", "E2E_TEST_GUILD_ID"]
},
"lint": {
"check": {
"dependsOn": ["build:type"],
"cache": false
},
"fmt": {
"cache": false
}
}
}

View File

@@ -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

View File

@@ -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",