feat(linter): implement disallows using this in an exported function rule#15745
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
832c92e to
6b210a8
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements a new linter rule no-this-in-exported-function for the oxc linter that detects and warns against using this in exported functions, as this becomes undefined in most bundlers when functions are exported and imported.
Key Changes:
- New linter rule implementation with AST visitor pattern to detect
thisusage in exported functions - Comprehensive test coverage with 13 pass cases and 12 fail cases
- Integration of the rule into the oxc linter module system
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/oxc/no_this_in_exported_function.rs | Core implementation of the rule with AST visitor, diagnostic generation, and test cases |
| crates/oxc_linter/src/snapshots/oxc_no_this_in_exported_function.snap | Snapshot file containing expected diagnostic output for failing test cases |
| crates/oxc_linter/src/rules.rs | Registration of the new rule in the oxc module system |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/oxc_linter/src/rules/oxc/no_this_in_exported_function.rs
Outdated
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #15745 will not alter performanceComparing Summary
Footnotes
|
|
Would you mind taking a moment to leave a review? |
|
I'm terribly sorry to trouble you again. I'd be most grateful if you could take a look at this too! |
|
@sapphi-red do you mind taking a quick pass and having a look at this? thanks! |
crates/oxc_linter/src/rules/oxc/no_this_in_exported_function.rs
Outdated
Show resolved
Hide resolved
crates/oxc_linter/src/rules/oxc/no_this_in_exported_function.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: 翠 <[email protected]> Signed-off-by: Cameron <[email protected]>
Co-authored-by: 翠 <[email protected]> Signed-off-by: Cameron <[email protected]>
Co-authored-by: 翠 <[email protected]> Signed-off-by: Cameron <[email protected]>
Summary
close: #15359
I implemented disallows using this in an exported function rule for oxc