Skip to content

Commit f91e443

Browse files
authored
feat: add linter & switch formatter to biome (gitify-app#976)
1 parent 569bc0e commit f91e443

Some content is hidden

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

68 files changed

+459
-284
lines changed

.github/workflows/run-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
node-version-file: '.nvmrc'
2020
cache: 'pnpm'
2121
- run: pnpm install
22-
- run: pnpm prettier:check
22+
- run: pnpm lint:check
2323
- run: pnpm tsc --noEmit
2424
- run: pnpm test -- --coverage --runInBand --verbose
2525
- name: Coveralls

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ temp/
7373

7474
dist/
7575
build/
76-
.vscode/settings.json

.prettierrc

-4
This file was deleted.

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["biomejs.biome"]
3+
}

.vscode/settings.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll.eslint": "explicit",
4+
"source.organizeImports.biome": "explicit",
5+
"quickfix.biome": "explicit"
6+
},
7+
"editor.defaultFormatter": "biomejs.biome"
8+
}

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ The release process is automated. Follow the steps below.
4646

4747
### Tests
4848

49-
There are 2 checks - one for prettier and one for the unit tests with `jest`.
49+
There are 2 checks - one for biome (linter & formatter) and one for the unit tests with `jest`.
5050

51-
```
52-
// Run prettier to check
53-
pnpm prettier:check
51+
```shell
52+
# Run biome to check linting and formatting
53+
pnpm lint:check
5454

55-
// Run linter & unit tests with coverage
56-
pnpm test
55+
# Run unit tests with coverage
56+
pnpm test
5757

58-
// If you want to pass arguments to jest (or other `pnpm` commands)
59-
// like `--watch`, you can prepend `--` to the command
60-
pnpm test -- --watch
58+
# If you want to pass arguments to jest (or other `pnpm` commands)
59+
# like `--watch`, you can prepend `--` to the command
60+
pnpm test -- --watch
6161
```
6262

6363
### FAQ

biome.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true,
10+
"correctness": {
11+
"useExhaustiveDependencies": "warn"
12+
}
13+
}
14+
},
15+
"vcs": {
16+
"enabled": true,
17+
"clientKind": "git",
18+
"useIgnoreFile": true
19+
},
20+
"formatter": {
21+
"enabled": true,
22+
"indentStyle": "space",
23+
"indentWidth": 2
24+
},
25+
"javascript": {
26+
"formatter": {
27+
"quoteStyle": "single",
28+
"jsxQuoteStyle": "double"
29+
}
30+
},
31+
"json": {
32+
"parser": {
33+
"allowComments": true
34+
}
35+
}
36+
}

package.json

+10-13
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"make:linux": "electron-builder --linux",
1111
"make:macos": "electron-builder --mac --universal",
1212
"make:win": "electron-builder --win",
13-
"prettier:check": "prettier --check '*.{html,js,json,md,ts,tsx}'",
14-
"prettier:apply": "prettier --write '*.{html,js,json,md,ts,tsx}'",
13+
"lint:check": "biome check *",
14+
"lint": "biome check --apply *",
1515
"test": "jest",
1616
"start": "electron . --enable-logging",
1717
"prepare": "husky"
@@ -50,6 +50,10 @@
5050
{
5151
"name": "Adam Setch",
5252
"url": "https://github.com/setchy"
53+
},
54+
{
55+
"name": "Afonso Ramos",
56+
"url": "https://github.com/afonsojramos"
5357
}
5458
],
5559
"license": "MIT",
@@ -76,9 +80,7 @@
7680
"gatekeeperAssess": false,
7781
"entitlements": "./entitlements/entitlements.mac.plist",
7882
"entitlementsInherit": "./entitlements/entitlements.mac.plist",
79-
"publish": [
80-
"github"
81-
],
83+
"publish": ["github"],
8284
"extendInfo": {
8385
"NSBluetoothAlwaysUsageDescription": null,
8486
"NSBluetoothPeripheralUsageDescription": null,
@@ -98,12 +100,7 @@
98100
"oneClick": false
99101
},
100102
"linux": {
101-
"target": [
102-
"AppImage",
103-
"deb",
104-
"rpm",
105-
"snap"
106-
],
103+
"target": ["AppImage", "deb", "rpm", "snap"],
107104
"category": "Development",
108105
"maintainer": "Emmanouil Konstantinidis"
109106
},
@@ -127,6 +124,7 @@
127124
"typescript": "5.4.4"
128125
},
129126
"devDependencies": {
127+
"@biomejs/biome": "1.6.4",
130128
"@electron/notarize": "2.3.0",
131129
"@testing-library/react": "14.2.2",
132130
"@types/jest": "29.5.12",
@@ -146,7 +144,6 @@
146144
"nock": "13.5.4",
147145
"postcss": "8.4.38",
148146
"postcss-loader": "8.1.1",
149-
"prettier": "3.2.5",
150147
"react-test-renderer": "18.2.0",
151148
"rimraf": "5.0.5",
152149
"style-loader": "3.3.4",
@@ -158,6 +155,6 @@
158155
},
159156
"packageManager": "[email protected]",
160157
"lint-staged": {
161-
"*.{html,js,json,md,ts,tsx}": "prettier --write"
158+
"*.{html,js,json,md,ts,tsx}": "biome format --write"
162159
}
163160
}

pnpm-lock.yaml

+91-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__mocks__/mock-state.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Theme, AuthState, SettingsState } from '../types';
2-
import { mockedUser, mockedEnterpriseAccounts } from './mockedData';
1+
import { type AuthState, type SettingsState, Theme } from '../types';
2+
import { mockedEnterpriseAccounts, mockedUser } from './mockedData';
33

44
export const mockAccounts: AuthState = {
55
token: 'token-123-456',

0 commit comments

Comments
 (0)