Skip to content

Commit

Permalink
Add Biome, Remove Prettier
Browse files Browse the repository at this point in the history
- Change from Prettier to Biome for formatting
- Add Biome lint targets in Makefile
- Add `lint-check` to CI steps
  • Loading branch information
moshen committed Feb 19, 2024
1 parent 9f76ab7 commit de2cd67
Show file tree
Hide file tree
Showing 5 changed files with 259 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: npm ci

- name: Build and Test
run: make fmt-check test package
run: make fmt-check lint-check test package
publish:
name: Publish
environment: Publish
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@ docker-builder-run: docker-builder-build
/bin/bash -c "cd /app && make dist/libmagic-wrapper.js"

fmt: $(ts_files) $(fmt_files)
npx --no-install prettier --ignore-path .gitignore -w $(ts_files) $(fmt_files)
./node_modules/.bin/biome format --write $(ts_files) $(fmt_files)

fmt-check: $(ts_files) $(fmt_files)
npx --no-install prettier --ignore-path .gitignore -c $(ts_files) $(fmt_files)
./node_modules/.bin/biome format $(ts_files) $(fmt_files)

lint: $(ts_files) $(fmt_files)
./node_modules/.bin/biome lint --apply $(ts_files) $(fmt_files)

lint-check: $(ts_files) $(fmt_files)
./node_modules/.bin/biome lint $(ts_files) $(fmt_files)

update-dependencies:
directories=("." "examples/worker" "examples/stream-detection"); \
Expand Down
21 changes: 21 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"ignoreUnknown": true,
"ignore": ["src/pre.js"]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
250 changes: 228 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
},
"author": "Colin Kennedy <moshen.colin@gmail.com>",
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@types/emscripten": "^1.39.10",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.19",
"glob": "^10.3.10",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"typescript": "^5.3.3"
},
"engines": {
Expand Down

0 comments on commit de2cd67

Please sign in to comment.