Skip to content

fix(eslint): eliminate IDE false positives in browser packages#6251

Merged
macko911 merged 2 commits into
masterfrom
matej/nan-5733-fix-eslint-ide-false-positives-in-browser-packages-due-to
May 27, 2026
Merged

fix(eslint): eliminate IDE false positives in browser packages#6251
macko911 merged 2 commits into
masterfrom
matej/nan-5733-fix-eslint-ide-false-positives-in-browser-packages-due-to

Conversation

@macko911

@macko911 macko911 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Type-aware ESLint rules fire hundreds of false-positive errors in the IDE for packages/webapp, packages/frontend, and packages/connect-ui — but the same files pass lint cleanly in CI.

The root cause: the VS Code ESLint extension creates a separate TypeScript program per unique parserOptions.project value it finds in matching config blocks. These browser-package files match both the root **/*.{ts,tsx} block (project: './tsconfig.json') and their own package block (project: 'packages/webapp/tsconfig.json'). The root tsconfig has no DOM or React lib, so the IDE type-checks React code against it, every hook import degrades to an error type, and rules like no-unnecessary-type-assertion fire as false positives.

The CLI doesn't have this problem because flat config merges all matching blocks into one before parsing — so only the last parserOptions.project wins and the correct tsconfig is used.

Solution

Extracted the shared typescript-eslint presets and rule overrides into module-level variables (tseslintExtends, tseslintRules), then:

  • Added ignores to the root **/*.{ts,tsx} block for the three browser packages — the IDE now creates only one TypeScript program (the package-specific one) for those files
  • Added @typescript-eslint plugin + extends: tseslintExtends + rules: { ...tseslintRules } directly to each browser-package block so they get the full rule set evaluated against their own tsconfig

No rules were added or removed. CI lint output is unchanged.

Fixes NAN-5733

Testing

  • eslint packages/webapp/src/pages/Connection/CreateLegacy.tsx — same 8 warnings as before, no false positives
  • eslint packages/connect-ui/src/App.tsx + packages/frontend/lib/index.ts — no regressions

The VS Code ESLint extension creates a separate TypeScript program for
every unique parserOptions.project value it encounters in matching config
blocks. Files in webapp/frontend/connect-ui matched both the root block
(project: './tsconfig.json', no DOM/React lib) and their own package
block, so type-aware rules ran with degraded types — every React hook
import became an error type, firing hundreds of spurious
no-unnecessary-type-assertion and unsafe-* violations in the IDE.

Fix:
- Extract shared tseslint preset list and custom rule overrides into
  module-level variables (tseslintExtends, tseslintRules)
- Add ignores to the root **/*.{ts,tsx} block for the three browser
  packages so the IDE never creates a root-tsconfig program for them
- Include the shared variables directly in each browser-package block
  so they get the full rule set evaluated against their own tsconfig

No rules are added or removed; CI lint output is unchanged.
@linear

linear Bot commented May 26, 2026

Copy link
Copy Markdown

NAN-5733

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@macko911 macko911 marked this pull request as ready for review May 26, 2026 21:49
@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. labels May 26, 2026
@macko911 macko911 added this pull request to the merge queue May 27, 2026
Merged via the queue into master with commit edbb894 May 27, 2026
29 checks passed
@macko911 macko911 deleted the matej/nan-5733-fix-eslint-ide-false-positives-in-browser-packages-due-to branch May 27, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants