Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 12, 2025

The --type-aware linting functionality was crashing when projects contained Vue files. The issue occurred because the tsgolint module was attempting to process all lintable files (including .vue files) for type checking, but SourceType::from_path() only supports JavaScript and TypeScript file extensions.

Problem

When running oxlint --type-aware on a project containing Vue files, the program would fail with an error because:

  1. The file walker collects all lintable files, including .vue files (which are in LINTABLE_EXTENSIONS)
  2. The tsgolint functionality tries to process all collected files for type checking
  3. SourceType::from_path() returns an error for .vue files since they're not valid JS/TS extensions
  4. This caused the type-aware linting to fail entirely

Solution

Added a filter in tsgolint.rs to only process files that can be handled by SourceType::from_path() (i.e., JavaScript and TypeScript files) before sending them to tsgolint for type checking. Vue files and other non-JS/TS files are now filtered out during type-aware linting while still being processed correctly by the normal linter.

The fix is minimal and surgical - only 4 lines added to filter the file paths before processing, ensuring that:

  • Normal linting continues to work with all file types including Vue files
  • Type-aware linting only processes JS/TS files and no longer crashes
  • All existing functionality is preserved

Testing

  • All existing tests pass (124/124)
  • Manual testing confirms the fix works with mixed file types
  • Type-aware linting now gracefully handles projects with Vue files

Fixes #13003.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 12, 2025

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.

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Copilot AI changed the title [WIP] linter: --type-aware linting fails when projects contains vue files Fix type-aware linting crash when Vue files are present Aug 12, 2025
Copilot AI requested a review from Boshen August 12, 2025 01:38
Copilot finished work on behalf of Boshen August 12, 2025 01:38
…of PathBuf

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Copilot AI requested a review from Boshen August 12, 2025 02:25
Copilot finished work on behalf of Boshen August 12, 2025 02:25
@github-actions github-actions bot added the A-cli Area - CLI label Aug 12, 2025
@Boshen Boshen changed the title Fix type-aware linting crash when Vue files are present fix(oxlint): Fix type-aware linting crash when Vue files are present Aug 12, 2025
@github-actions github-actions bot added the C-bug Category - Bug label Aug 12, 2025
@Boshen Boshen marked this pull request as ready for review August 12, 2025 02:54
Copilot AI review requested due to automatic review settings August 12, 2025 02:54
@Boshen Boshen requested a review from camc314 as a code owner August 12, 2025 02:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a crash in the --type-aware linting functionality when Vue files are present in the project. The issue occurred because the type-aware linter was attempting to process all lintable files (including Vue files) through SourceType::from_path(), which only supports JavaScript and TypeScript extensions.

  • Added a filter to exclude non-JS/TS files from type-aware processing
  • Imported SourceType to enable the filtering functionality
  • Preserved normal linting behavior for all file types including Vue files

@Boshen Boshen merged commit c461a86 into main Aug 12, 2025
21 of 22 checks passed
@Boshen Boshen deleted the copilot/fix-13003 branch August 12, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: --type-aware linting fails when projects contains vue files

2 participants