diff --git a/package.json b/package.json index 4ad7ce397bf3..355e5e462939 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "doctrine": "^1.2.1", "es6-map": "^0.1.3", "escope": "^3.6.0", - "espree": "3.1.3", + "espree": "3.1.4", "estraverse": "^4.2.0", "esutils": "^2.0.2", "file-entry-cache": "^1.1.1", diff --git a/tests/lib/util/comment-event-generator.js b/tests/lib/util/comment-event-generator.js index 4c400197f87e..b959dbe247f9 100644 --- a/tests/lib/util/comment-event-generator.js +++ b/tests/lib/util/comment-event-generator.js @@ -52,10 +52,10 @@ describe("NodeEventGenerator", function() { ["Identifier:exit", ast.body[0].declarations[0].id], ["Literal", ast.body[0].declarations[0].init], ["Literal:exit", ast.body[0].declarations[0].init], - ["LineComment:exit", ast.comments[0]], // foo ["VariableDeclarator:exit", ast.body[0].declarations[0]], ["LineComment:exit", ast.comments[2]], // bar ["VariableDeclaration:exit", ast.body[0]], + ["LineComment:exit", ast.comments[0]], // foo ["Program:exit", ast] ]; diff --git a/tests/lib/util/source-code.js b/tests/lib/util/source-code.js index 645087cd17f1..56552b5fe43e 100644 --- a/tests/lib/util/source-code.js +++ b/tests/lib/util/source-code.js @@ -928,6 +928,22 @@ describe("SourceCode", function() { eslint.verify(code, config, "", true); }); + it("should not attach duplicate leading comments from previous node", function() { + var code = [ + "//foo", + "var zzz /*aaa*/ = 777;", + "//bar" + ].join("\n"); + + eslint.reset(); + eslint.on("Program", assertCommentCount(0, 0)); + eslint.on("VariableDeclaration", assertCommentCount(1, 1)); + eslint.on("VariableDeclarator", assertCommentCount(0, 0)); + eslint.on("Identifier", assertCommentCount(0, 1)); + eslint.on("Literal", assertCommentCount(1, 0)); + + eslint.verify(code, config, "", true); + }); }); describe("getLines()", function() {