-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: formatter printing path of files with todo (#9)
Fixed a bug where the formatter was printing the path of todo files when there were other errors in other files. The check if all messages are todos should be done for each result message array and not all results in total.
- Loading branch information
Showing
7 changed files
with
213 additions
and
21 deletions.
There are no files selected for viewing
153 changes: 153 additions & 0 deletions
153
__tests__/__fixtures__/eslint-with-errors-warnings-todos.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,153 @@ | ||
{ | ||
"results": [ | ||
{ | ||
"filePath": "{{path}}/app/errors-only.js", | ||
"messages": [ | ||
{ | ||
"ruleId": "no-prototype-builtins", | ||
"severity": 2, | ||
"message": "Do not access Object.prototype method 'hasOwnProperty' from target object.", | ||
"line": 25, | ||
"column": 21, | ||
"nodeType": "CallExpression", | ||
"messageId": "prototypeBuildIn", | ||
"endLine": 25, | ||
"endColumn": 35 | ||
}, | ||
{ | ||
"ruleId": "no-prototype-builtins", | ||
"severity": 2, | ||
"message": "Do not access Object.prototype method 'hasOwnProperty' from target object.", | ||
"line": 26, | ||
"column": 19, | ||
"nodeType": "CallExpression", | ||
"messageId": "prototypeBuildIn", | ||
"endLine": 26, | ||
"endColumn": 33 | ||
}, | ||
{ | ||
"ruleId": "no-prototype-builtins", | ||
"severity": 2, | ||
"message": "Do not access Object.prototype method 'hasOwnProperty' from target object.", | ||
"line": 32, | ||
"column": 34, | ||
"nodeType": "CallExpression", | ||
"messageId": "prototypeBuildIn", | ||
"endLine": 32, | ||
"endColumn": 48 | ||
} | ||
], | ||
"errorCount": 3, | ||
"warningCount": 0, | ||
"fixableErrorCount": 0, | ||
"fixableWarningCount": 0, | ||
"source": "" | ||
}, | ||
{ | ||
"filePath": "{{path}}/app/warnings-only.js", | ||
"messages": [ | ||
{ | ||
"ruleId": "no-alert", | ||
"severity": 1, | ||
"message": "Unexpected alert.", | ||
"line": 3, | ||
"column": 3, | ||
"nodeType": "CallExpression", | ||
"messageId": "unexpected", | ||
"endLine": 2, | ||
"endColumn": 14 | ||
} | ||
], | ||
"errorCount": 0, | ||
"warningCount": 1, | ||
"fixableErrorCount": 0, | ||
"fixableWarningCount": 0, | ||
"source": "" | ||
}, | ||
{ | ||
"filePath": "{{path}}/app/todos-only.js", | ||
"messages": [ | ||
{ | ||
"ruleId": "no-redeclare", | ||
"severity": -1, | ||
"message": "'window' is already defined as a built-in global variable.", | ||
"line": 1, | ||
"column": 11, | ||
"nodeType": "Block", | ||
"messageId": "redeclaredAsBuiltin", | ||
"endLine": 1, | ||
"endColumn": 17, | ||
"fix": { | ||
"range": [0, 1], | ||
"text": "" | ||
} | ||
}, | ||
{ | ||
"ruleId": "no-redeclare", | ||
"severity": -1, | ||
"message": "'XMLHttpRequest' is already defined as a built-in global variable.", | ||
"line": 1, | ||
"column": 19, | ||
"nodeType": "Block", | ||
"messageId": "redeclaredAsBuiltin", | ||
"endLine": 1, | ||
"endColumn": 33 | ||
} | ||
], | ||
"errorCount": 0, | ||
"warningCount": 0, | ||
"todoCount": 2, | ||
"fixableErrorCount": 0, | ||
"fixableWarningCount": 0, | ||
"source": "" | ||
}, | ||
{ | ||
"filePath": "{{path}}/app/errors-warnings-todo.js", | ||
"messages": [ | ||
{ | ||
"ruleId": "no-redeclare", | ||
"severity": 2, | ||
"message": "'window' is already defined as a built-in global variable.", | ||
"line": 1, | ||
"column": 11, | ||
"nodeType": "Block", | ||
"messageId": "redeclaredAsBuiltin", | ||
"endLine": 1, | ||
"endColumn": 17, | ||
"fix": { | ||
"range": [0, 1], | ||
"text": "" | ||
} | ||
}, | ||
{ | ||
"ruleId": "no-redeclare", | ||
"severity": -1, | ||
"message": "'XMLHttpRequest' is already defined as a built-in global variable.", | ||
"line": 2, | ||
"column": 19, | ||
"nodeType": "Block", | ||
"messageId": "redeclaredAsBuiltin", | ||
"endLine": 1, | ||
"endColumn": 33 | ||
}, | ||
{ | ||
"ruleId": "no-alert", | ||
"severity": 1, | ||
"message": "Unexpected alert.", | ||
"line": 3, | ||
"column": 3, | ||
"nodeType": "CallExpression", | ||
"messageId": "unexpected", | ||
"endLine": 2, | ||
"endColumn": 14 | ||
} | ||
], | ||
"errorCount": 1, | ||
"warningCount": 1, | ||
"todoCount": 1, | ||
"fixableErrorCount": 1, | ||
"fixableWarningCount": 0, | ||
"source": "" | ||
} | ||
] | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const TODO_SEVERITY = -1; | ||
export const ERROR_SEVERITY = 2; |
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