build(client): Set up biome to organize imports (#20117)

This change initializes biome in the client release group and uses it
for import organization. I updated fluid-build task config to account
for the new tasks. They are run as part of the format task and the lint
task. However, since no projects define the check:biome and format:biome
tasks yet (other than in build-tools), the change won't take effect
immediately.

Once merged, additional PRs will add the tasks to projects across the
repo to start enforcing import organization.
This commit is contained in:
Tyler Butler 2024-03-14 12:07:19 -07:00 коммит произвёл GitHub
Родитель 8783baae6a
Коммит 061ad5b82d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 153 добавлений и 4 удалений

46
biome.json Normal file
Просмотреть файл

@ -0,0 +1,46 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"root": ".",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": true,
"ignore": [
"**/*.generated.*",
"**/_api-extractor-temp/**",
"**/test/snapshots/content/**",
"**/localOdspSnapshots/**",
"**/biome.jsonc"
],
"maxSize": 2097152
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": false,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": false
},
"overrides": [
{
"include": ["**/.vscode/**", "**/tsconfig*.json", "**/api-extractor*.json"],
"json": {
"parser": {
"allowComments": true,
"allowTrailingCommas": true
},
"formatter": {
"trailingCommas": "all"
}
}
}
]
}

Просмотреть файл

@ -107,7 +107,7 @@ module.exports = {
script: false,
},
"format": {
dependsOn: ["format:prettier", "format:biome"],
dependsOn: ["prettier:fix", "format:prettier", "format:biome"],
script: false,
},
"check:biome": [],
@ -252,8 +252,8 @@ module.exports = {
"tools/telemetry-generator/package-lock.json", // Workaround to allow version 2 while we move it to pnpm
],
"npm-package-json-prettier": [
// These packages use biome for formatting
"build-tools/",
// This rule is temporarily disabled for all projects while we update the repo to use different formatting
".*",
],
"npm-package-json-scripts-args": [
// server/routerlicious and server/routerlicious/packages/routerlicious use

Просмотреть файл

@ -59,7 +59,8 @@
"clean:root": "rimraf --glob \"*.done.build.log\"",
"eslint": "fluid-build --task eslint",
"eslint:fix": "fluid-build --task eslint:fix",
"format": "npm run prettier:root:fix && pnpm run -r --no-sort --stream format",
"format": "fluid-build --task format",
"format:biome": "fluid-build --task format:biome",
"format:changed": "npm run format:changed:main",
"format:changed:main": "pretty-quick --branch main",
"format:changed:next": "pretty-quick --branch next",
@ -155,6 +156,7 @@
"temp-directory": "nyc/.nyc_output"
},
"devDependencies": {
"@biomejs/biome": "^1.6.1",
"@changesets/cli": "^2.26.1",
"@fluid-private/changelog-generator-wrapper": "file:tools/changelog-generator-wrapper",
"@fluid-tools/build-cli": "^0.34.0",
@ -254,6 +256,7 @@
"checks": {
"dependsOn": [
"^checks",
"check:format",
"generate:packageList",
"policy-check",
"layer-check",
@ -267,6 +270,7 @@
"checks:fix": {
"dependsOn": [
"^checks:fix",
"format",
"generate:packageList",
"policy-check:fix",
"syncpack:deps:fix",
@ -309,6 +313,15 @@
"*"
]
},
"format": {
"dependsOn": [
"prettier:root:fix",
"^prettier:fix",
"^format:prettier",
"^format:biome"
],
"script": false
},
"generate:packageList": {
"dependsOn": [
"generate:packageList:internal-build",

Просмотреть файл

@ -19,6 +19,7 @@ importers:
.:
specifiers:
'@biomejs/biome': ^1.6.1
'@changesets/cli': ^2.26.1
'@fluid-private/changelog-generator-wrapper': file:tools/changelog-generator-wrapper
'@fluid-tools/build-cli': ^0.34.0
@ -48,6 +49,7 @@ importers:
ts2esm: ^1.4.0
typescript: ~5.1.6
devDependencies:
'@biomejs/biome': 1.6.1
'@changesets/cli': 2.26.2
'@fluid-private/changelog-generator-wrapper': file:tools/changelog-generator-wrapper
'@fluid-tools/build-cli': 0.34.0_bpztyfltmpuv6lhsgzfwtmxhte
@ -12992,6 +12994,94 @@ packages:
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
dev: true
/@biomejs/biome/1.6.1:
resolution: {integrity: sha512-SILQvA2S0XeaOuu1bivv6fQmMo7zMfr2xqDEN+Sz78pGbAKZnGmg0emsXjQWoBY/RVm9kPCgX+aGEpZZTYaM7w==}
engines: {node: '>=14.*'}
hasBin: true
requiresBuild: true
optionalDependencies:
'@biomejs/cli-darwin-arm64': 1.6.1
'@biomejs/cli-darwin-x64': 1.6.1
'@biomejs/cli-linux-arm64': 1.6.1
'@biomejs/cli-linux-arm64-musl': 1.6.1
'@biomejs/cli-linux-x64': 1.6.1
'@biomejs/cli-linux-x64-musl': 1.6.1
'@biomejs/cli-win32-arm64': 1.6.1
'@biomejs/cli-win32-x64': 1.6.1
dev: true
/@biomejs/cli-darwin-arm64/1.6.1:
resolution: {integrity: sha512-KlvY00iB9T/vFi4m/GXxEyYkYnYy6aw06uapzUIIdiMMj7I/pmZu7CsZlzWdekVD0j+SsQbxdZMsb0wPhnRSsg==}
engines: {node: '>=14.*'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@biomejs/cli-darwin-x64/1.6.1:
resolution: {integrity: sha512-jP4E8TXaQX5e3nvRJSzB+qicZrdIDCrjR0sSb1DaDTx4JPZH5WXq/BlTqAyWi3IijM+IYMjWqAAK4kOHsSCzxw==}
engines: {node: '>=14.*'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@biomejs/cli-linux-arm64-musl/1.6.1:
resolution: {integrity: sha512-YdkDgFecdHJg7PJxAMaZIixVWGB6St4yH08BHagO0fEhNNiY8cAKEVo2mcXlsnEiTMpeSEAY9VxLUrVT3IVxpw==}
engines: {node: '>=14.*'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@biomejs/cli-linux-arm64/1.6.1:
resolution: {integrity: sha512-nxD1UyX3bWSl/RSKlib/JsOmt+652/9yieogdSC/UTLgVCZYOF7u8L/LK7kAa0Y4nA8zSPavAQTgko7mHC2ObA==}
engines: {node: '>=14.*'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@biomejs/cli-linux-x64-musl/1.6.1:
resolution: {integrity: sha512-aSISIDmxq04NNy7tm4x9rBk2vH0ub2VDIE4outEmdC2LBtEJoINiphlZagx/FvjbsqUfygent9QUSn0oREnAXg==}
engines: {node: '>=14.*'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@biomejs/cli-linux-x64/1.6.1:
resolution: {integrity: sha512-BYAzenlMF3QdngjNFw9QVBXKGNzeecqwF3pwDgUGEvU7OJpn1/lyVkJVxYPtVGRNdjQ9e6l/s8NjKuBpW/ZR4Q==}
engines: {node: '>=14.*'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@biomejs/cli-win32-arm64/1.6.1:
resolution: {integrity: sha512-/eCHQKZ1kEawUpkSuXq4urtxMsD1P1678OPG3zNKt3ru16AqqspLdO3jzBe3k74xCPYnQ36e9Yqc97Mo0qgPtg==}
engines: {node: '>=14.*'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@biomejs/cli-win32-x64/1.6.1:
resolution: {integrity: sha512-5TUZbzBwnDLFxLVGEPsorNi6eC2Gt+z4Oei9Qvq0M/4c4/mjZ96ABgwao/tMxf4ZBr/qyy2YdvF+gX9Rc+xC0A==}
engines: {node: '>=14.*'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@cerner/duplicate-package-checker-webpack-plugin/2.3.0_webpack@5.89.0:
resolution: {integrity: sha512-2FdUL/10qOjXzPTt/2dcjQPHDcsI+svvdU3KERGZaUvH5IwDdzE+nGLAx1+ICxhr6cqU29zvWR6GHGOFp+fbWA==}
engines: {node: '>=10'}