Skip to content

Commit 6af3f34

Browse files
authored
JavaScript: replace prettier and eslint with biome.
2 parents 0cdcb18 + 7f47b66 commit 6af3f34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+336
-728
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ jobs:
2525
os: macos-15-intel
2626
- name: macOS (ARM)
2727
os: macos-15
28-
- name: Code formatting
29-
os: ubuntu-22.04
30-
- name: Linting
28+
- name: Code formatting and linting
3129
os: ubuntu-22.04
3230
steps:
3331
- name: Set the timezone to New Zealand
@@ -54,32 +52,32 @@ jobs:
5452
unzip -j bun.zip -d $env:USERPROFILE\.bun
5553
del bun.zip
5654
echo "$env:USERPROFILE\.bun" >> $env:GITHUB_PATH
55+
- name: Install Biome
56+
if: ${{ matrix.name == 'Code formatting and linting' }}
57+
uses: biomejs/setup-biome@v2
5758
- name: OpenCOR dependencies
5859
if: ${{ matrix.name != 'Windows (ARM)' }}
5960
run: bun install
6061
- name: OpenCOR dependencies (Windows ARM only)
6162
if: ${{ matrix.name == 'Windows (ARM)' }}
6263
run: bun install --cpu=arm64
6364
- name: Build libOpenCOR
64-
if: ${{ (matrix.name != 'Code formatting') && (matrix.name != 'Linting') }}
65+
if: ${{ matrix.name != 'Code formatting and linting' }}
6566
run: bun libopencor
6667
- name: Build OpenCOR
67-
if: ${{ (matrix.name != 'Code formatting') && (matrix.name != 'Linting') }}
68+
if: ${{ matrix.name != 'Code formatting and linting' }}
6869
run: bun run build
6970
- name: Build OpenCOR's Web app
70-
if: ${{ (matrix.name != 'Code formatting') && (matrix.name != 'Linting') }}
71+
if: ${{ matrix.name != 'Code formatting and linting' }}
7172
run: bun build:web
7273
- name: Build OpenCOR's npm library
73-
if: ${{ (matrix.name != 'Code formatting') && (matrix.name != 'Linting') }}
74+
if: ${{ matrix.name != 'Code formatting and linting' }}
7475
run: |
7576
cd src/renderer
7677
bun install
7778
bun build:lib
78-
- name: Code formatting
79-
if: ${{ matrix.name == 'Code formatting' }}
80-
run: bun format:check
81-
- name: Linting
82-
if: ${{ matrix.name == 'Linting' }}
83-
run: bun lint
79+
- name: Code formatting and linting
80+
if: ${{ matrix.name == 'Code formatting and linting' }}
81+
run: biome ci --error-on-warnings
8482
- name: Clean OpenCOR
8583
run: bun clean

.prettierrc.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": ["Vue.volar", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
2+
"recommendations": ["biomejs.biome", "Vue.volar"]
33
}

BUILD.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ npm install -g bun
6363

6464
# Available Scripts
6565

66-
| Script | Description |
67-
| -------------- | --------------------------------------------------------------------- |
68-
| `archive:web` | Archive OpenCOR's Web app |
69-
| `build` | Build OpenCOR |
70-
| `build:web` | Build OpenCOR's Web app |
71-
| `clean` | Clean OpenCOR's environment |
72-
| `dev` | (Build and) start OpenCOR and OpenCOR's Web app with hot reload |
73-
| `dev:web` | (Build and) start OpenCOR's Web app with hot reload |
74-
| `format` | Format the code using [Prettier](https://prettier.io/) |
75-
| `format:check` | Check code formatting without making changes |
76-
| `libopencor` | Build libOpenCOR's native Node.js module |
77-
| `lint` | Lint and automatically fix issues using [ESLint](https://eslint.org/) |
78-
| `release` | (Build and) release OpenCOR for the current platform |
79-
| `start` | (Build and) start (the production version of) OpenCOR |
80-
| `start:web` | (Build and) start (the production version of) OpenCOR's Web app |
81-
| `version:new` | Update the version of OpenCOR |
66+
| Script | Description |
67+
| -------------- | --------------------------------------------------------------- |
68+
| `archive:web` | Archive OpenCOR's Web app |
69+
| `build` | Build OpenCOR |
70+
| `build:web` | Build OpenCOR's Web app |
71+
| `clean` | Clean OpenCOR's environment |
72+
| `dev` | (Build and) start OpenCOR and OpenCOR's Web app with hot reload |
73+
| `dev:web` | (Build and) start OpenCOR's Web app with hot reload |
74+
| `format` | Format the code |
75+
| `format:check` | Check code formatting without making changes |
76+
| `libopencor` | Build libOpenCOR's native Node.js module |
77+
| `lint` | Lint and automatically fix issues |
78+
| `release` | (Build and) release OpenCOR for the current platform |
79+
| `start` | (Build and) start (the production version of) OpenCOR |
80+
| `start:web` | (Build and) start (the production version of) OpenCOR's Web app |
81+
| `version:new` | Update the version of OpenCOR |
8282
8383
# Notes
8484

biome.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"assist": {
3+
"actions": {
4+
"source": {
5+
"organizeImports": "off"
6+
}
7+
}
8+
},
9+
"formatter": {
10+
"includes": ["**/*.css", "**/*.html", "**/*.js", "**/*.json", "**/*.ts", "**/*.vue"],
11+
"indentStyle": "space",
12+
"lineWidth": 120
13+
},
14+
"css": {
15+
"formatter": {
16+
"enabled": true,
17+
"quoteStyle": "single"
18+
}
19+
},
20+
"html": {
21+
"formatter": {
22+
"bracketSameLine": true,
23+
"enabled": true,
24+
"selfCloseVoidElements": "always",
25+
"whitespaceSensitivity": "ignore"
26+
}
27+
},
28+
"javascript": {
29+
"formatter": {
30+
"quoteStyle": "single",
31+
"semicolons": "asNeeded",
32+
"trailingCommas": "none"
33+
}
34+
},
35+
"linter": {
36+
"includes": ["**/*.css", "**/*.js", "**/*.ts", "**/*.vue", "!**/components.d.ts"]
37+
},
38+
"overrides": [
39+
{
40+
"includes": ["**/*.css"],
41+
"linter": {
42+
"rules": {
43+
"complexity": {
44+
"noImportantStyles": "off"
45+
}
46+
}
47+
}
48+
},
49+
{
50+
"includes": ["**/*.vue"],
51+
"linter": {
52+
"rules": {
53+
"style": {
54+
"useConst": "off",
55+
"useImportType": "off"
56+
},
57+
"correctness": {
58+
"noUnusedImports": "off",
59+
"noUnusedVariables": "off"
60+
}
61+
}
62+
}
63+
}
64+
]
65+
}

0 commit comments

Comments
 (0)