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

Merged

Conversation

DonIsaac
Copy link
Contributor

@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
Contributor Author

DonIsaac commented Oct 28, 2024

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 requested review from Boshen and camchenry October 28, 2024 01:32
@github-actions github-actions bot added A-linter Area - Linter C-enhancement Category - New feature or request labels Oct 28, 2024
@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
@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
Contributor 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
Contributor 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 (2268a0e) with main (c6a4868)

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
Contributor

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 3 times, most recently from 3018e86 to 37bb623 Compare October 28, 2024 17:49
@DonIsaac DonIsaac requested a review from Boshen October 29, 2024 01:11
@Boshen Boshen changed the base branch from don/10-26-refactor_linter_move_lintplugins_from_lintoptions_to_lintconfig_ to graphite-base/6974 October 29, 2024 01:28
@Boshen Boshen force-pushed the graphite-base/6974 branch from 0be2975 to 8f1460e Compare October 29, 2024 01:32
@Boshen Boshen force-pushed the don/10-27-feat_linter_support_overrides_config_field branch from 37bb623 to abc9ffd Compare October 29, 2024 01:32
@Boshen Boshen changed the base branch from graphite-base/6974 to main October 29, 2024 01:33
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 see we have a bit of refactoring going on in this PR, I'd try and get them merged first.

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.

We also need integration tests in

mod test {

Boshen pushed a commit to oxc-project/eslint-plugin-oxlint that referenced this pull request Nov 2, 2024
closes #194 

Long way for the goal:

- [x] support simple "rules" block
- [x] support simple "categories" block
- [x] support simple "plugins" block
- [x] support "categories" on, and "rules" off *
- [x] support "plugins" on, and "rules off *
- [x] numbers instead of `off`, `warn` or `error`
- [x] configuration array like: `no-magic_numbers: ["off", {...}]`
- [x] filter rules which are not enabled by plugin
- [x] all other wierd combinations
- [x] enable eslint always
- [x] check import from `../scripts` folder in build file
- [x] support jsonc / comments in files
- [x] prepare for overrides oxc-project/oxc#6974
- [x] Docs
- [x] more tests
  - [x] test rules count with oxlint command
- [x] ~~depends on oxc-project/oxc#6896
workaround in tests
- [x] ~~depends on oxc-project/oxc#7031
disabled `nursery` in integration test

\* the rules block overrides the rules from the other blocks, so this
should be enabled in eslint

```json
{
  "categories": {
    "correctness": "error",
  }
  "rules": {
    "no-invalid-regexp": "off"
  }
}
```
@camchenry camchenry force-pushed the don/10-27-feat_linter_support_overrides_config_field branch 2 times, most recently from 555ca15 to b97ae7e Compare November 13, 2024 03:31
@camchenry camchenry changed the base branch from main to 11-12-refactor_linter_temporarily_remove_unknown_rules_checking November 13, 2024 03:32
camchenry added a commit that referenced this pull request Nov 13, 2024
I had intended to leave this in until we could rework some of the rule/plugin name resolution code, however this is causing issues with merging #6974. The mutability of `self` is difficult to resolve in that PR without more drastic changes. Since this isn't currently helping us out, I am simply removing the code for now until we can revisit this.
@camchenry camchenry force-pushed the 11-12-refactor_linter_temporarily_remove_unknown_rules_checking branch from 9c18f1b to c6a4868 Compare November 13, 2024 03:41
Base automatically changed from 11-12-refactor_linter_temporarily_remove_unknown_rules_checking to main November 13, 2024 03:45
@camchenry camchenry force-pushed the don/10-27-feat_linter_support_overrides_config_field branch from e84a98e to 21f5b71 Compare November 13, 2024 04:01
@github-actions github-actions bot added the A-cli Area - CLI label Nov 13, 2024
@camchenry camchenry requested a review from Boshen November 13, 2024 04:02
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Nov 13, 2024
Copy link
Member

Boshen commented Nov 13, 2024

Merge activity

  • Nov 13, 12:40 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Nov 13, 12:40 AM EST: A user added this pull request to the Graphite merge queue.
  • Nov 13, 12:45 AM EST: A user merged this pull request with the Graphite merge queue.

@Boshen Boshen force-pushed the don/10-27-feat_linter_support_overrides_config_field branch from 21f5b71 to 2268a0e Compare November 13, 2024 05:41
@graphite-app graphite-app bot merged commit 2268a0e into main Nov 13, 2024
26 checks passed
@graphite-app graphite-app bot deleted the don/10-27-feat_linter_support_overrides_config_field branch November 13, 2024 05:45
Dunqing pushed a commit that referenced this pull request Nov 17, 2024
I had intended to leave this in until we could rework some of the rule/plugin name resolution code, however this is causing issues with merging #6974. The mutability of `self` is difficult to resolve in that PR without more drastic changes. Since this isn't currently helping us out, I am simply removing the code for now until we can revisit this.
Dunqing pushed a commit that referenced this pull request Nov 17, 2024
Dunqing pushed a commit that referenced this pull request Nov 18, 2024
I had intended to leave this in until we could rework some of the rule/plugin name resolution code, however this is causing issues with merging #6974. The mutability of `self` is difficult to resolve in that PR without more drastic changes. Since this isn't currently helping us out, I am simply removing the code for now until we can revisit this.
Dunqing pushed a commit that referenced this pull request Nov 18, 2024
Dunqing pushed a commit that referenced this pull request Nov 18, 2024
I had intended to leave this in until we could rework some of the rule/plugin name resolution code, however this is causing issues with merging #6974. The mutability of `self` is difficult to resolve in that PR without more drastic changes. Since this isn't currently helping us out, I am simply removing the code for now until we can revisit this.
Dunqing pushed a commit that referenced this pull request Nov 18, 2024
Boshen added a commit that referenced this pull request Nov 20, 2024
## [0.12.0] - 2024-11-20

- 20d9080 linter: [**BREAKING**] Override plugins array when passed in
config file (#7303) (camchenry)

### Features

- 1d9f528 linter: Implement `unicorn/prefer-string-raw` lint rule
(#7335) (Ryan Walker)
- d445e0f linter: Implement `unicorn/consistent-existence-index-check`
(#7262) (Ryan Walker)
- 01ddf37 linter: Add `allowReject` option to
`no-useless-promise-resolve-reject` (#7274) (no-yan)
- 755a31b linter: Support bind function case for compatibility with
`promise/no-return-wrap` (#7232) (no-yan)
- 428770e linter: Add `import/no-namespace` rule (#7229) (Dmitry
Zakharov)
- 9c91151 linter: Implement typescript/no-empty-object-type (#6977)
(Orenbek)
- 2268a0e linter: Support `overrides` config field (#6974) (DonIsaac)
- 3dcac1a linter: React/exhaustive-deps (#7151) (camc314)
- d3a0119 oxlint: Add `cwd` property to `LintRunner` (#7352) (Alexander
S.)

### Bug Fixes

- ba0b2ff editor: Reload workspace configuration after change (#7302)
(Alexander S.)
- bc0e72c linter: Handle user variables correctly for import/no_commonjs
(#7316) (Dmitry Zakharov)
- bf839c1 linter: False positive in `jest/expect-expect` (#7341)
(dalaoshu)
- ff2a1d4 linter: Move `exhaustive-deps` to `react` (#7251) (camc314)
- df5c535 linter: Revert unmatched rule error (#7257) (Cameron A
McHenry)
- c4ed230 linter: Fix false positive in eslint/no-cond-assign (#7241)
(camc314)
- ef847da linter: False positive in `jsx-a11y/iframe-has-title` (#7253)
(dalaoshu)
- 62b6327 linter: React/exhaustive-deps update span for unknown deps
diagnostic (#7249) (camc314)

### Documentation

- 4c124a8 editor/vscode: Update VS Code readme with installation
instructions and available features (#7306) (Nicholas Rayburn)

### Refactor

- c6a4868 linter: Temporarily remove unknown rules checking (#7260)
(camchenry)

### Testing

- 5190b7f editor: Add test setup (#7361) (Alexander S.)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue 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.

4 participants