From c9898c393448e5f7e80654f846d723e69e35f495 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 11 Jun 2016 21:48:36 +0900 Subject: [PATCH] Fix: add test for a syntax error (fixes #6013) This syntax error came to be raised since Acorn 3.2.0. This syntax error prevents a false positive of `no-undef` rule. --- tests/lib/eslint.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/lib/eslint.js b/tests/lib/eslint.js index 3b583eb3f2a..813a4bba4dd 100644 --- a/tests/lib/eslint.js +++ b/tests/lib/eslint.js @@ -3685,6 +3685,13 @@ describe("eslint", function() { eslint.verify("var { a='a' } = {};", { parserOptions: { ecmaVersion: 6 }}); }); + it("should report syntax error when a keyword exists in object property shorthand", function() { + var messages = eslint.verify("let a = {this}", { parserOptions: { ecmaVersion: 6 }}); + + assert.equal(messages.length, 1); + assert.equal(messages[0].fatal, true); + }); + it("should not rewrite env setting in core (https://github.com/eslint/eslint/issues/4814)", function() { // This test focuses on the instance of https://github.com/eslint/eslint/blob/v2.0.0-alpha-2/conf/environments.js#L26-L28