Skip to content

Commit

Permalink
[[FIX]] Report invalid syntax as error
Browse files Browse the repository at this point in the history
This condition was previously reported as a warning. It unambiguously
describes a syntax error, meaning that an error is more appropriate than
a warning. Reporting it as such impoves the interpretation of Test262
tests. Unit tests do not require modification because W116 and E021
share identical messages ("Expected '{a}' and instead saw '{b}'.").

This change triggers failures in four Test262 tests that were previously
interpreted as "valid." These tests concern the "object spread/rest"
proposal, but support for this proposal has not yet been implemented in
JSHint. Therefor, their previous "passing" status was circumstantial,
and the newly-identified error should be marked as "expected."
  • Loading branch information
jugglinmike committed Dec 23, 2018
1 parent 062bae1 commit 5ca8b1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ var JSHINT = (function() {
relatedToken.line, nextToken.value);
}
} else if (nextToken.type !== "(identifier)" || nextToken.value !== expected) {
error("W116", nextToken, expected, nextToken.value);
error("E021", nextToken, expected, nextToken.value);
}
}

Expand Down
Loading

0 comments on commit 5ca8b1a

Please sign in to comment.