Skip to content

Commit

Permalink
chore: ♻️ Replace Prettier & EsLint with Biome (#3096)
Browse files Browse the repository at this point in the history
* refactor: ✨ Dual publish typesbundle properly

* refactor: ✨ ApiAugment fixed paths

* feat: ✨ Added new ScrapeMetadata script

* build: 🏗️ add built `/dist` to repo

* style: 💄 lint

* style: 💄 Exclude dist from editorconfig

* fix: 🐛 Fix typegen check CI

* refactor: ♻️ Tidy script call

* fix: 🐛 Fix tracing CI

* refactor: ♻️ Remove dist from repo

* remove dist

* fix: 📦 Fix packages!

* fix: 💚 Fix typegen CI

* style: 🚨 pretty

* style: 💄 Replace Prettier with Biome

* style: 💄 Replace Prettier with Biome

* style: 🔥 get rid of editor config

* style: ♻️ Regen types (with formatting)

* fix: ✅ Fix Test

* merge fixes

* fmt
  • Loading branch information
timbrinded authored Dec 13, 2024
1 parent b0b6880 commit 9e17fd6
Show file tree
Hide file tree
Showing 335 changed files with 22,976 additions and 14,275 deletions.
63 changes: 6 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ jobs:
use-quiet-mode: "yes"
max-depth: 4

check-editorconfig:
name: "Check editorconfig"
check-biome:
name: "Check with Biome"
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -162,68 +162,17 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Setup editorconfig checker
run: |
ls /tmp/bin/ec-linux-amd64 || \
cd /tmp && \
wget https://github.com/editorconfig-checker/editorconfig-checker/releases/download/2.7.0/ec-linux-amd64.tar.gz && \
tar xvf ec-linux-amd64.tar.gz && \
chmod +x bin/ec-linux-amd64
- name: Check files
# Prettier and editorconfig-checker have different ideas about indentation
run: /tmp/bin/ec-linux-amd64 --exclude "(typescript-api\/)|(test\/contracts\/lib\/.*)|(\/?dist\/)" -disable-indent-size

check-prettier:
name: "Check with Prettier"
runs-on: ubuntu-latest
permissions:
contents: read
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Check with Prettier
run: |
bun x prettier@2 --check --ignore-path .prettierignore '**/*.(yml|js|ts|json)' \
|| (git diff --quiet \
|| (echo 'Unable to show a diff because there are unstaged changes'; false) \
&& (bun x prettier@2 --ignore-path \
.prettierignore '**/*.(yml|js|ts|json)' -w --loglevel silent \
&& git --no-pager diff; git restore .) && false)
bun x prettier@2 --check --ignore-path .prettierignore '**/*.(yml|js|ts|json)'
check-eslint:
name: "Check with EsLint"
runs-on: ubuntu-latest
permissions:
contents: read
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Use pnpm
uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "test/.nvmrc"
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml
- name: Run Eslint check
run: |
cd test
pnpm i
pnpm lint
- run: pnpm install
- run: pnpm check

check-cargo-toml-format:
name: "Check Cargo.toml files format"
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ tools/*-local.json
tools/*-local-raw.json
tools/build

# RustRover
.idea/
# IDEs
.idea/
.vscode/
50 changes: 0 additions & 50 deletions .vscode/launch.json

This file was deleted.

21 changes: 0 additions & 21 deletions .vscode/settings.json

This file was deleted.

50 changes: 0 additions & 50 deletions .vscode/tasks.json

This file was deleted.

3 changes: 1 addition & 2 deletions CONTRIBUTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ and are expected to pass before a PR is considered mergeable. They can also be r

- [clippy](https://github.com/rust-lang/rust-clippy) - run with `cargo clippy --release --workspace`
- [rustfmt](https://github.com/rust-lang/rustfmt) - run with `cargo fmt -- --check`
- [editorconfig](https://editorconfig.org/) - integrate into your text editor / IDE
- [prettier](https://prettier.io/) - run with `npx prettier --check --ignore-path .gitignore '**/*.(yml|js|ts|json)'` (runs against `typescript` code)
- [biome](https://biomejs.dev/) - run with `pnpm check` (runs against `typescript` code)

### Directory Structure

Expand Down
65 changes: 65 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"include": [
"*.js",
"*.ts",
"*.yml",
"*.md"
],
"ignore": [
"./node_modules/*",
"./dist/*",
"./target/*",
"**/tmp/*",
"*.spec.json"
]
},
"organizeImports": {
"enabled": false
},
"formatter": {
"enabled": true,
"lineWidth": 100,
"attributePosition": "multiline"
},
"json": {
"formatter": {
"enabled": false
}
},
"javascript": {
"formatter": {
"trailingCommas": "es5",
"semicolons": "always",
"indentStyle": "space",
"lineWidth": 100,
"quoteStyle": "double"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off",
"noImplicitAnyLet": "off",
"noAsyncPromiseExecutor": "off"
},
"performance": {
"noAccumulatingSpread": "off",
"noDelete": "off"
},
"complexity": {
"useArrowFunction": "off",
"useLiteralKeys": "off",
"noForEach": "off"
},
"style": {
"noNonNullAssertion": "off",
"noUnusedTemplateLiteral": "off",
"useTemplate": "off"
}
}
}
}
5 changes: 3 additions & 2 deletions moonbeam-types-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"tsc": "tsc --noEmit --pretty",
"build": "tsup src --format cjs,esm --dts --no-splitting",
"publish-package": "npm run build && npm publish",
"fmt:fix": "prettier --write --ignore-path .gitignore '**/*.(yml|js|ts|json)'"
"check":"biome check .",
"check:fix": "biome check . --write"
},
"keywords": [
"moonbeam",
Expand All @@ -50,13 +51,13 @@
"url": "git+https://github.com/moonbeam-foundation/moonbeam.git"
},
"dependencies": {
"@biomejs/biome": "*",
"@polkadot/api": "*",
"@polkadot/api-base": "*",
"@polkadot/rpc-core": "*",
"@polkadot/typegen": "*",
"@polkadot/types": "*",
"@polkadot/types-codec": "*",
"prettier": "*",
"tsup": "*",
"typescript": "*"
}
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
"clean-all": "rm -rf node_modules && pnpm -r clean",
"build": "pnpm -r build",
"postinstall": "pnpm build",
"lint": "pnpm -r lint",
"fmt": "pnpm -r fmt",
"fmt:fix": "pnpm -r fmt:fix"
"check": "pnpm -r check",
"check:fix": "pnpm -r check:fix"
},
"dependencies": {
"@polkadot/api": "14.3.1",
Expand All @@ -31,9 +30,8 @@
"tsup": "8.3.5"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/node": "^22.10.1",
"eslint": "^8.55.0",
"prettier": "2.8.8",
"tsx": "^4.19.2",
"typescript": "^5.3.3"
},
Expand Down
Loading

0 comments on commit 9e17fd6

Please sign in to comment.