Skip to content

Commit

Permalink
Replace ESLint and Prettier with Biome (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj authored Jun 5, 2024
1 parent ec8e6c6 commit 9d092d1
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 1,756 deletions.
48 changes: 6 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache Yarn cache
uses: actions/cache@v4
env:
cache-name: yarn-cache
with:
path: ~/.yarn/berry/cache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn --immutable
- name: Setup Biome
uses: biomejs/setup-biome@v2

- name: Run tests
run: yarn lint
run: biome lint

typescript:
name: Type checking
Expand Down Expand Up @@ -82,29 +64,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache Yarn cache
uses: actions/cache@v4
env:
cache-name: yarn-cache
with:
path: ~/.yarn/berry/cache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn --immutable
- name: Setup Biome
uses: biomejs/setup-biome@v2

- name: Run formatting
run: yarn format
run: biome format

unit:
name: Unit tests
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarn lint-staged
yarn format --staged --no-errors-on-unmatched --write
3 changes: 0 additions & 3 deletions .lintstagedrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "eamodio.gitlens", "esbenp.prettier-vscode"],
"recommendations": ["biomejs.biome", "eamodio.gitlens"],
"unwantedRecommendations": ["dbaeumer.jshint"]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"search.exclude": {
"**/.yarn": true
Expand Down
43 changes: 43 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"files": {
"ignore": [".tsimp", "coverage", "dist", ".pnp.cjs", ".pnp.loader.mjs"]
},
"formatter": {
"lineWidth": 100,
"indentStyle": "space"
},
"linter": {
"rules": {
"complexity": {
"noUselessSwitchCase": "off"
},
"suspicious": {
"noConsoleLog": "warn"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"overrides": [
{
"include": ["**/package.json"],
"formatter": {
"lineWidth": 1
}
},
{
"include": ["**/vite.config.ts"],
"linter": {
"rules": {
"suspicious": {
"noConsoleLog": "off"
}
}
}
}
]
}
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"build-cjs": "tsc --project tsconfig.build.json --outDir dist/cjs --module commonjs --moduleResolution node --verbatimModuleSyntax false",
"build-cjs-package": "echo '{\n \"type\": \"commonjs\"\n}' > dist/cjs/package.json",
"clean": "rimraf dist",
"format": "prettier --check . --cache",
"lint": "eslint .",
"format": "biome format",
"lint": "biome lint",
"postinstall": "husky",
"prepack": "yarn clean && yarn build",
"test": "yarn lint && yarn tsc && yarn format && yarn unit",
Expand All @@ -36,18 +36,12 @@
},
"license": "MIT",
"devDependencies": {
"eslint": "^8.56.0",
"eslint-config-wojtekmaj": "^1.0.0",
"@biomejs/biome": "^1.8.0",
"husky": "^9.0.0",
"lint-staged": "^15.0.0",
"prettier": "^3.2.0",
"rimraf": "^3.0.0",
"typescript": "^5.4.2",
"vitest": "^1.0.2"
},
"resolutions": {
"eslint-plugin-import": "npm:eslint-plugin-i@^2.28.0"
},
"publishConfig": {
"access": "public",
"provenance": true
Expand Down
Loading

0 comments on commit 9d092d1

Please sign in to comment.