Skip to content

Commit

Permalink
feat: biomejs (#1137)
Browse files Browse the repository at this point in the history
Replace `eslint` and `prettier` with `biomejs`
  • Loading branch information
helciofranco authored Mar 18, 2024
1 parent 121a371 commit a0e5cbf
Show file tree
Hide file tree
Showing 19 changed files with 230 additions and 852 deletions.
7 changes: 7 additions & 0 deletions .changeset/new-owls-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fuel-wallet/connections": patch
"@fuel-wallet/types": patch
"fuels-wallet": patch
---

ci: replace prettier and eslint with biomejs (dev)
16 changes: 0 additions & 16 deletions .eslintignore

This file was deleted.

12 changes: 0 additions & 12 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: Run lint
run: |
pnpm ts:check
pnpm lint
pnpm lint:ci
docs:
name: Docs
Expand Down
5 changes: 3 additions & 2 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"**/*.(md|mdx|json|yml|yaml|css|html)": ["prettier --write"],
"*.{js,jsx,ts,tsx,html}": ["prettier --write", "eslint --fix"],
"**/*.(js|jsx|ts|tsx|md|json|mdx|html|css)": [
"biome check --apply-unsafe --diagnostic-level=error --max-diagnostics=1000"
],
".{ts,tsx}": ["tsc --noEmit"]
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node-version=18.14.1
strict-peer-dependencies=false
save-exact=true
16 changes: 0 additions & 16 deletions .prettierignore

This file was deleted.

9 changes: 0 additions & 9 deletions .prettierrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"FuelLabs.sway-vscode-plugin",
"statelyai.stately-vscode",
"firsttris.vscode-jest-runner"
Expand Down
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.prettierPath": "./node_modules/prettier/index.cjs",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"quickfix.biome": "explicit"
},
"[sway]": {
"editor.defaultFormatter": "FuelLabs.sway-vscode-plugin"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "biomejs.biome"
}
}
91 changes: 91 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"formatWithErrors": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "off",
"useExhaustiveDependencies": "off",
"noEmptyPattern": "off"
},
"style": {
"useImportType": "off",
"useEnumInitializers": "off",
"noUnusedTemplateLiteral": "off",
"noNonNullAssertion": "off",
"noInferrableTypes": "off",
"useNodejsImportProtocol": "off",
"useNumberNamespace": "off",
"useExportType": "off"
},
"suspicious": {
"noArrayIndexKey": "off",
"noConfusingVoidType": "off",
"noExplicitAny": "off",
"noImplicitAnyLet": "off",
"noAssignInExpressions": "off",
"noShadowRestrictedNames": "off",
"noDoubleEquals": "off"
},
"complexity": {
"noThisInStatic": "off",
"noStaticOnlyClass": "off",
"noForEach": "off",
"useOptionalChain": "off",
"noUselessSwitchCase": "off",
"useArrowFunction": "off",
"noUselessEmptyExport": "off",
"useLiteralKeys": "off"
},
"performance": {
"noAccumulatingSpread": "off",
"noDelete": "off"
},
"security": {
"noDangerouslySetInnerHtml": "off"
},
"a11y": {
"useButtonType": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingComma": "es5"
}
},
"json": {
"parser": {
"allowTrailingCommas": true
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignore": [
".vscode",
"**/scripts",
"**/node_modules",
"**/.turbo",
"**/build",
"**/dist",
"**/dist-crx",
"pnpm-lock.yaml"
]
}
}
27 changes: 7 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"bugs": {
"url": "https://github.com/FuelLabs/fuels-wallet/issues"
},
"workspaces": [
"./packages/*"
],
"workspaces": ["./packages/*"],
"scripts": {
"build:website": "node ./scripts/build-website/index.mjs",
"build:preview": "turbo run build:preview",
Expand All @@ -41,9 +39,9 @@
"dev:docs": "./scripts/dev.sh --docs",
"dev:crx": "./scripts/dev.sh --crx",
"dev:e2e-contracts": "./scripts/dev.sh --e2e-contracts-test",
"lint": "run-s lint:check prettier:check",
"lint:check": "eslint . --ext .ts,.tsx,.js,.jsx",
"lint:fix": "pnpm lint:check --fix",
"lint:check": "biome check --apply-unsafe .",
"lint:ci": "biome lint --max-diagnostics=1000 --diagnostic-level=error .",
"format": "biome format --write .",
"node:up": "make -C ./docker up",
"node:up:test": "make -C ./docker up-test",
"node:down": "make -C ./docker down",
Expand All @@ -55,8 +53,6 @@
"nodes:clean": "run-s node:clean node:clean:test",
"nodes:reset": "run-s nodes:clean nodes:up",
"packages:version": "node ./scripts/version.js",
"prettier:check": "prettier --check . !./packages/docs",
"prettier:format": "prettier --write .",
"storybook": "pnpm -r --filter=fuels-wallet storybook",
"test": "turbo run test --parallel",
"test:ci": "turbo run test --parallel -- --ci --testLocationInResults --json --coverage",
Expand All @@ -76,10 +72,9 @@
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@biomejs/biome": "1.6.1",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@fuels/eslint-plugin": "0.1.4",
"@fuels/prettier-config": "0.1.4",
"@fuels/ts-config": "0.1.4",
"@jest/types": "29.6.3",
"@playwright/test": "1.39.0",
Expand All @@ -89,7 +84,6 @@
"@types/react-dom": "^18.2.13",
"@xstate/cli": "0.5.2",
"dotenv": "^16.3.1",
"eslint": "^8.51.0",
"fs-extra": "^11.1.1",
"http-server": "^14.1.1",
"husky": "^8.0.3",
Expand All @@ -99,7 +93,6 @@
"jest-transform-stub": "^2.0.0",
"lint-staged": "^14.0.1",
"npm-run-all": "^4.1.5",
"prettier": "3.0.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"turbo": "^1.10.15",
Expand All @@ -108,14 +101,8 @@
},
"pnpm": {
"peerDependencyRules": {
"allowAny": [
"react",
"react-dom"
],
"ignoreMissing": [
"react",
"react-dom"
]
"allowAny": ["react", "react-dom"],
"ignoreMissing": ["react", "react-dom"]
},
"overrides": {
"follow-redirects": ">=1.15.6",
Expand Down
5 changes: 1 addition & 4 deletions packages/app/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ const config: CodegenConfig = {
},
},
hooks: {
afterOneFileWrite: [
'pnpm eslint --fix --no-ignore',
'pnpm prettier --write',
],
afterOneFileWrite: ['biome format --write'],
},
};

Expand Down
4 changes: 1 addition & 3 deletions packages/connections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
}
}
},
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "pnpm ts:check && tsup",
"ts:check": "tsc --noEmit"
Expand Down
6 changes: 2 additions & 4 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"next": "13.5.4",
"next-mdx-remote": "^4.4.1",
"plyr-react": "^5.3.0",
"prettier": "2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-syntax-highlighter": "^15.5.0",
Expand All @@ -56,8 +55,7 @@
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@types/react-syntax-highlighter": "^15.5.8",
"eslint": "^8.51.0",
"eslint-config-next": "13.5.4",
"next-images": "1.8.5"
"next-images": "1.8.5",
"prettier": "2.8.8"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-contract-tests/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export CONTRACT_NAME="ExternalContract";
pnpm fuels deploy

echo "Prettify"
pnpm -w prettier:format
pnpm -w format
4 changes: 1 addition & 3 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
}
}
},
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "pnpm ts:check && tsup",
"ts:check": "tsc --noEmit"
Expand Down
4 changes: 1 addition & 3 deletions packages/update-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
}
}
},
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"ts:check": "tsc --noEmit",
"check-versions": "tsx src/index.ts"
Expand Down
Loading

0 comments on commit a0e5cbf

Please sign in to comment.