Skip to content

Commit

Permalink
H-3762, H-3763, H-3757: Experiment with biome (#6031)
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp authored Jan 21, 2025
1 parent 64b5a52 commit 15a67c1
Show file tree
Hide file tree
Showing 61 changed files with 1,036 additions and 930 deletions.
5 changes: 3 additions & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"/markdownlint-cli2/",
"/^prettier/",
"/prettier$/",
"/^@biomejs/",
"/rimraf/",
"/turbo/",
"/yarn-deduplicate/",
Expand Down Expand Up @@ -220,10 +221,10 @@
"matchPackageNames": ["/^@playwright//", "/^playwright/", "/playwright$/"]
},
{
"groupName": "`prettier` npm packages",
"groupName": "`biome` npm packages",
"matchManagers": ["npm"],
"dependencyDashboardApproval": false,
"matchPackageNames": ["/^prettier/", "/prettier$/"]
"matchPackageNames": ["/^@biomejs/"]
},
{
"groupName": "`prosemirror` npm packages",
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ jobs:
- name: Validate package.json generated from Cargo.toml
if: ${{ success() || failure() }}
run: |
cargo -Zscript run --manifest-path ".github/scripts/rust/sync-turborepo.rs" . | xargs yarn prettier --write >/dev/null
cargo -Zscript run --manifest-path ".github/scripts/rust/sync-turborepo.rs" . | xargs yarn fix:package-json
git --no-pager diff --exit-code --color '**/package.json'
- name: Run yarn lint:constraints
Expand Down Expand Up @@ -255,14 +255,26 @@ jobs:
exit 1
fi
- name: Run yarn lint:prettier
- name: Run yarn lint:format
if: ${{ success() || failure() }}
run: |
if ! yarn lint:prettier; then
if ! yarn lint:format; then
echo ''
echo ''
echo 'ℹ️ ℹ️ ℹ️'
echo 'Try running `yarn fix:prettier` locally to apply autofixes.'
echo 'Try running `yarn fix:biome` locally to apply autofixes.'
echo 'ℹ️ ℹ️ ℹ️'
exit 1
fi
- name: Run yarn lint:package-json
if: ${{ success() || failure() }}
run: |
if ! yarn lint:package-json; then
echo ''
echo ''
echo 'ℹ️ ℹ️ ℹ️'
echo 'Try running `yarn fix:package-json` locally to apply autofixes.'
echo 'ℹ️ ℹ️ ℹ️'
exit 1
fi
Expand All @@ -279,9 +291,6 @@ jobs:
exit 1
fi
## TODO: Replace with `yarn fix:yarn-dedupe` after upgrading to Yarn v3+
## https://yarnpkg.com/cli/dedupe
## https://github.com/yarnpkg/berry/issues/2297
- name: Run yarn lint:yarn-deduplicate
if: ${{ success() || failure() }}
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#########################
## Keep in sync with
## - .prettierignore
## - .dockerignore
#########################

Expand Down
2 changes: 1 addition & 1 deletion .justfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ lint:
# Sync the package.json files to the `Cargo.toml` file
[no-cd]
sync-turborepo:
@cargo -Zscript run --manifest-path "{{repo}}/.github/scripts/rust/sync-turborepo.rs" "{{repo}}" | xargs just yarn prettier --write
@cargo -Zscript run --manifest-path "{{repo}}/.github/scripts/rust/sync-turborepo.rs" "{{repo}}" | xargs just yarn fix:package-json

# Format the code using `rustfmt`
[no-cd]
Expand Down
18 changes: 9 additions & 9 deletions .lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ pre-commit:
- rebase
commands:
markdownlint:
tags: frontend style
tags: [frontend, style]
glob: "*.md"
run: yarn run markdownlint-cli2 --fix --no-globs {staged_files} || true
stage_fixed: true
prettier:
tags: frontend style
biome:
tags: [frontend, style]
glob: "*.{cjs,css,js,json,md,mdx,mjs,scss,ts,tsx,yml}"
run: yarn run prettier --write {staged_files} || true
run: yarn run biome format --write --staged || true
stage_fixed: true
yarn:
tags: frontend style
tags: [frontend, style]
glob: "{*/package.json, package.json}"
run: yarn fix:constraints && yarn fix:yarn-deduplicate
run: yarn fix:constraints && yarn fix:yarn-deduplicate && yarn fix:package-json {staged_files}
stage_fixed: true
sqlfluff:
tags: backend style
tags: [backend, style]
glob: "*.sql"
run: sqlfluff fix {staged_files} || true
stage_fixed: true
rust:
tags: backend style
tags: [backend, style]
glob: "*.rs"
run: cargo fmt -- {staged_files} || true
stage_fixed: true
toml:
tags: backend style
tags: [backend, style]
glob: "*.toml"
run: yarn run taplo format {staged_files} || true
stage_fixed: true
6 changes: 3 additions & 3 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ol_multi": 1,
"ol_single": 1,
"ul_multi": 1,
"ul_single": 1,
"ul_single": 1
},
"no-alt-text": false,
"no-bare-urls": false,
Expand All @@ -17,9 +17,9 @@
"no-inline-html": false,
"no-trailing-punctuation": false,
"ol-prefix": { "style": "one" },
"single-title": false,
"single-title": false
},
"gitignore": true,
"globs": ["*.md", "**/*.md"],
"ignores": ["**/LICENSE*.md"],
"ignores": ["**/LICENSE*.md"]
}
188 changes: 0 additions & 188 deletions .prettierignore

This file was deleted.

4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"Codecov.codecov",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"GraphQL.vscode-graphql",
"GraphQL.vscode-graphql-syntax",
"hashicorp.terraform",
"ms-playwright.playwright",
"ms-vscode.vscode-typescript-next",
"vitest.explorer"
"vitest.explorer",
"biomejs.biome"
]
}
18 changes: 18 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"file_types": {
"TOML": [".sqlfluff"],
"JSONC": ["turbo.json"]
},
"auto_install_extensions": {
"biome": true
},
"formatter": {
"language_server": {
"name": "biome"
}
}
}
2 changes: 1 addition & 1 deletion apps/hash-api/codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: CodegenConfig = {
"../../libs/@local/hash-isomorphic-utils/src/graphql/queries/**/*.ts",
],
hooks: {
afterOneFileWrite: ["prettier --write"],
afterOneFileWrite: ["biome format --write --vcs-use-ignore-file=false"],
},
config: {
avoidOptionals: {
Expand Down
Loading

0 comments on commit 15a67c1

Please sign in to comment.