Skip to content
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

Set up linting with Biome and swap to pnpm #27

Merged
merged 10 commits into from
May 30, 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
16 changes: 4 additions & 12 deletions .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"javascript": {
"version": true,
"getPublishedVersion": "npm view ${ pkgFile.pkg.name } version",
"publish": [
"npm publish --access public"
],
"publish": ["pnpm publish --access public"],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
Expand All @@ -16,12 +14,8 @@
"rust": {
"version": true,
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p'",
"prepublish": [
"cargo generate-lockfile"
],
"publish": [
"cargo publish"
],
"prepublish": ["cargo generate-lockfile"],
"publish": ["cargo publish"],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
Expand All @@ -41,9 +35,7 @@
"qubit": {
"path": ".",
"manager": "rust",
"dependencies": [
"qubit-macros"
]
"dependencies": ["qubit-macros"]
}
}
}
66 changes: 66 additions & 0 deletions .github/workflows/checks.yml
andogq marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: checks

on: push

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable pnpm
- uses: actions/setup-node@v4
- run: pnpm i
- run: pnpm lint --error-on-warnings

typecheck:
strategy:
fail-fast: false
matrix:
dir:
- packages/client
- examples/authentication/auth-demo
- examples/chaos
- examples/chat-room-react
- examples/counter
- examples/hello-world

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable pnpm
- uses: actions/setup-node@v4
with:
cache: pnpm
cache-dependency-path: '**/pnpm-lock.yaml'
- name: Build client package
run: pnpm i && pnpm build
working-directory: packages/client
if: ${{ matrix.dir != 'packages/client' }}
- run: pnpm i
working-directory: ${{ matrix.dir }}
- run: pnpm tsc
working-directory: ${{ matrix.dir }}

clippy:
strategy:
fail-fast: false
matrix:
dir:
- '.'
- examples/authentication
- examples/chaos
- examples/chat-room-react/src-rust
- examples/counter
- examples/hello-world

env:
RUSTFLAGS: "-Dwarnings" # Fail on warnings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo clippy
working-directory: ${{ matrix.dir }}
7 changes: 4 additions & 3 deletions .github/workflows/covector-status.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: covector status
on: [pull_request]

on: pull_request

jobs:
covector:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for use of git history
- name: covector status
uses: jbolda/covector/packages/[email protected]
id: covector
with:
command: 'status'
command: status
8 changes: 5 additions & 3 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ jobs:
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for use of git history
- uses: actions/setup-node@v3
- run: corepack enable pnpm
- uses: actions/setup-node@v4
with:
node-version: 14
cache: pnpm
cache-dependency-path: '**/pnpm-lock.yaml'
registry-url: 'https://registry.npmjs.org'
- name: cargo login
run: cargo login ${{ secrets.CRATE_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["rust-lang.rust-analyzer", "biomejs.biome"]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
},
"rust-analyzer.check.command": "clippy",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<a href="https://crates.io/crates/qubit"><img src="https://img.shields.io/crates/v/qubit" alt="crates.io" /></a>
<a href="https://docs.rs/qubit/latest/qubit"><img src="https://img.shields.io/docsrs/qubit" alt="docs.rs" /></a>
<a href="https://www.npmjs.com/package/@qubit-rs/client"><img src="https://img.shields.io/npm/v/%40qubit-rs%2Fclient" alt="npm" /></a>
<a href="https://github.com/andogq/qubit/actions/workflows/checks.yml"><img src="https://github.com/andogq/qubit/actions/workflows/checks.yml/badge.svg" alt="checks" /></a>
</div>

Tired of wrestling with RPC boilerplate? Qubit simplifies communication between your Rust services
Expand Down
42 changes: 42 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "main"
},
"files": {
"include": ["*.ts", "*.tsx", "*.json"],
andogq marked this conversation as resolved.
Show resolved Hide resolved
"ignore": ["bindings.ts", "cookie-auth.ts", "mutable-ctx.ts"]
andogq marked this conversation as resolved.
Show resolved Hide resolved
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedImports": "warn",
"noUnusedVariables": "warn"
}
}
},
"formatter": {
"indentStyle": "space",
"lineWidth": 120
},
"overrides": [
andogq marked this conversation as resolved.
Show resolved Hide resolved
{
"include": ["packages/client/**/*.ts"],
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "warn"
}
}
}
}
]
}
5 changes: 3 additions & 2 deletions examples/authentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ In another terminal, install TypeScript dependencies, and run the client!

```sh
cd auth-demo
npm i
npm run dev
corepack enable # if not enabled
pnpm i
pnpm dev
```
Loading
Loading