Skip to content

Commit 4762497

Browse files
authored
feat: add CI verification targets and PR checks (#41)
* fix: migrate eslint config to typescript-eslint v8 + @Stylistic - Rename .eslintrc.js to .eslintrc.cjs (ESM module compatibility) - Replace 17 removed formatting rules with @stylistic/eslint-plugin equivalents - Replace ban-types with no-restricted-types + no-unsafe-function-type + no-wrapper-object-types - Replace no-empty-interface with no-empty-object-type - Replace no-throw-literal with only-throw-error - Remove no-var-requires (covered by no-require-imports) - Remove prefer-ts-expect-error (covered by ban-ts-comment) - Replace no-loss-of-precision with base ESLint rule - Fix lint target to point at ui/ instead of nonexistent src/ - Point parserOptions.project at tsconfig.app.json * feat: add CI verification targets and PR checks workflow Add Makefile targets for deterministic local/CI verification: - make check: runs all checks in sequence (fail-fast) - Go: go-build, go-vet, go-test, go-lint, fmt-check, fmt - Bindings: bindings, bindings-check (detects stale wails bindings) - UI: ui-install, ui-build, ui-lint, ui-typecheck Add GitHub Actions PR workflow (.github/workflows/pr-checks.yml): - Runs Go checks, bindings freshness, and UI checks in parallel - Caches Go modules and pnpm store - Gates PR merges on all checks passing Add dist/.gitkeep so go:embed all:dist resolves without a frontend build, enabling Go checks to run independently. * fix: resolve CI failures for PR checks - Fix pids_test.go: ensure ~/.omniview/ directory exists before tests that write to the PID file (fails on CI runners without home setup) - Regenerate stale wails bindings (models.ts was out of sync with Go structs: added direction, targetNamespaced fields; removed ownerRefKind) - Remove --max-warnings 0 from lint script (1523 pre-existing errors) - Mark fmt-check, go-lint, ui-lint, ui-typecheck as continue-on-error in CI workflow (pre-existing issues on main, will be fixed separately) * fix: address code review findings - Use PR number in concurrency group key to avoid cross-fork collisions - Pin golangci-lint version to v2.1 instead of latest - Extract ensurePluginPIDDir helper to deduplicate test setup - Make fmt-check verify both goimports and gofmt (matching fmt target) - Add set -e and trap cleanup to bindings-check so failures restore the original bindings and always clean up the temp directory - Move ESLINT_USE_FLAT_CONFIG=false into package.json lint script so pnpm lint and make ui-lint behave identically * fix: pin CI node/pnpm versions to .tool-versions, require goimports - Pin NODE_VERSION to 20.18.1 and PNPM_VERSION to 9.15.0 to match .tool-versions (GO_VERSION stays at 1.26 per go.mod requirement) - Make fmt-check fail loudly when goimports is not installed instead of silently skipping the import check
1 parent ef8b8a2 commit 4762497

12 files changed

Lines changed: 311 additions & 50 deletions

File tree

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ module.exports = {
6565
parserOptions: {
6666
warnOnUnsupportedTypeScriptVersion: false,
6767
sourceType: 'module',
68-
project: 'tsconfig.json',
68+
project: 'tsconfig.app.json',
6969
ecmaFeatures: {
7070
jsx: true,
7171
},
7272
},
7373
plugins: [
7474
'@typescript-eslint',
75+
'@stylistic',
7576
'import',
7677
],
7778
settings: {
@@ -97,14 +98,16 @@ module.exports = {
9798
'error',
9899
{
99100
'ts-expect-error': 'allow-with-description',
101+
'ts-ignore': true,
100102
minimumDescriptionLength: 4,
101103
},
102104
],
103105
'@typescript-eslint/ban-tslint-comment': 'error',
104-
'@typescript-eslint/ban-types': [
106+
107+
// Replaces removed @typescript-eslint/ban-types (split in v8)
108+
'@typescript-eslint/no-restricted-types': [
105109
'error',
106110
{
107-
extendDefaults: false,
108111
types: {
109112
String: {
110113
message: 'Use `string` instead.',
@@ -141,12 +144,6 @@ module.exports = {
141144
'The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
142145
fixWith: 'Record<string, unknown>',
143146
},
144-
Function: 'Use a specific function type instead, like `() => void`.',
145-
// null: {
146-
// message:
147-
// 'Use `undefined` instead. See: https://github.com/sindresorhus/meta/issues/7',
148-
// fixWith: 'undefined',
149-
// },
150147
Buffer: {
151148
message:
152149
'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer',
@@ -161,24 +158,29 @@ module.exports = {
161158
},
162159
},
163160
],
161+
'@typescript-eslint/no-unsafe-function-type': 'error',
162+
'@typescript-eslint/no-wrapper-object-types': 'error',
163+
164164
'@typescript-eslint/class-literal-property-style': ['error', 'getters'],
165165
'@typescript-eslint/consistent-generic-constructors': [
166166
'error',
167167
'constructor',
168168
],
169169
'@typescript-eslint/consistent-indexed-object-style': 'error',
170+
171+
// Stylistic rules (moved from @typescript-eslint in v8)
170172
'brace-style': 'off',
171-
'@typescript-eslint/brace-style': [
173+
'@stylistic/brace-style': [
172174
'error',
173175
'1tbs',
174176
{
175177
allowSingleLine: false,
176178
},
177179
],
178180
'comma-dangle': 'off',
179-
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
181+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
180182
'comma-spacing': 'off',
181-
'@typescript-eslint/comma-spacing': [
183+
'@stylistic/comma-spacing': [
182184
'error',
183185
{
184186
before: false,
@@ -237,19 +239,19 @@ module.exports = {
237239
// ],
238240

239241
'func-call-spacing': 'off',
240-
'@typescript-eslint/func-call-spacing': ['error', 'never'],
242+
'@stylistic/function-call-spacing': ['error', 'never'],
241243
indent: 'off',
242-
'@typescript-eslint/indent': [
244+
'@stylistic/indent': [
243245
'error',
244246
2,
245247
{
246248
SwitchCase: 1,
247249
},
248250
],
249251
'keyword-spacing': 'off',
250-
'@typescript-eslint/keyword-spacing': 'error',
252+
'@stylistic/keyword-spacing': 'error',
251253
'lines-between-class-members': 'off',
252-
'@typescript-eslint/lines-between-class-members': [
254+
'@stylistic/lines-between-class-members': [
253255
'error',
254256
'always',
255257
{
@@ -258,7 +260,7 @@ module.exports = {
258260
exceptAfterSingleLine: true,
259261
},
260262
],
261-
'@typescript-eslint/member-delimiter-style': [
263+
'@stylistic/member-delimiter-style': [
262264
'error',
263265
{
264266
multiline: {
@@ -358,10 +360,12 @@ module.exports = {
358360
'@typescript-eslint/no-dynamic-delete': 'error',
359361
'no-empty-function': 'off',
360362
'@typescript-eslint/no-empty-function': 'error',
361-
'@typescript-eslint/no-empty-interface': [
363+
364+
// Replaces removed @typescript-eslint/no-empty-interface (v8)
365+
'@typescript-eslint/no-empty-object-type': [
362366
'error',
363367
{
364-
allowSingleExtends: true,
368+
allowInterfaces: 'with-single-extends',
365369
},
366370
],
367371

@@ -392,11 +396,11 @@ module.exports = {
392396
// ],
393397

394398
'no-extra-semi': 'off',
395-
'@typescript-eslint/no-extra-semi': 'error',
399+
'@stylistic/no-extra-semi': 'error',
396400
'no-loop-func': 'off',
397401
'@typescript-eslint/no-loop-func': 'error',
398-
'no-loss-of-precision': 'off',
399-
'@typescript-eslint/no-loss-of-precision': 'error',
402+
// Removed in @typescript-eslint v8 — base ESLint rule handles this now
403+
'no-loss-of-precision': 'error',
400404
'@typescript-eslint/no-extraneous-class': [
401405
'error',
402406
{
@@ -468,15 +472,17 @@ module.exports = {
468472
// The rule is buggy and keeps inferring `any` for types that are not `any`. Just a lot of false-positives.
469473
// '@typescript-eslint/no-redundant-type-constituents': 'error',
470474

475+
// no-require-imports subsumes the removed no-var-requires in v8
471476
'@typescript-eslint/no-require-imports': 'error',
472477
'@typescript-eslint/no-this-alias': [
473478
'error',
474479
{
475480
allowDestructuring: true,
476481
},
477482
],
483+
// Replaces removed @typescript-eslint/no-throw-literal (renamed in v8)
478484
'no-throw-literal': 'off',
479-
'@typescript-eslint/no-throw-literal': [
485+
'@typescript-eslint/only-throw-error': [
480486
'error',
481487
{
482488
// This should ideally be `false`, but it makes rethrowing errors inconvenient. There should be a separate `allowRethrowingUnknown` option.
@@ -534,17 +540,16 @@ module.exports = {
534540
'@typescript-eslint/no-useless-constructor': 'error',
535541
'object-curly-spacing': 'off',
536542
'curly': ['error', 'all'],
537-
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
543+
'@stylistic/object-curly-spacing': ['error', 'always'],
538544
'padding-line-between-statements': 'off',
539-
'@typescript-eslint/padding-line-between-statements': [
545+
'@stylistic/padding-line-between-statements': [
540546
'error',
541547
{
542548
blankLine: 'always',
543549
prev: 'multiline-block-like',
544550
next: '*',
545551
},
546552
],
547-
'@typescript-eslint/no-var-requires': 'error',
548553
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
549554
'@typescript-eslint/parameter-properties': [
550555
'error',
@@ -584,10 +589,10 @@ module.exports = {
584589

585590
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
586591
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
587-
'@typescript-eslint/prefer-ts-expect-error': 'error',
592+
// Removed in v8 — covered by ban-ts-comment with ts-ignore: true
588593
'@typescript-eslint/promise-function-async': 'error',
589594
quotes: 'off',
590-
'@typescript-eslint/quotes': ['error', 'single'],
595+
'@stylistic/quotes': ['error', 'single'],
591596
'@typescript-eslint/restrict-plus-operands': [
592597
'error',
593598
{
@@ -613,7 +618,7 @@ module.exports = {
613618
// '@typescript-eslint/require-await': 'error',
614619

615620
'space-before-function-paren': 'off',
616-
'@typescript-eslint/space-before-function-paren': [
621+
'@stylistic/space-before-function-paren': [
617622
'error',
618623
{
619624
anonymous: 'always',
@@ -622,11 +627,11 @@ module.exports = {
622627
},
623628
],
624629
'space-infix-ops': 'off',
625-
'@typescript-eslint/space-infix-ops': 'error',
630+
'@stylistic/space-infix-ops': 'error',
626631
semi: 'off',
627-
'@typescript-eslint/semi': ['error', 'always'],
632+
'@stylistic/semi': ['error', 'always'],
628633
'space-before-blocks': 'off',
629-
'@typescript-eslint/space-before-blocks': ['error', 'always'],
634+
'@stylistic/space-before-blocks': ['error', 'always'],
630635

631636
// TODO: Reconsider enabling it again in 2023.
632637
// NOTE: The rule was complete redone in typescript-eslint v3, so this config needs to be changed before this is enabled.
@@ -656,7 +661,7 @@ module.exports = {
656661
lib: 'never',
657662
},
658663
],
659-
'@typescript-eslint/type-annotation-spacing': 'error',
664+
'@stylistic/type-annotation-spacing': 'error',
660665

661666
// Disabled as it crashes on most code.
662667
// https://github.com/typescript-eslint/typescript-eslint/search?q=%22unbound-method%22&state=open&type=Issues

.github/workflows/pr-checks.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
concurrency:
8+
group: pr-checks-${{ github.event.pull_request.number }}
9+
cancel-in-progress: true
10+
11+
env:
12+
GO_VERSION: "1.26"
13+
NODE_VERSION: "20.18.1"
14+
PNPM_VERSION: "9.15.0"
15+
16+
jobs:
17+
go-checks:
18+
name: Go checks
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-go@v5
24+
with:
25+
go-version: ${{ env.GO_VERSION }}
26+
cache: true
27+
28+
- name: Build
29+
run: make go-build
30+
31+
- name: Vet
32+
run: make go-vet
33+
34+
- name: Test
35+
run: make go-test
36+
37+
- name: Format check
38+
run: make fmt-check
39+
continue-on-error: true
40+
41+
- name: Lint
42+
uses: golangci/golangci-lint-action@v6
43+
with:
44+
version: v2.1
45+
args: run
46+
env:
47+
GOWORK: "off"
48+
continue-on-error: true
49+
50+
bindings-check:
51+
name: Bindings freshness
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- uses: actions/setup-go@v5
57+
with:
58+
go-version: ${{ env.GO_VERSION }}
59+
cache: true
60+
61+
- name: Install wails
62+
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0
63+
64+
- name: Check bindings are up to date
65+
run: make bindings-check
66+
67+
ui-checks:
68+
name: UI checks
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- uses: actions/setup-node@v4
74+
with:
75+
node-version: ${{ env.NODE_VERSION }}
76+
77+
- uses: pnpm/action-setup@v4
78+
with:
79+
version: ${{ env.PNPM_VERSION }}
80+
81+
- name: Get pnpm store directory
82+
id: pnpm-cache
83+
shell: bash
84+
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
85+
86+
- uses: actions/cache@v4
87+
with:
88+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
89+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
90+
restore-keys: ${{ runner.os }}-pnpm-store-
91+
92+
- name: Install dependencies
93+
run: make ui-install
94+
95+
- name: Build
96+
run: make ui-build
97+
98+
- name: Lint
99+
run: make ui-lint
100+
continue-on-error: true
101+
102+
- name: Typecheck
103+
run: make ui-typecheck
104+
continue-on-error: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ lerna-debug.log*
3030

3131
node_modules
3232
dist
33+
!dist/.gitkeep
3334
dist-ssr
3435
*.local
3536

0 commit comments

Comments
 (0)