-
-
Notifications
You must be signed in to change notification settings - Fork 726
feat(linter/plugins): comment-related APIs #14715
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
Merged
overlookmotel
merged 28 commits into
oxc-project:main
from
lilnasy:feat/linter/plugins/comments
Oct 18, 2025
+666
−100
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
891c8db
feat(linter/plugins): comment-related APIs
lilnasy 6153a88
ensure adjacency in and
lilnasy fbbaee4
style
lilnasy 5dc8cac
refactor: use whitespace regex as a constant
lilnasy 81e41db
refactor : no branching, collect slice start and end
lilnasy 64ce2c8
refactor : no branching
lilnasy e6ad3d7
refactor : remove early return
lilnasy 80a023a
Disable built-in rules in test
overlookmotel e6d915a
Use `range` for nodes
overlookmotel 93bc07c
Avoid array destructuring
overlookmotel 1822385
Move `commentsExistBetween` up to with other comments methods
overlookmotel 4068bb8
Remove temp var in `commentsExistBetween`
overlookmotel b68a78c
Avoid property lookups on each turn of loop
overlookmotel cc0c864
Re-order code
overlookmotel 1aadc6d
fix: Init `ast` in `commentsExistBetween`
overlookmotel fbdea78
rename `indexStart` to `sliceStart` with comment
lilnasy 316d1cc
Don't use `definePlugin` in test
overlookmotel 16bf4c9
Test output comments before/inside/after for all var and function decls
overlookmotel add442a
Add comment inside var decl in test fixture
overlookmotel d31e55f
More tests for `commentsExistBetween`
overlookmotel a2fbe8d
Update values of var decls in test fixture
overlookmotel b765da5
Test where comments before and after is empty array
overlookmotel 3ba9484
Rename test fixture file
overlookmotel 5a1b62b
Add test fixture containing no comments
overlookmotel bb26f99
Test behavior of `commentsExistBetween` when out of order
overlookmotel 67750ee
Test statement with no comments after
overlookmotel 3409724
Rename var
overlookmotel 0ab0d2c
Remove temp vars
overlookmotel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "jsPlugins": ["./plugin.ts"], | ||
| "categories": { "correctness": "off" }, | ||
| "rules": { | ||
| "test-comments/test-comments": "error" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| const topLevelVariable1 = 1; | ||
| // Line comment 1 | ||
| const topLevelVariable2 = 2; /* Block comment 1 */ | ||
|
|
||
| /** | ||
| * JSDoc comment | ||
| */ | ||
| export function topLevelFunction() { | ||
| // Line comment 2 | ||
| /* Block comment 2 */ | ||
| let functionScopedVariable = topLevelVariable; | ||
| /** | ||
| * JSDoc comment 2 | ||
| */ | ||
| function nestedFunction() { | ||
| // Line comment 3 | ||
| return functionScopedVariable; | ||
| } | ||
| return nestedFunction(); // Line comment 4 | ||
| } | ||
|
|
||
| /* Block comment 3 */ | ||
| const topLevelVariable3 = /* Block comment 4 */ 3; | ||
|
|
||
| const topLevelVariable4 = 4; | ||
| const topLevelVariable5 = 5; | ||
|
|
||
| // Line comment 5 | ||
| // Line comment 6 | ||
|
|
||
| const topLevelVariable6 = 6; | ||
| const topLevelVariable7 = 7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| const topLevelVariable1 = 1; | ||
| const topLevelVariable2 = 2; | ||
|
|
||
| export function topLevelFunction() { | ||
| let functionScopedVariable = topLevelVariable; | ||
| function nestedFunction() { | ||
| return functionScopedVariable; | ||
| } | ||
| return nestedFunction(); | ||
| } | ||
|
|
||
| const topLevelVariable3 = 3; | ||
| const topLevelVariable4 = 4; | ||
| const topLevelVariable5 = 5; | ||
| const topLevelVariable6 = 6; | ||
| const topLevelVariable7 = 7; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.