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): support overrides config field #6974

Open
wants to merge 1 commit into
base: don/10-26-refactor_linter_move_lintplugins_from_lintoptions_to_lintconfig_
Choose a base branch
from

Conversation

DonIsaac
Copy link
Collaborator

@DonIsaac DonIsaac commented Oct 28, 2024

Part of #5653

Copy link

graphite-app bot commented Oct 28, 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.

Copy link
Collaborator Author

DonIsaac commented Oct 28, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

Join @DonIsaac and the rest of your teammates on Graphite Graphite

@DonIsaac DonIsaac force-pushed the don/10-27-feat_linter_support_overrides_config_field branch from 10fd2be to 3f72622 Compare October 28, 2024 01:48
let all_rules = RULES
.iter()
.filter(|rule| plugins.contains(LintPlugins::from(rule.plugin_name())))
.cloned()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I want to replace Vec<RuleWithSeverity> with Vec<Cow<RuleWithSeverity>> to avoid cloning individual rules unless their configs get changed by an override. Unfortunately, this requires a self-referential lifetime. Looking into it.

@DonIsaac DonIsaac force-pushed the don/10-27-feat_linter_support_overrides_config_field branch from 3f72622 to aa1cfea Compare October 28, 2024 02:07
@DonIsaac
Copy link
Collaborator Author

DonIsaac commented Oct 28, 2024

Benchmarking on an internal codebase, I'm seeing a roughly 14% perf degredation with a single override that uses 4 glob patterns.
image

Config file:

{
  "categories": {
    "correctness": "error",
    "suspicious": "warn"
  },
  "rules": {
    "oxc/no-accumulating-spread": "warn"
  },
  "overrides": [
    {
      "files": ["*.spec.ts", "*.spec.tsx", "*.test.ts", "*.test.tsx"],
      "rules": {
        "oxc/no-accumulating-spread": "off",
        "@typescript-eslint/no-explicit-any": "off",
        "no-unused-vars": "off"
      }
    }
  ]
}

@DonIsaac DonIsaac force-pushed the don/10-26-refactor_linter_move_lintplugins_from_lintoptions_to_lintconfig_ branch from 4c1f24b to f6a7fbb Compare October 28, 2024 03:30
@DonIsaac DonIsaac force-pushed the don/10-27-feat_linter_support_overrides_config_field branch from aa1cfea to 75b2411 Compare October 28, 2024 03:31
@DonIsaac
Copy link
Collaborator Author

Still needs tests. I'll add those tomorrow.

@DonIsaac DonIsaac marked this pull request as ready for review October 28, 2024 03:32
@DonIsaac DonIsaac added this to the Oxlint Beta Milestone milestone Oct 28, 2024
Copy link

codspeed-hq bot commented Oct 28, 2024

CodSpeed Performance Report

Merging #6974 will not alter performance

Comparing don/10-27-feat_linter_support_overrides_config_field (37bb623) with don/10-26-refactor_linter_move_lintplugins_from_lintoptions_to_lintconfig_ (0be2975)

Summary

✅ 30 untouched benchmarks

Copy link
Member

@Boshen Boshen left a comment

Choose a reason for hiding this comment

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

I'll test this locally.

@camchenry
Copy link
Collaborator

Benchmarking on an internal codebase, I'm seeing a roughly 14% perf degredation with a single override that uses 4 glob patterns.

I wonder how much of that is related to just reading the config file? What happens if you pass -c to both binaries, but one doesn't have an override.

Nothing sticks out at me as being extremely slow here, I think I'd need to dive in and do some profiling first.

@DonIsaac DonIsaac force-pushed the don/10-26-refactor_linter_move_lintplugins_from_lintoptions_to_lintconfig_ branch from f6a7fbb to 0be2975 Compare October 28, 2024 17:41
@DonIsaac DonIsaac force-pushed the don/10-27-feat_linter_support_overrides_config_field branch 2 times, most recently from 55818d9 to 3018e86 Compare October 28, 2024 17:46
@DonIsaac DonIsaac force-pushed the don/10-27-feat_linter_support_overrides_config_field branch from 3018e86 to 37bb623 Compare October 28, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants