Repository navigation
build: enable lint rules - #99
Draft
liangmiQwQ wants to merge 9 commits into
Draft
liangmiQwQ wants to merge 9 commits into
liangmiQwQ wants to merge 9 commits into
Conversation
Upgrade electron-vite to v6 and Vite to v8, the base for the Vite+ migration. - Rename `rollupOptions` to `rolldownOptions`, since Vite 8 bundles with Rolldown. - Replace the `manualChunks` function with a Rolldown `codeSplitting` group that keeps Cesium in its own chunk. - Update the pinned Vite version note in AGENTS.md.
Run the unit tests with Vitest instead of `node --test`. - Import `test` from `vitest` in every test file. - Replace `t.after` with `t.onTestFinished`, and `t.mock.timers` with `vi.useFakeTimers` and `vi.advanceTimersByTime`. - Turn off Vite's module runner in `vite.config.mts`, so the tests keep using native Node.js imports and their `module.registerHooks` fixtures.
Type-check with the native TypeScript 7 compiler. - Remove `baseUrl` and make `paths` relative, since TypeScript 7 dropped `baseUrl`. - Point the tests that use the compiler API (`transpileModule`, the AST) at `@typescript/typescript6`, because TypeScript 7 has no stable JS API yet. - Run TypeScript 7's `tsc` by path in `npm run typecheck`. `@typescript/typescript6` also links a TypeScript 6 `tsc` into `node_modules/.bin`, so a bare `tsc` could run the wrong version.
Move the toolchain to Vite+, configured with the `@liangmi/vp-config` preset.
- Alias `vite` to `@voidzero-dev/vite-plus-core`, and import test APIs from `vite-plus/test`.
- Replace `npm run typecheck` with `npm run check` (`vp check`), which type-checks through tsrs-lint. Lint rules and formatting are off (`check: { fmt: false, lint: false }`) and get turned on in follow-up PRs.
- Make the root `tsconfig.json` reference `tsconfig.node.json` and `tsconfig.web.json`, so each file is checked with its own project's settings. Add the two config files to the node project.
- Keep the Node test environment. The preset would pick jsdom, but the tests set up their own DOM.
Turn on the `@liangmi/vp-config` lint rules in `vp check`, and fix what they report. A few rules are off because they clash with how GuEarth is written, or because their fixes trust types that IPC and JSON payloads don't guarantee at runtime. Each one has a comment in `vite.config.mts`: - `unicorn/filename-case`, `import/no-default-export`, `import/no-named-as-default`: components use PascalCase files and default exports. - `unicorn/prefer-global-this`, `eslint/no-underscore-dangle`: the renderer uses `window` and Cesium's private `_` fields on purpose. - `unicorn/prefer-module`: the main process is bundled as CommonJS. - `eslint/max-classes-per-file`: stores and errors are classes. - `react-perf/*`: JSX props aren't memoized anywhere. - `typescript/no-unnecessary-condition`, `no-unnecessary-boolean-literal-compare`, `no-unnecessary-type-conversion`: the defensive checks they remove guard untyped runtime data. The boolean compare autofix turned `textFrame === true` into `undefined` for a missing value. - `typescript/prefer-nullish-coalescing`: `||` treats empty strings as missing on purpose. - `unicorn/no-array-sort`, `unicorn/no-array-reverse`: `toSorted` needs the ES2023 lib. - `unicorn/consistent-function-scoping`, `unicorn/max-nested-calls`, `promise/prefer-await-to-callbacks`, `typescript/method-signature-style`: style-only churn.
Apply `vp lint --fix`, then repair what it got wrong:
- Keep `thinkingLevels` typed as a `Set<AiThinkingLevel>` after `prefer-set-has`.
- Keep the shape `kind` literal type that `no-unnecessary-type-assertion` dropped.
- Match the `node:` specifiers from `prefer-node-protocol` in the tests' module stubs and resolve hooks.
- Update source-text assertions for the braces from `curly` and the `() => {}` from `no-useless-undefined`.
Give block bodies to arrow callbacks whose return value is ignored, such as `setTimeout` in promise executors and stream listeners, and apply a second autofix pass. The shutdown flush becomes `.then(() => flushJsonWrites())`. It still waits for the flush, because the chain can't reject after `.catch`.
Turn off the rules that clash with how GuEarth is written, or whose fixes change behavior, each with a comment in `vite.config.mts`. Hoist the late imports in the main process entry, since ES module imports are hoisted anyway.
Fix the reports that point at real problems: - Await `clipboard.writeText` in the `logging:copy-report` handler. It returns a promise in Electron 44, so the renderer heard back before the copy finished, and a failure went unhandled. - Mark fire-and-forget promises with `void`, such as `loadURL` and `app.whenReady()`. - Remove unused imports, variables, a helper, an unused `endpoint` parameter, and a duplicated `if` branch in the model importer. - Rename echarts' `use` to `registerEcharts`, so it isn't mistaken for a React hook. Where a rule is wrong for one line, the line has an `oxlint-disable-next-line` comment with the reason, such as control characters that device names must not contain.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 26, 2026
|
Warning This PR is in a stack (5 of 6). Learn more about stacked PRs created with forkstack.
The stack's author can rebase it from the stack page. |
This was referenced Nov 26, 2026
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 3 critical |
🟢 Metrics 156 complexity · 10 duplication
Metric Results Complexity 156 Duplication 10
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR turns on the
@liangmi/vp-configlint rules invp checkand fixes what they report. Commits are split into the autofix pass and the hand fixes.It fixes one real bug.
clipboard.writeTextreturns a promise in Electron 44, but thelogging:copy-reporthandler didn't await it. The renderer heard back before the copy finished, and a failure went unhandled.Rules that clash with how GuEarth is written are turned off in
vite.config.mts, each with a comment. So are rules whose fixes would change behavior. For example:filename-case,no-default-export: components use PascalCase files and default exports.no-unnecessary-conditionand its siblings: they remove defensive checks on IPC and JSON data. Their autofix turnedtextFrame === trueintoundefinedfor a missing value.require-await: toolexecute, imagery providers and retry handlers must return promises.prefer-structured-clone,prefer-catch: the rewrites behave differently (structuredClonethrows on functions, and.then(a, b)only catches the original promise).refs,set-state-in-effect, …): fixing them changes render and effect timing, so they need testing in the running app first.The autofix also changed
require('crypto')tonode:crypto, so the tests' module stubs and resolve hooks now usenode:specifiers too.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.