From 7d6e05219311b5e8086082a9245ee628a8363a44 Mon Sep 17 00:00:00 2001 From: Kevin Partington Date: Tue, 3 Apr 2018 09:24:59 -0500 Subject: [PATCH] Upgrade: esquery@^1.0.1 (fixes #8733) (#10170) * Upgrade: esquery@^1.0.1 (fixes #8733) * Chore: Add extra tests * Chore: Fix lint errors * Chore: Removing accidental copy/paste test --- package.json | 2 +- tests/lib/rules/no-restricted-syntax.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2a693e2bd86..03e281c7a03 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "eslint-scope": "^3.7.1", "eslint-visitor-keys": "^1.0.0", "espree": "^4.0.0-alpha.0", - "esquery": "^1.0.0", + "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^2.0.0", "functional-red-black-tree": "^1.0.1", diff --git a/tests/lib/rules/no-restricted-syntax.js b/tests/lib/rules/no-restricted-syntax.js index 96c5c4bf556..5cc1f916195 100644 --- a/tests/lib/rules/no-restricted-syntax.js +++ b/tests/lib/rules/no-restricted-syntax.js @@ -36,7 +36,10 @@ ruleTester.run("no-restricted-syntax", rule, { { code: "({ foo: 1, bar: 2 })", options: [{ selector: "FunctionDeclaration[params.length>2]", message: "custom error message." }] - } + }, + + // https://github.com/eslint/eslint/issues/8733 + { code: "console.log(/a/);", options: ["Literal[regex.flags=/./]"] } ], invalid: [ @@ -118,6 +121,13 @@ ruleTester.run("no-restricted-syntax", rule, { code: "function foo(bar, baz, qux) {}", options: [{ selector: "FunctionDeclaration[params.length>2]", message: "custom message with {{selector}}" }], errors: [{ message: "custom message with {{selector}}", type: "FunctionDeclaration" }] + }, + + // https://github.com/eslint/eslint/issues/8733 + { + code: "console.log(/a/i);", + options: ["Literal[regex.flags=/./]"], + errors: [{ message: "Using 'Literal[regex.flags=/./]' is not allowed.", type: "Literal" }] } ] });