Skip to content

Commit

Permalink
refactor: switch from prettier to biome (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter authored Jul 11, 2024
1 parent 373da7b commit 019c2d5
Show file tree
Hide file tree
Showing 15 changed files with 243 additions and 100 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
submodules: "recursive"

- name: Setup pnpm
uses: pnpm/action-setup@v3
Expand All @@ -23,10 +23,10 @@ jobs:
with:
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
node-version-file: '.nvmrc'
node-version-file: ".nvmrc"

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install

- name: Build and zip
run: |
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
node-version-file: ".nvmrc"

- name: Install dependencies
run: pnpm install

- name: Check files with Biome
run: |
pnpm biome ci --reporter=github
4 changes: 2 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
with:
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
node-version-file: '.nvmrc'
node-version-file: ".nvmrc"

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install

- name: Build and zip
run: |
Expand Down
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

14 changes: 0 additions & 14 deletions .prettierrc

This file was deleted.

5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"prettier.enable": false,
"biome.enabled": true,
"editor.defaultFormatter": "biomejs.biome"
}
69 changes: 69 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignore": ["vscode-icons/**"]
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "tab",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto",
"ignore": ["pnpm-lock.yaml"]
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedImports": "warn",
"noUnusedVariables": "warn",
"useArrayLiterals": "error"
},
"style": {
"noNegationElse": "error",
"useCollapsedElseIf": "error",
"useConsistentArrayType": {
"level": "error",
"options": {
"syntax": "generic"
}
},
"useForOf": "error"
},
"suspicious": {
"useAwait": "error"
},
"complexity": {
"useSimplifiedLogicExpression": "error"
}
}
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "all",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto"
}
},
"overrides": [
{
"include": ["**/*.{yml,yaml,md}"],
"formatter": { "indentStyle": "space", "indentWidth": 2 }
}
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"webext-permission-toggle": "5.1.0"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@humanfs/node": "0.16.3",
"@humanfs/types": "0.13.0",
"jiti": "1.21.6",
"prettier": "3.3.1",
"svgo": "3.2.0",
"wxt": "0.18.11"
},
"scripts": {
"format": "prettier --write .",
"check": "biome check",
"dev": "wxt",
"dev:firefox": "wxt --browser firefox",
"build": "wxt build",
Expand Down
101 changes: 91 additions & 10 deletions pnpm-lock.yaml

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

5 changes: 1 addition & 4 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":semanticCommitTypeAll(chore)"
],
"extends": ["config:recommended", ":semanticCommitTypeAll(chore)"],
"rangeStrategy": "bump"
}
2 changes: 1 addition & 1 deletion src/entries/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { observe } from 'selector-observer';

import { SELECTORS } from '@/constants';
import { flavor } from '@/storage';
import { replaceIconInRow, injectStyles } from './lib';
import { injectStyles, replaceIconInRow } from './lib';

export default defineContentScript({
// Make sure this value is updated in wxt.config.ts as well.
Expand Down
Loading

0 comments on commit 019c2d5

Please sign in to comment.