-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(linter): add diagnostic format test snapshots
- Loading branch information
Showing
12 changed files
with
167 additions
and
15 deletions.
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 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 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 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 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 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 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 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 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 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 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 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