Skip to content

feat: add linter & switch formatter to biome #976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install
- run: pnpm prettier:check
- run: pnpm lint:check
- run: pnpm tsc --noEmit
- run: pnpm test -- --coverage --runInBand --verbose
- name: Coveralls
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ temp/

dist/
build/
.vscode/settings.json
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome"]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome"
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ The release process is automated. Follow the steps below.

### Tests

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

```
// Run prettier to check
pnpm prettier:check
```shell
# Run biome to check linting and formatting
pnpm lint:check

// Run linter & unit tests with coverage
pnpm test
# Run unit tests with coverage
pnpm test

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

### FAQ
Expand Down
36 changes: 36 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"useExhaustiveDependencies": "warn"
}
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double"
}
},
"json": {
"parser": {
"allowComments": true
}
}
}
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"make:linux": "electron-builder --linux",
"make:macos": "electron-builder --mac --universal",
"make:win": "electron-builder --win",
"prettier:check": "prettier --check '*.{html,js,json,md,ts,tsx}'",
"prettier:apply": "prettier --write '*.{html,js,json,md,ts,tsx}'",
"lint:check": "biome check *",
"lint": "biome check --apply *",
"test": "jest",
"start": "electron . --enable-logging",
"prepare": "husky"
Expand Down Expand Up @@ -50,6 +50,10 @@
{
"name": "Adam Setch",
"url": "https://github.com/setchy"
},
{
"name": "Afonso Ramos",
"url": "https://github.com/afonsojramos"
}
],
"license": "MIT",
Expand All @@ -76,9 +80,7 @@
"gatekeeperAssess": false,
"entitlements": "./entitlements/entitlements.mac.plist",
"entitlementsInherit": "./entitlements/entitlements.mac.plist",
"publish": [
"github"
],
"publish": ["github"],
"extendInfo": {
"NSBluetoothAlwaysUsageDescription": null,
"NSBluetoothPeripheralUsageDescription": null,
Expand All @@ -98,12 +100,7 @@
"oneClick": false
},
"linux": {
"target": [
"AppImage",
"deb",
"rpm",
"snap"
],
"target": ["AppImage", "deb", "rpm", "snap"],
"category": "Development",
"maintainer": "Emmanouil Konstantinidis"
},
Expand All @@ -127,6 +124,7 @@
"typescript": "5.4.4"
},
"devDependencies": {
"@biomejs/biome": "1.6.4",
"@electron/notarize": "2.3.0",
"@testing-library/react": "14.2.2",
"@types/jest": "29.5.12",
Expand All @@ -146,7 +144,6 @@
"nock": "13.5.4",
"postcss": "8.4.38",
"postcss-loader": "8.1.1",
"prettier": "3.2.5",
"react-test-renderer": "18.2.0",
"rimraf": "5.0.5",
"style-loader": "3.3.4",
Expand All @@ -158,6 +155,6 @@
},
"packageManager": "[email protected]",
"lint-staged": {
"*.{html,js,json,md,ts,tsx}": "prettier --write"
"*.{html,js,json,md,ts,tsx}": "biome format --write"
}
}
100 changes: 91 additions & 9 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions src/__mocks__/mock-state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Theme, AuthState, SettingsState } from '../types';
import { mockedUser, mockedEnterpriseAccounts } from './mockedData';
import { type AuthState, type SettingsState, Theme } from '../types';
import { mockedEnterpriseAccounts, mockedUser } from './mockedData';

export const mockAccounts: AuthState = {
token: 'token-123-456',
Expand Down
Loading
Loading