Repository: eslint/eslint (js)

Issue:
no-case-declarations returns duplicate results
**Tell us about your environment**

* **ESLint Version:** v4.18.2
* **Node Version:** v9.7.1
* **npm Version:** 5.7.1

**What parser (default, Babel-ESLint, etc.) are you using?**

`default`

**Please show your full configuration:**

Configuration:
```json
{
  "parserOptions": {
    "sourceType": "module"
  },
  "rules": {
    "no-case-declarations": "error"
  }
}
```

**What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.**

<!-- Paste the source code below: -->
```js
export default function myFunction() {
  switch (true) {
    case true:
      const x = 1
      const y = 2
      return { x, y }
    default:
      return null
  }
}
```

<!-- Paste the command you used to run ESLint: -->
```bash
npx eslint .\foo.js
```

You can download the exact files from [this Gist](https://gist.github.com/Arcanemagus/8e7877a6d085f0e9cf9fb286ffc2435d).

**What did you expect to happen?**

A single error message is returned.

**What actually happened? Please include the actual, raw output from ESLint.**
CLI output
```
C:\temp\github\linter-ui-default_GH465\node_modules\eslint\bin\eslint.js

C:\temp\github\linter-ui-default_GH465\foo.js
  3:5  error  Unexpected lexical declaration in case block  no-case-declarations
  3:5  error  Unexpected lexical declaration in case block  no-case-declarations

✖ 2 problems (2 errors, 0 warnings)
```

Note that this isn't just a bug in the default CLI output, as the raw `report` from the `CLIEngine` shows the entire result object is identical:
```
> JSON.stringify(report.results.messages[0]) === JSON.stringify(report.results.messages[1])
true
```

Originally reported as https://github.com/steelbrain/linter-ui-default/issues/465, apologies if this has already been reported as I didn't find it in a search.

Pull request description:
Fix: report no-case-declarations from declarations (fixes #10048)
<!--
    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
-->

**What is the purpose of this pull request? (put an "X" next to item)**

[ ] Documentation update
[X] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))
[ ] New rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-proposal.md))
[ ] Changes an existing rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-change-proposal.md))
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

<!--
    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)
-->

<!--
    Please ensure your pull request is ready:

    - Read the pull request guide (https://eslint.org/docs/developer-guide/contributing/pull-requests)
    - Include tests for this change
    - Update documentation for this change (if appropriate)
-->

<!--
    The following is required for all pull requests:
-->

**What changes did you make? (Give an overview)**
`no-case-declarations` is now on the variable declaration statement instead of the SwitchCase.

**Is there anything you'd like reviewers to focus on?**




Patch:
diff --git a/README.md b/README.md
index 3c0299809..ccf0cda62 100644
--- a/README.md
+++ b/README.md
@@ -98,49 +98,6 @@ The names `"semi"` and `"quotes"` are the names of [rules](https://eslint.org/do
 
 The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](https://eslint.org/docs/user-guide/configuring)).
 
-## Sponsors
-
-* Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com)
-
-## Team
-
-These folks keep the project moving and are resources for help.
-
-### Technical Steering Committee (TSC)
-
-* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas))
-* Ilya Volodin ([@ilyavolodin](https://github.com/ilyavolodin))
-* Brandon Mills ([@btmills](https://github.com/btmills))
-* Gyandeep Singh ([@gyandeeps](https://github.com/gyandeeps))
-* Toru Nagashima ([@mysticatea](https://github.com/mysticatea))
-* Alberto Rodríguez ([@alberto](https://github.com/alberto))
-* Kai Cataldo ([@kaicataldo](https://github.com/kaicataldo))
-* Teddy Katz ([@not-an-aardvark](https://github.com/not-an-aardvark))
-* Kevin Partington ([@platinumazure](https://github.com/platinumazure))
-
-### Development Team
-
-* Mathias Schreck ([@lo1tuma](https://github.com/lo1tuma))
-* Jamund Ferguson ([@xjamundx](https://github.com/xjamundx))
-* Ian VanSchooten ([@ianvs](https://github.com/ianvs))
-* Burak Yiğit Kaya ([@byk](https://github.com/byk))
-* Michael Ficarra ([@michaelficarra](https://github.com/michaelficarra))
-* Mark Pedrotti ([@pedrottimark](https://github.com/pedrottimark))
-* Oleg Gaidarenko ([@markelog](https://github.com/markelog))
-* Mike Sherov ([@mikesherov](https://github.com/mikesherov))
-* Henry Zhu ([@hzoo](https://github.com/hzoo))
-* Marat Dulin ([@mdevils](https://github.com/mdevils))
-* Alexej Yaroshevich ([@zxqfox](https://github.com/zxqfox))
-* Vitor Balocco ([@vitorbal](https://github.com/vitorbal))
-* James Henry ([@JamesHenry](https://github.com/JamesHenry))
-* Reyad Attiyat ([@soda0289](https://github.com/soda0289))
-* 薛定谔的猫 ([@Aladdin-ADD](https://github.com/Aladdin-ADD))
-* Victor Hom ([@VictorHom](https://github.com/VictorHom))
-
-## Releases
-
-We have scheduled releases every two weeks on Friday or Saturday.
-
 ## Code of Conduct
 
 ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
@@ -154,36 +111,6 @@ Before filing an issue, please be sure to read the guidelines for what you're re
 * [Proposing a Rule Change](https://eslint.org/docs/developer-guide/contributing/rule-changes)
 * [Request a Change](https://eslint.org/docs/developer-guide/contributing/changes)
 
-## Semantic Versioning Policy
-
-ESLint follows [semantic versioning](https://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint:
-
-* Patch release (intended to not break your lint build)
-    * A bug fix in a rule that results in ESLint reporting fewer errors.
-    * A bug fix to the CLI or core (including formatters).
-    * Improvements to documentation.
-    * Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
-    * Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
-* Minor release (might break your lint build)
-    * A bug fix in a rule that results in ESLint reporting more errors.
-    * A new rule is created.
-    * A new option to an existing rule that does not result in ESLint reporting more errors by default.
-    * An existing rule is deprecated.
-    * A new CLI capability is created.
-    * New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
-    * A new formatter is created.
-* Major release (likely to break your lint build)
-    * `eslint:recommended` is updated.
-    * A new option to an existing rule that results in ESLint reporting more errors by default.
-    * An existing formatter is removed.
-    * Part of the public API is removed or changed in an incompatible way.
-
-According to our policy, any minor update may report more errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds.
-
-## License
-
-[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_large)
-
 ## Frequently Asked Questions
 
 ### I heard ESLint is going to replace JSCS?
@@ -231,6 +158,79 @@ Once a language feature has been adopted into the ECMAScript standard (stage 4 a
 
 Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://gitter.im/eslint/eslint).
 
+## Releases
+
+We have scheduled releases every two weeks on Friday or Saturday.
+
+## Semantic Versioning Policy
+
+ESLint follows [semantic versioning](https://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint:
+
+* Patch release (intended to not break your lint build)
+    * A bug fix in a rule that results in ESLint reporting fewer errors.
+    * A bug fix to the CLI or core (including formatters).
+    * Improvements to documentation.
+    * Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
+    * Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
+* Minor release (might break your lint build)
+    * A bug fix in a rule that results in ESLint reporting more errors.
+    * A new rule is created.
+    * A new option to an existing rule that does not result in ESLint reporting more errors by default.
+    * An existing rule is deprecated.
+    * A new CLI capability is created.
+    * New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
+    * A new formatter is created.
+* Major release (likely to break your lint build)
+    * `eslint:recommended` is updated.
+    * A new option to an existing rule that results in ESLint reporting more errors by default.
+    * An existing formatter is removed.
+    * Part of the public API is removed or changed in an incompatible way.
+
+According to our policy, any minor update may report more errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds.
+
+## License
+
+[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_large)
+
+## Team
+
+These folks keep the project moving and are resources for help.
+
+### Technical Steering Committee (TSC)
+
+* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas))
+* Ilya Volodin ([@ilyavolodin](https://github.com/ilyavolodin))
+* Brandon Mills ([@btmills](https://github.com/btmills))
+* Gyandeep Singh ([@gyandeeps](https://github.com/gyandeeps))
+* Toru Nagashima ([@mysticatea](https://github.com/mysticatea))
+* Alberto Rodríguez ([@alberto](https://github.com/alberto))
+* Kai Cataldo ([@kaicataldo](https://github.com/kaicataldo))
+* Teddy Katz ([@not-an-aardvark](https://github.com/not-an-aardvark))
+* Kevin Partington ([@platinumazure](https://github.com/platinumazure))
+
+### Development Team
+
+* Mathias Schreck ([@lo1tuma](https://github.com/lo1tuma))
+* Jamund Ferguson ([@xjamundx](https://github.com/xjamundx))
+* Ian VanSchooten ([@ianvs](https://github.com/ianvs))
+* Burak Yiğit Kaya ([@byk](https://github.com/byk))
+* Michael Ficarra ([@michaelficarra](https://github.com/michaelficarra))
+* Mark Pedrotti ([@pedrottimark](https://github.com/pedrottimark))
+* Oleg Gaidarenko ([@markelog](https://github.com/markelog))
+* Mike Sherov ([@mikesherov](https://github.com/mikesherov))
+* Henry Zhu ([@hzoo](https://github.com/hzoo))
+* Marat Dulin ([@mdevils](https://github.com/mdevils))
+* Alexej Yaroshevich ([@zxqfox](https://github.com/zxqfox))
+* Vitor Balocco ([@vitorbal](https://github.com/vitorbal))
+* James Henry ([@JamesHenry](https://github.com/JamesHenry))
+* Reyad Attiyat ([@soda0289](https://github.com/soda0289))
+* 薛定谔的猫 ([@Aladdin-ADD](https://github.com/Aladdin-ADD))
+* Victor Hom ([@VictorHom](https://github.com/VictorHom))
+
+## Sponsors
+
+* Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com)
+
 
 [npm-image]: https://img.shields.io/npm/v/eslint.svg?style=flat-square
 [npm-url]: https://www.npmjs.com/package/eslint
diff --git a/docs/developer-guide/working-with-rules.md b/docs/developer-guide/working-with-rules.md
index bf51f6c22..dedfccc86 100644
--- a/docs/developer-guide/working-with-rules.md
+++ b/docs/developer-guide/working-with-rules.md
@@ -371,17 +371,17 @@ Once you have an instance of `SourceCode`, you can use the methods on it to work
 * `commentsExistBetween(nodeOrToken1, nodeOrToken2)` - returns `true` if comments exist between two nodes.
 
 > `skipOptions` is an object which has 3 properties; `skip`, `includeComments`, and `filter`. Default is `{skip: 0, includeComments: false, filter: null}`.
-> - `skip` is a positive integer, the number of skipping tokens. If `filter` option is given at the same time, it doesn't count filtered tokens as skipped.
-> - `includeComments` is a boolean value, the flag to include comment tokens into the result.
-> - `filter` is a function which gets a token as the first argument, if the function returns `false` then the result excludes the token.
+> * `skip` is a positive integer, the number of skipping tokens. If `filter` option is given at the same time, it doesn't count filtered tokens as skipped.
+> * `includeComments` is a boolean value, the flag to include comment tokens into the result.
+> * `filter` is a function which gets a token as the first argument, if the function returns `false` then the result excludes the token.
 >
 > `countOptions` is an object which has 3 properties; `count`, `includeComments`, and `filter`. Default is `{count: 0, includeComments: false, filter: null}`.
-> - `count` is a positive integer, the maximum number of returning tokens.
-> - `includeComments` is a boolean value, the flag to include comment tokens into the result.
-> - `filter` is a function which gets a token as the first argument, if the function returns `false` then the result excludes the token.
+> * `count` is a positive integer, the maximum number of returning tokens.
+> * `includeComments` is a boolean value, the flag to include comment tokens into the result.
+> * `filter` is a function which gets a token as the first argument, if the function returns `false` then the result excludes the token.
 >
 > `rangeOptions` is an object which has 1 property: `includeComments`.
-> - `includeComments` is a boolean value, the flag to include comment tokens into the result.
+> * `includeComments` is a boolean value, the flag to include comment tokens into the result.
 
 There are also some properties you can access:
 
diff --git a/docs/rules/object-curly-spacing.md b/docs/rules/object-curly-spacing.md
index 9723bb668..8f88fc260 100644
--- a/docs/rules/object-curly-spacing.md
+++ b/docs/rules/object-curly-spacing.md
@@ -126,7 +126,6 @@ var obj = { "foo": [ 1, 2 ]};
 var obj = { "foo": [ "baz", "bar" ]};
 ```
 
-
 #### objectsInObjects
 
 Examples of additional **correct** code for this rule with the `"never", { "objectsInObjects": true }` options:
@@ -151,5 +150,7 @@ You can turn this rule off if you are not concerned with the consistency of spac
 
 ## Related Rules
 
+* [array-bracket-spacing](array-bracket-spacing.md)
 * [comma-spacing](comma-spacing.md)
+* [computed-property-spacing](computed-property-spacing.md)
 * [space-in-parens](space-in-parens.md)
diff --git a/lib/cli.js b/lib/cli.js
index faf5dbb35..1bd3c52eb 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -132,6 +132,9 @@ const cli = {
      * @returns {int} The exit code for the operation.
      */
     execute(args, text) {
+        if (Array.isArray(args)) {
+            debug("CLI args: %o", args.slice(2));
+        }
 
         let currentOptions;
 
diff --git a/lib/rules/no-case-declarations.js b/lib/rules/no-case-declarations.js
index 862be4c57..c05795200 100644
--- a/lib/rules/no-case-declarations.js
+++ b/lib/rules/no-case-declarations.js
@@ -50,7 +50,7 @@ module.exports = {
 
                     if (isLexicalDeclaration(statement)) {
                         context.report({
-                            node,
+                            node: statement,
                             messageId: "unexpected"
                         });
                     }
diff --git a/package.json b/package.json
index 6e7545b33..fd3b45874 100644
--- a/package.json
+++ b/package.json
@@ -35,81 +35,80 @@
   "bugs": "https://github.com/eslint/eslint/issues/",
   "dependencies": {
     "ajv": "^5.3.0",
-    "babel-code-frame": "^6.22.0",
+    "babel-code-frame": "^6.26.0",
     "chalk": "^2.1.0",
-    "concat-stream": "^1.6.0",
+    "concat-stream": "^1.6.2",
     "cross-spawn": "^5.1.0",
     "debug": "^3.1.0",
     "doctrine": "^2.1.0",
     "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",
     "glob": "^7.1.2",
-    "globals": "^11.0.1",
+    "globals": "^11.4.0",
     "ignore": "^3.3.3",
     "imurmurhash": "^0.1.4",
-    "inquirer": "^3.0.6",
-    "is-resolvable": "^1.0.0",
-    "js-yaml": "^3.9.1",
+    "inquirer": "^3.3.0",
+    "is-resolvable": "^1.1.0",
+    "js-yaml": "^3.11.0",
     "json-stable-stringify-without-jsonify": "^1.0.1",
     "levn": "^0.3.0",
-    "lodash": "^4.17.4",
-    "minimatch": "^3.0.2",
+    "lodash": "^4.17.5",
+    "minimatch": "^3.0.4",
     "mkdirp": "^0.5.1",
     "natural-compare": "^1.4.0",
     "optionator": "^0.8.2",
     "path-is-inside": "^1.0.2",
     "pluralize": "^7.0.0",
     "progress": "^2.0.0",
-    "regexpp": "^1.0.1",
+    "regexpp": "^1.1.0",
     "require-uncached": "^1.0.3",
-    "semver": "^5.3.0",
+    "semver": "^5.5.0",
     "strip-ansi": "^4.0.0",
-    "strip-json-comments": "~2.0.1",
+    "strip-json-comments": "^2.0.1",
     "table": "4.0.2",
-    "text-table": "~0.2.0"
+    "text-table": "^0.2.0"
   },
   "devDependencies": {
-    "babel-polyfill": "^6.23.0",
+    "babel-polyfill": "^6.26.0",
     "babel-preset-es2015": "^6.24.1",
     "babelify": "^7.3.0",
     "beefy": "^2.1.8",
-    "brfs": "1.4.3",
-    "browserify": "^14.4.0",
+    "brfs": "^1.5.0",
+    "browserify": "^16.1.1",
     "chai": "^4.0.1",
     "cheerio": "^0.22.0",
-    "coveralls": "^2.13.1",
-    "dateformat": "^2.0.0",
-    "ejs": "^2.5.6",
+    "coveralls": "^3.0.0",
+    "dateformat": "^3.0.3",
+    "ejs": "^2.5.8",
     "eslint-plugin-eslint-plugin": "^1.2.0",
-    "eslint-plugin-node": "^5.1.0",
+    "eslint-plugin-node": "^6.0.1",
     "eslint-plugin-rulesdir": "^0.1.0",
     "eslint-release": "^0.11.1",
-    "eslint-rule-composer": "^0.1.0",
-    "eslump": "1.6.0",
+    "eslint-rule-composer": "^0.1.1",
+    "eslump": "^1.6.1",
     "esprima": "^4.0.0",
-    "esprima-fb": "^15001.1001.0-dev-harmony-fb",
     "istanbul": "^0.4.5",
-    "jsdoc": "^3.4.3",
-    "karma": "^1.7.0",
-    "karma-babel-preprocessor": "^6.0.1",
+    "jsdoc": "^3.5.5",
+    "karma": "^2.0.0",
+    "karma-babel-preprocessor": "^7.0.0",
     "karma-mocha": "^1.3.0",
     "karma-mocha-reporter": "^2.2.3",
     "karma-phantomjs-launcher": "^1.0.4",
-    "leche": "^2.1.2",
+    "leche": "^2.2.3",
     "load-perf": "^0.2.0",
-    "markdownlint": "^0.6.1",
-    "mocha": "^3.4.2",
+    "markdownlint": "^0.8.1",
+    "mocha": "^5.0.5",
     "mock-fs": "^4.3.0",
     "npm-license": "^0.3.3",
-    "phantomjs-prebuilt": "^2.1.14",
-    "proxyquire": "^1.8.0",
-    "shelljs": "^0.7.7",
-    "sinon": "^3.2.1",
+    "phantomjs-prebuilt": "^2.1.16",
+    "proxyquire": "^2.0.1",
+    "shelljs": "^0.8.1",
+    "sinon": "^3.3.0",
     "temp": "^0.8.3",
     "through": "^2.3.8"
   },


Test patch:
diff --git a/tests/lib/linter.js b/tests/lib/linter.js
index a64a6a55e..e83e7934e 100644
--- a/tests/lib/linter.js
+++ b/tests/lib/linter.js
@@ -974,7 +974,7 @@ describe("Linter", () => {
         if (typeof window === "undefined") {
             it("should pass parser as parserPath to all rules when provided on config", () => {
 
-                const alternateParser = "esprima-fb";
+                const alternateParser = "esprima";
 
                 linter.defineRule("test-rule", sandbox.mock().withArgs(
                     sinon.match({ parserPath: alternateParser })
@@ -4209,18 +4209,18 @@ describe("Linter", () => {
 
             it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => {
                 const code = "var myDivElement = <div {...this.props} />;";
-                const messages = linter.verify(code, { parser: "esprima-fb" }, "filename");
+                const messages = linter.verify(code, { parser: "esprima", parserOptions: { jsx: true } }, "filename");
 
                 assert.strictEqual(messages.length, 0);
             });
 
             it("should return an error when the custom parser can't be found", () => {
                 const code = "var myDivElement = <div {...this.props} />;";
-                const messages = linter.verify(code, { parser: "esprima-fbxyz" }, "filename");
+                const messages = linter.verify(code, { parser: "esprima-xyz" }, "filename");
 
                 assert.strictEqual(messages.length, 1);
                 assert.strictEqual(messages[0].severity, 2);
-                assert.strictEqual(messages[0].message, "Cannot find module 'esprima-fbxyz'");
+                assert.strictEqual(messages[0].message, "Cannot find module 'esprima-xyz'");
             });
 
             it("should strip leading line: prefix from parser error", () => {
diff --git a/tests/lib/rules/no-case-declarations.js b/tests/lib/rules/no-case-declarations.js
index d72ad515d..676caba63 100644
--- a/tests/lib/rules/no-case-declarations.js
+++ b/tests/lib/rules/no-case-declarations.js
@@ -41,42 +41,42 @@ ruleTester.run("no-case-declarations", rule, {
         {
             code: "switch (a) { case 1: let x = 1; break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "VariableDeclaration" }]
         },
         {
             code: "switch (a) { default: let x = 2; break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "VariableDeclaration" }]
         },
         {
             code: "switch (a) { case 1: const x = 1; break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "VariableDeclaration" }]
         },
         {
             code: "switch (a) { default: const x = 2; break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "VariableDeclaration" }]
         },
         {
             code: "switch (a) { case 1: function f() {} break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "FunctionDeclaration" }]
         },
         {
             code: "switch (a) { default: function f() {} break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "FunctionDeclaration" }]
         },
         {
             code: "switch (a) { case 1: class C {} break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "ClassDeclaration" }]
         },
         {
             code: "switch (a) { default: class C {} break; }",
             parserOptions: { ecmaVersion: 6 },
-            errors: [{ messageId: "unexpected" }]
+            errors: [{ messageId: "unexpected", type: "ClassDeclaration" }]
         }
     ]
 });
diff --git a/tests/lib/rules/no-restricted-syntax.js b/tests/lib/rules/no-restricted-syntax.js
index 96c5c4bf5..5cc1f9161 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" }]
         }
     ]
 });