Skip to content

Commit

Permalink
chore: Lint with Biome (#2624)
Browse files Browse the repository at this point in the history
## What's the purpose of this pull request?

- Replaces the combination eslint + prettier for
[biome](https://biomejs.dev/).
- Configure a single lint root for the whole monorepo. It is great for
simplicity. Since biome is pretty fast, we can do this without being
afraid of the lint command being slow.
- It **doest not** fixes the lint issues, this would make this PR big 🦕
(wait for the next one)

## References

- https://biomejs.dev/
- https://github.com/vtex/shoreline
  • Loading branch information
matheusps authored Jan 27, 2025
1 parent f3c1d55 commit 8b2dc1b
Show file tree
Hide file tree
Showing 19 changed files with 168 additions and 91 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ jobs:
- name: Size
run: yarn size

- name: Lint
run: yarn lint
# Temporary disable
# - name: Lint
# run: yarn lint

- name: Test
run: yarn test
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ jobs:
- name: Size
run: yarn size

- name: Lint
run: yarn lint
# Temporary disable
# - name: Lint
# run: yarn lint

- name: Test
run: yarn test
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
.turbo
.next

# VSCode
.vscode

# Logs
logs
*.log
Expand Down
14 changes: 0 additions & 14 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", "editorconfig.editorconfig"]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.tabSize": 2,
"editor.insertSpaces": true,
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"editor.snippetSuggestions": "bottom",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
4 changes: 0 additions & 4 deletions apps/site/.eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
"sass": "^1.57.1"
},
"devDependencies": {
"@faststore/eslint-config": "^3.9.0",
"@types/node": "^18.11.16",
"eslint": "7.32.0",
"react-docgen-typescript": "^2.2.2",
"typescript": "^4.9.4"
}
Expand Down
32 changes: 32 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": true,
"ignore": [".next", "dist", ".turbo", "package.json"]
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "es5"
}
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
"scripts": {
"build": "turbo run build --log-order=grouped",
"dev": "turbo run dev --parallel --no-cache",
"lint": "turbo run lint",
"lint": "biome check .",
"lint:fix": "biome check --apply .",
"test": "turbo run test",
"size": "turbo run size",
"release": "lerna version --conventional-commits --yes && lerna publish from-git --yes",
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --ignore-path .gitignore --write \"**/*.{js,jsx,ts,tsx,md}\""
"clean": "turbo run clean && rm -rf node_modules"
},
"workspaces": [
"packages/*",
"apps/*"
],
"devDependencies": {
"@faststore/eslint-config": "^3.0.0",
"@biomejs/biome": "1.9.4",
"lerna": "^8.0.0",
"prettier": "^3.1.0",
"turbo": "^2.3.3"
"turbo": "^2.3.4"
},
"version": "0.0.0",
"volta": {
Expand Down
3 changes: 0 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"build": "graphql-codegen --config codegen.yml && (yarn build:cjs && yarn build:esm)",
"build:cjs": "tsc --module commonjs --moduleResolution node10 --outDir dist/cjs && copyfiles \"src/**/*.graphql\" dist/cjs",
"build:esm": "tsc && copyfiles \"src/**/*.graphql\" dist/esm",
"lint": "eslint src/**/*.ts",
"test": "jest",
"generate": "graphql-codegen --config codegen.yml"
},
Expand All @@ -51,7 +50,6 @@
},
"devDependencies": {
"@envelop/core": "^5.0.2",
"@faststore/eslint-config": "^3.9.0",
"@faststore/shared": "^3.9.0",
"@graphql-codegen/cli": "2.2.0",
"@graphql-codegen/typescript": "2.2.2",
Expand All @@ -61,7 +59,6 @@
"@types/sanitize-html": "^2.9.1",
"concurrently": "^6.2.1",
"copyfiles": "^2.4.1",
"eslint": "7.32.0",
"express": "^4.17.3",
"express-graphql": "^0.12.0",
"graphql": "^15.6.0",
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
"path": "^0.12.7"
},
"devDependencies": {
"@faststore/eslint-config": "^3.9.0",
"@faststore/shared": "^3.9.0",
"@types/chai": "^4",
"@types/degit": "^2.8.6",
"@types/fs-extra": "^9.0.13",
"@types/node": "^16.11.63",
"chai": "^4",
"eslint": "7.32.0",
"jest": "^29.7.0",
"oclif": "^3",
"shx": "^0.3.3",
Expand All @@ -63,10 +61,8 @@
},
"scripts": {
"build": "shx rm -rf dist && tsc -b",
"lint": "eslint src/**/*.ts",
"test": "jest src/**/*.test.ts",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "na run lint",
"prepack": "na run && oclif manifest && oclif readme",
"version": "oclif readme && git add README.md"
},
Expand Down
3 changes: 0 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"scripts": {
"dev": "tsc --watch",
"build": "tsc --module commonjs --outDir dist/cjs && tsc --module esnext --outDir dist/esm",
"lint": "eslint src/**/*.{ts,tsx}",
"test": "jest"
},
"repository": {
Expand All @@ -35,14 +34,12 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@faststore/eslint-config": "^3.9.0",
"@faststore/shared": "^3.9.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^14.3.0",
"@types/jest-axe": "^3.5.9",
"@types/react": "^18.2.42",
"@types/react-dom": "^18.2.17",
"eslint": "7.32.0",
"jest": "^29.7.0",
"jest-axe": "^9.0.0",
"jest-environment-jsdom": "^29.7.0",
Expand Down
6 changes: 3 additions & 3 deletions .eslintrc.js → packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
root: true,
extends: "@faststore",
extends: '@faststore',
settings: {
next: {
rootDir: "apps/site/"
rootDir: 'apps/site/',
},
},
};
}
5 changes: 1 addition & 4 deletions packages/graphql-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@
"sideEffects": false,
"scripts": {
"build": "cross-env NODE_ENV=production tsc",
"dev": "tsc --watch",
"lint": "eslint src/**/*.ts"
"dev": "tsc --watch"
},
"peerDependencies": {
"graphql": "^15.6.1"
},
"devDependencies": {
"@faststore/eslint-config": "^3.9.0",
"@faststore/shared": "^3.9.0",
"cross-env": "^7.0.2",
"eslint": "7.32.0",
"typescript": "^4.2.4"
}
}
5 changes: 1 addition & 4 deletions packages/lighthouse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
],
"scripts": {
"dev": "tsc --watch",
"build": "tsc",
"lint": "eslint src/**/*.ts"
"build": "tsc"
},
"devDependencies": {
"@faststore/eslint-config": "^3.9.0",
"@faststore/shared": "^3.9.0",
"eslint": "7.32.0",
"typescript": "^4.2.4"
}
}
1 change: 0 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"scripts": {
"dev": "tsc --watch",
"build": "tsc",
"lint": "eslint src/**/*.{ts,tsx}",
"test": "jest",
"size": "size-limit",
"analyze": "size-limit --why"
Expand Down
3 changes: 0 additions & 3 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"scripts": {
"dev": "tsc --watch",
"build": "tsc --module commonjs --outDir dist/cjs && tsc --module esnext --outDir dist/esm",
"lint": "eslint src/**/*.{ts,tsx}",
"size": "size-limit",
"analyze": "size-limit --why"
},
Expand All @@ -59,12 +58,10 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@faststore/eslint-config": "^3.9.0",
"@faststore/shared": "^3.9.0",
"@size-limit/preset-small-lib": "^7.0.8",
"@types/tabbable": "^3.1.1",
"babel-loader": "^8.2.5",
"eslint": "7.32.0",
"size-limit": "^7.0.8",
"typescript": "^4.2.4"
},
Expand Down
Loading

0 comments on commit 8b2dc1b

Please sign in to comment.