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

linter: Overrides property is not working with "Vitest" plugin #9649

Open
i62navpm opened this issue Mar 10, 2025 · 1 comment
Open

linter: Overrides property is not working with "Vitest" plugin #9649

i62navpm opened this issue Mar 10, 2025 · 1 comment
Assignees
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@i62navpm
Copy link

What version of Oxlint are you using?

0.15.13

What command did you run?

yarn oxlint -c .oxlintrc.json index.test.ts

What does your .oxlintrc.json config file look like?

{
  "categories": {
    "style": "error"
  },
  "overrides": [
    {
      "files": ["./index.test.ts"],
      "plugins": ["vitest"]
    }
  ]
}

What happened?

The linter only works when the plugins property is set in the root of the config file, when the plugins property is set in the overrides property, the linter does not work.

This is the config file that works:

{
  "plugins": ["vitest"]
 "categories": {
   "style": "error"
 },
 "overrides": [
 ]
}

But this one doesn't work:

{
  "categories": {
    "style": "error"
  },
  "overrides": [
    {
      "files": ["./index.test.ts"],
      "plugins": ["vitest"]
    }
  ]
}
Screen.Recording.2025-03-10.at.11.02.11.mov
@i62navpm i62navpm added A-linter Area - Linter C-bug Category - Bug labels Mar 10, 2025
@camchenry camchenry self-assigned this Mar 12, 2025
@camchenry
Copy link
Member

I had look into this a little bit. I think there is a specification issue here that we need to think about. The problem essentially boils down to the order in which rules are enabled causes the difference in behavior.

When enabling plugins at the top-level, it allows those rules to be accessible as part of the base rule set, which then factors into which rules are enabled by categories. But if the plugins are enabled as part of an override, it can't factor into the base rule set, since that happens too late and we don't recalculate the base rules at that point.

If we want categories to apply to overrides as well, then we probably need to store what categories are enabled in the ConfigStore, not just compute the base rule set once at the beginning.

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

No branches or pull requests

2 participants