Skip to content

Commit

Permalink
[[FIX]] Avoid false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike committed Nov 23, 2016
1 parent 6907cd4 commit 44d9e0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ var JSHINT = (function() {
state.tokens.next.id !== "(end)";
var blockEnd = checkPunctuator(state.tokens.next, "}");

if (sameLine && !blockEnd && !(stmt.value === "do" && state.inES6(true))) {
if (sameLine && !blockEnd && !(stmt.id === "do" && state.inES6(true))) {
errorAt("E058", state.tokens.curr.line, state.tokens.curr.character);
} else if (!state.option.asi) {
// If this is the last statement in a block that ends on
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,10 @@ exports["missing semicolons not influenced by asi"] = function (test) {
TestRun(test, "do-while as es6 with asi")
.test(code, { esversion: 6, asi: true });

TestRun(test, "do-while false positive")
.addError(1, "Missing semicolon.", { code: "E058" })
.test("'do' var x;", { esversion: 6, expr: true });

test.done();
};

Expand Down

0 comments on commit 44d9e0b

Please sign in to comment.