-
-
Notifications
You must be signed in to change notification settings - Fork 856
test(linter): add diagnostic format test snapshots #8696
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
Boshen
merged 1 commit into
main
from
01-24-test_linter_add_diagnostic_format_test_snapshots
Jan 25, 2025
Merged
Changes from all commits
Commits
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
6 changes: 6 additions & 0 deletions
6
apps/oxlint/fixtures/output_formatter_diagnostic/.oxlintrc.json
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,6 @@ | ||
| { | ||
| "rules": { | ||
| "no-debugger": "error", | ||
| "no-unused-vars": "warn" | ||
| } | ||
| } |
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,5 @@ | ||
| function foo(a, b) { | ||
| return a; | ||
| } | ||
|
|
||
| debugger; |
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
7 changes: 7 additions & 0 deletions
7
apps/oxlint/src/snapshots/--format=checkstyle test.js@oxlint.snap
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 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| --format=checkstyle test.js | ||
| ---------- | ||
| <?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"><file name="test.js"><error line="5" column="1" severity="error" message="`debugger` statement is not allowed" source="" /><error line="1" column="10" severity="warning" message="Function 'foo' is declared but never used." source="" /><error line="1" column="17" severity="warning" message="Parameter 'b' is declared but never used. Unused parameters should start with a '_'." source="" /></file></checkstyle> |
35 changes: 35 additions & 0 deletions
35
apps/oxlint/src/snapshots/--format=default test.js@oxlint.snap
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,35 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| --format=default test.js | ||
| ---------- | ||
|
|
||
| x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed | ||
| ,-[test.js:5:1] | ||
| 4 | | ||
| 5 | debugger; | ||
| : ^^^^^^^^^ | ||
| `---- | ||
| help: Delete this code. | ||
|
|
||
| ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html\eslint(no-unused-vars)]8;;\: Function 'foo' is declared but never used. | ||
| ,-[test.js:1:10] | ||
| 1 | function foo(a, b) { | ||
| : ^|^ | ||
| : `-- 'foo' is declared here | ||
| 2 | return a; | ||
| `---- | ||
| help: Consider removing this declaration. | ||
|
|
||
| ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html\eslint(no-unused-vars)]8;;\: Parameter 'b' is declared but never used. Unused parameters should start with a '_'. | ||
| ,-[test.js:1:17] | ||
| 1 | function foo(a, b) { | ||
| : | | ||
| : `-- 'b' is declared here | ||
| 2 | return a; | ||
| `---- | ||
| help: Consider removing this parameter. | ||
|
|
||
| Found 2 warnings and 1 error. | ||
| Finished in <variable> on 1 file with 97 rules using <variable>. |
9 changes: 9 additions & 0 deletions
9
apps/oxlint/src/snapshots/--format=github test.js@oxlint.snap
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,9 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| --format=github test.js | ||
| ---------- | ||
| ::error file=test.js,line=5,endLine=5,col=1,endColumn=10,title=oxlint::`debugger` statement is not allowed | ||
| ::warning file=test.js,line=1,endLine=1,col=10,endColumn=13,title=oxlint::Function 'foo' is declared but never used. | ||
| ::warning file=test.js,line=1,endLine=1,col=17,endColumn=18,title=oxlint::Parameter 'b' is declared but never used. Unused parameters should start with a '_'. |
11 changes: 11 additions & 0 deletions
11
apps/oxlint/src/snapshots/--format=json test.js@oxlint.snap
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,11 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| --format=json test.js | ||
| ---------- | ||
| [ | ||
| {"message": "`debugger` statement is not allowed","code": "eslint(no-debugger)","severity": "error","causes": [],"url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html","help": "Delete this code.","filename": "test.js","labels": [{"span": {"offset": 38,"length": 9}}],"related": []}, | ||
| {"message": "Function 'foo' is declared but never used.","code": "eslint(no-unused-vars)","severity": "warning","causes": [],"url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html","help": "Consider removing this declaration.","filename": "test.js","labels": [{"label": "'foo' is declared here","span": {"offset": 9,"length": 3}}],"related": []}, | ||
| {"message": "Parameter 'b' is declared but never used. Unused parameters should start with a '_'.","code": "eslint(no-unused-vars)","severity": "warning","causes": [],"url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html","help": "Consider removing this parameter.","filename": "test.js","labels": [{"label": "'b' is declared here","span": {"offset": 16,"length": 1}}],"related": []} | ||
| ] |
13 changes: 13 additions & 0 deletions
13
apps/oxlint/src/snapshots/--format=stylish test.js@oxlint.snap
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,13 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| --format=stylish test.js | ||
| ---------- | ||
|
|
||
| [4mtest.js[0m | ||
| [2m9:3 [0m [33mwarning[0m Function 'foo' is declared but never used. [2meslint(no-unused-vars)[0m | ||
| [2m16:1[0m [33mwarning[0m Parameter 'b' is declared but never used. Unused parameters should start with a '_'. [2meslint(no-unused-vars)[0m | ||
| [2m38:9[0m [31merror[0m `debugger` statement is not allowed [2meslint(no-debugger)[0m | ||
|
|
||
| [31m✖ 3 problems (1 error, 2 warnings)[0m |
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
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.