-
-
Notifications
You must be signed in to change notification settings - Fork 922
fix(linter): Fix syntax error reporting in some output formatters. #19590
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
+276
−117
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
8 changes: 8 additions & 0 deletions
8
apps/oxlint/fixtures/output_formatter_diagnostic/parser-error.js
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,8 @@ | ||
| export default class Test { | ||
| commands = []; | ||
| client: Example | ||
|
|
||
| constructor() { | ||
| this.client = {}; | ||
| } | ||
| } |
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
11 changes: 11 additions & 0 deletions
11
...ots/fixtures__output_formatter_diagnostic_--format=checkstyle parser-error.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 | ||
| --- | ||
| ########## | ||
| arguments: --format=checkstyle parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
| <?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"><file name="parser-error.js"><error line="3" column="9" severity="error" message="Expected `;` but found `:`" source="" /></file></checkstyle> | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
22 changes: 22 additions & 0 deletions
22
...pshots/fixtures__output_formatter_diagnostic_--format=default parser-error.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,22 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| arguments: --format=default parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
|
|
||
| x Expected `;` but found `:` | ||
| ,-[parser-error.js:3:9] | ||
| 2 | commands = []; | ||
| 3 | client: Example | ||
| : | | ||
| : `-- `;` expected | ||
| 4 | | ||
| `---- | ||
|
|
||
| Found 0 warnings and 1 error. | ||
| Finished in <variable>ms on 1 file with 2 rules using 1 threads. | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
11 changes: 11 additions & 0 deletions
11
...apshots/fixtures__output_formatter_diagnostic_--format=github parser-error.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 | ||
| --- | ||
| ########## | ||
| arguments: --format=github parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
| ::error file=parser-error.js,line=3,endLine=3,col=9,endColumn=10,title=oxlint::Expected `;` but found `:` | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
24 changes: 24 additions & 0 deletions
24
...apshots/fixtures__output_formatter_diagnostic_--format=gitlab parser-error.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,24 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| arguments: --format=gitlab parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
| [ | ||
| { | ||
| "description": "Expected `;` but found `:`", | ||
| "check_name": "", | ||
| "fingerprint": "5f141d44128bf58e", | ||
| "severity": "critical", | ||
| "location": { | ||
| "path": "apps/oxlint/parser-error.js", | ||
| "lines": { | ||
| "begin": 3, | ||
| "end": 3 | ||
| } | ||
| } | ||
| } | ||
| ]---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
16 changes: 16 additions & 0 deletions
16
...snapshots/fixtures__output_formatter_diagnostic_--format=json parser-error.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,16 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| arguments: --format=json parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
| { "diagnostics": [{"message": "Expected `;` but found `:`","severity": "error","causes": [],"filename": "parser-error.js","labels": [{"label": "`;` expected","span": {"offset": 53,"length": 1,"line": 3,"column": 9}}],"related": []}], | ||
| "number_of_files": 1, | ||
| "number_of_rules": 2, | ||
| "threads_count": 1, | ||
| "start_time": <variable> | ||
| } | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
18 changes: 18 additions & 0 deletions
18
...napshots/fixtures__output_formatter_diagnostic_--format=junit parser-error.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,18 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| arguments: --format=junit parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <testsuites name="Oxlint" tests="1" failures="0" errors="1"> | ||
| <testsuite name="parser-error.js" tests="1" disabled="0" errors="1" failures="0"> | ||
| <testcase name=""> | ||
| <error message="Expected `;` but found `:`">line 3, column 9, Expected `;` but found `:`</error> | ||
| </testcase> | ||
| </testsuite> | ||
| </testsuites> | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
15 changes: 15 additions & 0 deletions
15
...pshots/fixtures__output_formatter_diagnostic_--format=stylish parser-error.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,15 @@ | ||
| --- | ||
| source: apps/oxlint/src/tester.rs | ||
| --- | ||
| ########## | ||
| arguments: --format=stylish parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
|
|
||
| [4mparser-error.js[0m | ||
| [2m3:9[0m [31merror[0m Expected `;` but found `:` [2m[0m | ||
|
|
||
| [31m✖ 1 problem (1 error, 0 warnings)[0m | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
13 changes: 13 additions & 0 deletions
13
...snapshots/fixtures__output_formatter_diagnostic_--format=unix parser-error.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 | ||
| --- | ||
| ########## | ||
| arguments: --format=unix parser-error.js | ||
| working directory: fixtures/output_formatter_diagnostic | ||
| ---------- | ||
| parser-error.js:3:9: Expected `;` but found `:` [Error] | ||
|
|
||
| 1 problem | ||
| ---------- | ||
| CLI result: LintFoundErrors | ||
| ---------- |
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.
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.