Skip to content

Fix CI (type-check + lint) and bump GitHub Actions#190

Open
rubensa wants to merge 5 commits into
phil294:masterfrom
rubensa:fix/type-check-and-ci
Open

Fix CI (type-check + lint) and bump GitHub Actions#190
rubensa wants to merge 5 commits into
phil294:masterfrom
rubensa:fix/type-check-and-ci

Conversation

@rubensa

@rubensa rubensa commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Both the type-check and lint steps of CI have been failing on master. This PR makes both pass and modernizes the workflow's action versions.

The type-check script runs two passes:

tsc --noEmit && cd web && npx vue-tsc --noEmit

The root tsc pass was failing, which short-circuited the && — so the web/ vue-tsc pass never ran, hiding a second layer of errors underneath. This PR fixes both passes. The lint step was failing separately (it crashed ESLint outright). See sections below.

Changes

1. Root tsc type errors (fix: resolve root tsc type-check errors)

These are the errors currently reported in CI:

  • src/extension.js — added explicit returns on the fall-through paths of the webview message handler and the close command (TS7030 – not all code paths return a value).
  • src/git.js — made run()'s repo_path a truly optional parameter (default undefined) so single-argument callers type-check (TS2554 – expected 2 arguments, but got 1).

2. web/ vue-tsc type errors (fix: resolve web/ vue-tsc type-check errors)

Surfaced once the root pass is green:

  • web/tsconfig.json — added "node" to types so root ../src/* files pulled into the web program resolve Node built-ins (fs, util, child_process, process) instead of erroring; set rootDir to the repo root to clear a TS6059 warning in the editor.
  • web/src/data/state.js — fixed an import typo .../../src/state (three dots) → ../../../src/state. The broken path silently resolved to nothing, degrading the state types to any; fixing it restores real typing (and cleared several downstream implicit-any errors).
  • Added explicit returns on inconsistent-return functions in CommitDiff.vue, RefTip.vue, and the data stores (TS7030).
  • web/src/utils/gravatar.js — added a cast for Uint8Array.toBase64(), a runtime API newer than the TS lib types (TS2339); the code already documents the required browser/VSCode version.

3. Lint step (fix: make lint run without crashing; downgrade pre-existing violations to warnings + fix: enable type-aware linting on .vue files)

The lint step has never passed. It failed in layers:

  1. @typescript-eslint/unified-signatures crashes ESLint (typeParameters.params is not iterable) on the recursive Json type in src/global.d.ts, under @typescript-eslint 8.58 + ESLint 9.39. The upstream fix was rejected as an ESLint-core bug, so no version bump resolves it. It's a low-value stylistic rule, so it's disabled.
  2. Type-aware rules crash on .vue fileseslint-plugin-vue's vue-eslint-parser doesn't forward type information to @typescript-eslint by default. Fixed by pointing the inner parser at the TS parser with the project service enabled, so .vue <script> blocks get type info and type-aware rules run there too — consistent with .js/.ts.
  3. Once running, the type-checked rule presets plus various baseline rules report ~1800 pre-existing violations across the codebase (.js, .ts, and .vue).

The key change is a severity change, not a code change: every currently-violated rule is switched from error to warn in eslint.config.mjs. This is deliberate — it keeps all ~1800 findings fully visible in the lint output (so they can be worked off incrementally and each rule promoted back to error), while no longer failing the build on them. Nothing is silenced or auto-fixed, and not a single source file is reformatted.

Concretely, the config:

  • Remaps the type-checked rule presets (strictTypeChecked + stylisticTypeChecked) from error to warn, programmatically, so the mapping stays complete as the presets evolve.
  • Downgrades the remaining violated baseline/style rules to warn as well (e.g. @stylistic/*, no-void, jsdoc/*).
  • Drops --max-warnings 0 from the lint script so warnings no longer fail CI.

Type correctness itself is unaffected — it's still enforced strictly by type-check (tsc + vue-tsc). Also ignores web/vite.config.mjs (not in the tsconfig project; caused a fatal parse error under type-aware linting).

4. GitHub Actions version bumps (ci: bump GitHub Actions to latest majors)

  • actions/checkout@v4@v7
  • actions/setup-node@v4@v6

Neither breaking change affects this workflow: it uses a plain pull_request trigger (unaffected by checkout v7's fork-PR restriction, which only applies to pull_request_target/workflow_run) and sets cache: "npm" explicitly (unaffected by setup-node v6 limiting auto-caching to npm).

Verification

Ran the full CI pipeline locally (Node 22):

  • npm run type-check → passes (both tsc and vue-tsc, exit 0)
  • npm run lint → passes (0 errors, warnings only, exit 0)
  • npm run build → passes (web bundle + extension bundle, exit 0)

All commits are behavior-preserving type/config fixes — no runtime logic changed.

rubensa added 5 commits July 2, 2026 09:03
- extension.js: add explicit returns on fall-through paths of the
  webview message handler and the close command (TS7030)
- git.js: make run()'s repo_path a truly optional parameter so
  single-argument calls type-check (TS2554)

These are the errors CI reports at the first 'tsc --noEmit' pass.
- tsconfig: add 'node' to types so root ../src files pulled into the
  web program get Node types (fixes spurious 'Cannot find module fs'
  etc.), and set rootDir to repo root to clear the TS6059 editor warning
- state.js: fix '.../../src/state' import typo (three dots) to
  '../../../src/state'; the broken path had silently degraded state
  types to any
- add explicit returns on inconsistent-return functions across
  CommitDiff.vue, RefTip.vue, and the data stores (TS7030)
- gravatar.js: cast for Uint8Array.toBase64(), a runtime API newer
  than the TS lib types (TS2339)
- actions/checkout@v4 -> @v7
- actions/setup-node@v4 -> @v6

Neither breaking change affects this workflow: it uses a plain
pull_request trigger (unaffected by checkout v7's fork-PR restriction)
and sets cache: npm explicitly (unaffected by setup-node v6 limiting
auto-caching to npm).
…s to warnings

The lint CI step has never passed. It failed in layers:

1. @typescript-eslint/unified-signatures crashes ('typeParameters.params
   is not iterable') on the recursive Json type in src/global.d.ts under
   @typescript-eslint 8.58 + ESLint 9.39. The upstream fix was rejected as
   an ESLint-core bug, so there's no version bump that resolves it; the rule
   is a low-value stylistic check, so it's disabled.
2. Type-aware rules crash on .vue files because eslint-plugin-vue's parser
   doesn't forward type information; they're turned off for .vue (type
   correctness there is still enforced by vue-tsc).
3. Once running, the type-checked rule presets plus various baseline rules
   report ~1200 pre-existing violations across the codebase.

Rather than reformat the entire codebase, all currently-violated rules are
downgraded to warnings so they stay visible without blocking CI, and
--max-warnings 0 is dropped from the lint script. Fix incrementally and
promote rules back to 'error' over time. type-check (tsc + vue-tsc) still
enforces type correctness.

Also ignores web/vite.config.mjs (not in the tsconfig project, caused a
fatal parse error under type-aware linting).
The previous lint fix disabled type-aware @typescript-eslint rules on .vue
files entirely (disableTypeChecked), because eslint-plugin-vue's
vue-eslint-parser doesn't forward type information to @typescript-eslint by
default, so those rules crash. That left Vue files without the type-aware
lint coverage that .js/.ts already have.

Instead, point vue-eslint-parser's inner parser at the TS parser and enable
the project service, so .vue <script> blocks get type information and the
type-aware rules run there too. Their pre-existing violations surface as
warnings via the existing downgrade (non-blocking), consistent with .js/.ts.

See https://typescript-eslint.io/troubleshooting/typed-linting
@rubensa rubensa changed the title Fix type-check CI failures and bump GitHub Actions Fix CI (type-check + lint) and bump GitHub Actions Jul 2, 2026
@rubensa

rubensa commented Jul 3, 2026

Copy link
Copy Markdown
Author

Here you can see a sample build for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant