Skip to content

Commit 3048f37

Browse files
committed
Ensure generic Espree error results in warning logged to console
1 parent 534b297 commit 3048f37

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/js/_enqueues/vendor/codemirror/fakejshint.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,16 @@ window.JSHINT = ( () => {
9494
}
9595

9696
/**
97-
* Converts a SyntaxError to a JSHINT error.
97+
* Converts an Espree error to a JSHINT error.
9898
*
99-
* @param {SyntaxError} error - SyntaxError to convert.
99+
* @param {Error|SyntaxError} error - Error to convert.
100100
* @return {JSHintError} JSHint error.
101101
*/
102102
function convertError( error ) {
103+
// Note: A lineNumber of 0 causes CodeMirror to log out a warning in the console. This is as desired for a generic Espree error.
103104
return {
104-
line: error.lineNumber,
105-
character: error.column,
105+
line: error.lineNumber || 0,
106+
character: error.column || 0,
106107
reason: error.message,
107108
code: 'E',
108109
};

0 commit comments

Comments
 (0)