Skip to content

Conversation

camc314
Copy link
Contributor

@camc314 camc314 commented Sep 30, 2025

No description provided.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-enhancement Category - New feature or request labels Sep 30, 2025
Copy link
Contributor Author

camc314 commented Sep 30, 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.

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

@camc314 camc314 marked this pull request as ready for review September 30, 2025 16:41
@Copilot Copilot AI review requested due to automatic review settings September 30, 2025 16:41
Copy link
Contributor

@Copilot 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 adds support for .oxlintrc.jsonc configuration files to the oxlint linter, expanding the existing .json format support to include JSON with comments (JSONC).

  • Updates auto-detection logic to prioritize .oxlintrc.jsonc over .oxlintrc.json
  • Updates documentation and help text to reflect support for both formats
  • Adds comprehensive test coverage for JSONC config functionality

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/oxc_linter/src/config/oxlintrc.rs Updates documentation to mention both .json and .jsonc format support
apps/oxlint/src/command/lint.rs Updates CLI help text to reflect support for both config file formats
apps/oxlint/src/lint.rs Implements JSONC config auto-detection logic with priority over JSON format
apps/oxlint/fixtures/* Adds test fixtures for JSONC configuration scenarios
apps/oxlint/src/snapshots/* Adds test snapshots validating JSONC config functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +581 to +590
// Try .oxlintrc.jsonc first, then .oxlintrc.json
let jsonc_path = cwd.join(Self::DEFAULT_OXLINTRC_JSONC);
if jsonc_path.exists() {
return Oxlintrc::from_file(&jsonc_path);
}

let json_path = cwd.join(Self::DEFAULT_OXLINTRC);
if json_path.exists() {
return Oxlintrc::from_file(&json_path);
}
Copy link
Preview

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the repeated config file detection logic into a helper function to reduce duplication between find_oxlint_config and find_oxlint_config_in_directory. Both functions implement the same priority order (.jsonc then .json) with similar structure.

Copilot uses AI. Check for mistakes.

Comment on lines +581 to +609
// Try .oxlintrc.jsonc first, then .oxlintrc.json
let jsonc_path = cwd.join(Self::DEFAULT_OXLINTRC_JSONC);
if jsonc_path.exists() {
return Oxlintrc::from_file(&jsonc_path);
}

let json_path = cwd.join(Self::DEFAULT_OXLINTRC);
if json_path.exists() {
return Oxlintrc::from_file(&json_path);
}

Ok(Oxlintrc::default())
}

/// Looks in a directory for an oxlint config file, returns the oxlint config if it exists
/// and returns `Err` if none exists or the file is invalid. Does not apply the default
/// config file.
fn find_oxlint_config_in_directory(dir: &Path) -> Result<Option<Oxlintrc>, OxcDiagnostic> {
let possible_config_path = dir.join(Self::DEFAULT_OXLINTRC);
if possible_config_path.is_file() {
Oxlintrc::from_file(&possible_config_path).map(Some)
} else {
Ok(None)
// Try .oxlintrc.jsonc first, then .oxlintrc.json
let jsonc_path = dir.join(Self::DEFAULT_OXLINTRC_JSONC);
if jsonc_path.is_file() {
return Oxlintrc::from_file(&jsonc_path).map(Some);
}

let json_path = dir.join(Self::DEFAULT_OXLINTRC);
if json_path.is_file() {
return Oxlintrc::from_file(&json_path).map(Some);
}

Copy link
Preview

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

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

[nitpick] This code duplicates the same logic as in find_oxlint_config. Consider extracting this into a helper function that takes a directory path and returns the first existing config file path, or None if neither exists.

Copilot uses AI. Check for mistakes.

Copy link

codspeed-hq bot commented Sep 30, 2025

CodSpeed Instrumentation Performance Report

Merging #14267 will not alter performance

Comparing c/09-30-feat_linter_support_.oxlintrc.jsonc_config_files (8404afb) with main (ece91c5)

Summary

✅ 4 untouched
⏩ 33 skipped1

Footnotes

  1. 33 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Member

@Sysix Sysix left a comment

Choose a reason for hiding this comment

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

I do not like this idea of adding a second config file to search for.
More info: #7348 (comment) and #8688


Review:
Can we add a test for .oxlintrc.json and .oxlintrc.jsonc file in the same directory? Looks like .jsonc should win.
Please the same test for the server too ❤️

@camc314 camc314 self-assigned this Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area - CLI A-linter Area - Linter C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants