Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linter): Add support for ignores property within config file #7092

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nrayburn-tech
Copy link
Contributor

This could probably use some tests, but I'm not really sure what exactly should be tested.

Will leave a review with a few comments on things that might need a different approach.

Closes #7032.

Copy link

graphite-app bot commented Nov 2, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

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

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-editor Area - Editor and Language Server C-enhancement Category - New feature or request labels Nov 2, 2024
let paths = Walk::new(
&paths,
&ignore_options,
&oxlintrc.ignores.iter().map(|value| cwd.join(value)).collect::<Vec<_>>(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This joins with the current working directory, but maybe it should be based on the config file path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the config file path is also problematic because you might store all your config in a configs folder, so then all your globs would need to traverse up to get out of it.

Maybe the current working directory is the easiest to explain right now. When thinking about nested config files I feel like it becomes less clear though.

Copy link
Contributor

@pumano pumano Nov 3, 2024

Choose a reason for hiding this comment

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

Usually use case:

  1. simple project: eslint config in root folder
  2. Monorepo setup: each folder (library or project) can contain eslint config extended from base root config file and then ovverride or add own rules and etc

Usually ignores used mostly from root config

crates/oxc_language_server/src/main.rs Outdated Show resolved Hide resolved
.add_line(None, path)
.expect("Invalid glob in config \"ignores\" property");
}
self.gitignore_glob.lock().await.push(gitignore_builder.build().unwrap());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This modifies self.gitignore_glob after it has been created in init_ignore_glob. This might be confusing and things could probably be refactored so that it isn't modified outside of init_ignore_glob.

Copy link

codspeed-hq bot commented Nov 2, 2024

CodSpeed Performance Report

Merging #7092 will not alter performance

Comparing nrayburn-tech:support-ignores-config (a70b833) with main (9ed9501)

Summary

✅ 30 untouched benchmarks

@pumano
Copy link
Contributor

pumano commented Nov 4, 2024

@Boshen Could you please a look at this PR?

@Boshen Boshen self-assigned this Nov 4, 2024
@Boshen Boshen self-requested a review November 4, 2024 13:46
@Boshen Boshen assigned camchenry and unassigned Boshen Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area - CLI A-editor Area - Editor and Language Server A-linter Area - Linter C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

linter: add support "ignores" to config
4 participants