Skip to content

fix(linter): Fix false positive on React in consistent-type-imports#11171

Merged
graphite-app[bot] merged 1 commit intomainfrom
don/05-19-fix_linter_fix_false_positive_on_react_in_consistent-type-imports_
May 19, 2025
Merged

fix(linter): Fix false positive on React in consistent-type-imports#11171
graphite-app[bot] merged 1 commit intomainfrom
don/05-19-fix_linter_fix_false_positive_on_react_in_consistent-type-imports_

Conversation

@DonIsaac
Copy link
Copy Markdown
Contributor

@DonIsaac DonIsaac commented May 19, 2025

What This PR Does

Updates typescript/consistent-type-imports to ignore React.

This is not a "great" solution; ideally we would be reading the user's tsconfig.json and using info from that to selectively ignore/report unused React imports. Doing this would also fix remaining false positives in this rule. This workaround should work in most cases though.

I can make follow-up PR to have our lint runtime parse tsconfig.json files and make that data available to rules via LintContext. That change would potentially have large implications and lots of edge cases, so we should discuss it first.

@github-actions github-actions Bot added the A-linter Area - Linter label May 19, 2025
Copy link
Copy Markdown
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the C-bug Category - Bug label May 19, 2025
@DonIsaac DonIsaac marked this pull request as ready for review May 19, 2025 18:46
@DonIsaac DonIsaac requested a review from camc314 as a code owner May 19, 2025 18:46
@DonIsaac DonIsaac force-pushed the don/05-19-fix_linter_fix_false_positive_on_react_in_consistent-type-imports_ branch from 0a433fe to 73302bb Compare May 19, 2025 18:48
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 19, 2025

CodSpeed Instrumentation Performance Report

Merging #11171 will degrade performances by 3.72%

Comparing don/05-19-fix_linter_fix_false_positive_on_react_in_consistent-type-imports_ (4104b01) with main (67c0b4d)

Summary

❌ 1 regressions
✅ 37 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[cal.com.tsx] 2.9 ms 3 ms -3.72%

@camc314
Copy link
Copy Markdown
Contributor

camc314 commented May 19, 2025

this is horrible lol

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label May 19, 2025
Copy link
Copy Markdown
Contributor

camc314 commented May 19, 2025

Merge activity

Copy link
Copy Markdown
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

lgtm

…#11171)

## What This PR Does

Updates `typescript/consistent-type-imports` to ignore `React`.

This is not a "great" solution; ideally we would be reading the user's `tsconfig.json` and using info from that to selectively ignore/report unused `React` imports. Doing this would also fix remaining false positives in this rule. This workaround should work in most cases though.

I can make follow-up PR to have our lint runtime parse `tsconfig.json` files and make that data available to rules via `LintContext`. That change would potentially have large implications and lots of edge cases, so we should discuss it first.
@graphite-app graphite-app Bot force-pushed the don/05-19-fix_linter_fix_false_positive_on_react_in_consistent-type-imports_ branch from 73302bb to 4104b01 Compare May 19, 2025 19:34
@graphite-app graphite-app Bot merged commit 4104b01 into main May 19, 2025
22 checks passed
@graphite-app graphite-app Bot deleted the don/05-19-fix_linter_fix_false_positive_on_react_in_consistent-type-imports_ branch May 19, 2025 19:37
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants