Skip to content

Commit

Permalink
ci: migrate to eslint and improve github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
unnoq committed Nov 21, 2024
1 parent 02900af commit 4bc53cb
Show file tree
Hide file tree
Showing 10 changed files with 2,419 additions and 367 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: pr-quality
name: Code Quality

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
check-and-fix-code:
main:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -23,8 +25,6 @@ jobs:

- run: pnpm run test

- run: pnpm run build

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'style: lint & format fixed'
commit_message: 'style: apply lint fixes'
89 changes: 0 additions & 89 deletions .github/workflows/main.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/release-next.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release Next

on:
push:
branches: [main]

jobs:
main:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: NPM registry authentication
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: pnpm i

- run: pnpm run changeset:version --snapshot next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: pnpm run changeset:publish --tag next
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pr-release
name: Release PR

on:
pull_request:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/release-stable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release Stable

on:
workflow_run:
workflows: [Code Quality]
types: [completed]
branches: [main]

jobs:
main:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}

runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: NPM registry authentication
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: pnpm i

- name: Changeset version or publish on @latest
uses: changesets/action@v1
with:
commit: 'chore(release): version packages'
title: 'chore(release): version packages'
version: pnpm run changeset:version
publish: pnpm run changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 46 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
{
"editor.defaultFormatter": "biomejs.biome",
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"explorer.fileNesting.patterns": {
"package.json": ".*, *ts, *.json, *.yaml",
"*.ts": "${capture}.*",
"*.tsx": "${capture}.*"
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
],

"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.preferences.autoImportFileExcludePatterns": [],
Expand Down
48 changes: 0 additions & 48 deletions biome.json

This file was deleted.

29 changes: 29 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import antfu from '@antfu/eslint-config'

export default antfu({
type: 'lib',
react: true,
formatters: true,
}, {
rules: {
'ts/consistent-type-definitions': 'off',
'react-refresh/only-export-components': 'off',
'react/prefer-destructuring-assignment': 'off',
},
}, {
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.test-d.ts', '**/*.test-d.tsx', 'apps/content/examples/**', 'playgrounds/**'],
rules: {
'unused-imports/no-unused-vars': 'off',
'antfu/no-top-level-await': 'off',
},
}, {
files: ['apps/**', 'playgrounds/**'],
rules: {
'ts/explicit-function-return-type': 'off',
},
}, {
files: ['playgrounds/**'],
rules: {
'no-alert': 'off',
},
})
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@orpc/monorepo",
"type": "module",
"private": true,
"packageManager": "pnpm@9.10.0",
"author": {
"name": "unnoq",
"email": "contact@unnoq.com",
Expand All @@ -15,30 +16,30 @@
"test": "vitest run",
"test:watch": "vitest watch",
"test:coverage": "vitest run --coverage",
"format": "pnpm biome format --error-on-warnings --fix",
"lint": "pnpm biome check --error-on-warnings",
"lint:fix": "pnpm run lint --write",
"lint": "eslint --max-warnings=0 .",
"lint:fix": "pnpm run lint --fix",
"sherif": "pnpm dlx sherif",
"sherif:fix": "pnpm run sherif --fix",
"knip": "pnpm dlx knip --production",
"knip:fix": "pnpm run knip --fix --allow-remove-files",
"changeset:version": "changeset version",
"postchangeset:version": "pnpm run format",
"changeset:publish": "pnpm run build:packages && pnpm changeset publish"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@antfu/eslint-config": "^3.9.2",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.9",
"@eslint-react/eslint-plugin": "^1.16.2",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
"@types/node": "^22.9.0",
"@unnoq/unplugin": "^0.0.0",
"@vitest/coverage-v8": "^2.1.1",
"eslint": "^9.15.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"jsdom": "^25.0.1",
"tsup": "^8.3.0",
"typescript": "5.7.1-rc",
"vitest": "^2.1.3"
},
"packageManager": "pnpm@9.10.0"
}
}
Loading

0 comments on commit 4bc53cb

Please sign in to comment.