mirror of
https://github.com/hanzoai/eslint.git
synced 2026-10-30 19:38:10 +00:00
2.2 KiB
2.2 KiB
title
| title |
|---|
| no-restricted-syntax |
This file contains rule example code with syntax errors and other problems.
::: incorrect { "sourceType": "script" }
export default "foo";
:::
:::correct
const foo = "bar";
const foo = "baz";
:::
:::correct
/* eslint no-undef: error */
:::
:::correct
/* eslint no-restricted-syntax: "error" */
/* eslint doesn't allow this comment */
:::
:::correct
/* eslint no-restricted-syntax: "error" */
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct { "ecmaVersion": "latest" }
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct { "ecmaVersion": 6 }
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
/* eslint-env es6 */
/*eslint-env node */
/*eslint-env*/
:::
:::correct { "foo": 6 }
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
const [foo] = bar;
:::
:::incorrect
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
const foo = [bar];
:::
:::incorrect
/* eslint no-restricted-syntax: ["errorr", "ArrayPattern"] */
const foo = [bar];
:::
:::correct { "sourceType": "module" }
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct { "parserOptions": { "ecmaFeatures": { "jsx": false } } }
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct { "parserOptions": { "ecmaFeatures": { "jsx": false } } }
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::
:::correct { "parserOptions": { "ecmaFeatures": { "jsx": true } } }
/* eslint no-restricted-syntax: ["error", "ArrayPattern"] */
:::