oxc/crates/oxc_linter
DonIsaac f7da22da18 perf(linter): disable lint rules by file type (#4380)
### TL;DR

Added a `should_run` function to multiple lint rules to determine if a rule should be executed based on the source type. This change optimizes the linting process by avoiding unnecessary rule checks.

### What changed?

1. **New Method**: Introduced the `should_run` method in the `Rule` trait.
2. **Implementation**: Implemented the `should_run` method for various lint rules, particularly those related to React and TypeScript.
3. **Usage**: Updated the `Linter` to use the `should_run` method to filter rules before execution.
4. **Macro Update**: Modified the `declare_all_lint_rules` macro to incorporate the `should_run` method.

### How to test?

1. Run the linter on a project containing React and TypeScript files.
2. Verify that only relevant rules are executed based on the file type (e.g., JSX rules for React files).

### Why make this change?

This change improves the performance of the linter by ensuring that only applicable rules are run for a given file type, reducing unnecessary computation and potential false positives.

---
2024-07-21 15:22:54 +00:00
..
examples refactor(linter): improve diagnostic labeling (#3960) 2024-06-29 05:19:22 +00:00
fixtures
src perf(linter): disable lint rules by file type (#4380) 2024-07-21 15:22:54 +00:00
tests
Cargo.toml feat(linter): support suggestions and dangerous fixes (#4223) 2024-07-18 02:20:30 +00:00
CHANGELOG.md Release oxlint v0.6.1 (#4326) 2024-07-17 21:18:28 +08:00