Skip to content

Commit 742d054

Browse files
mdjermanovicnzakas
andauthored
docs: note that no-restricted-syntax can be used with any language (#19148)
* docs: note that `no-restricted-syntax` can be used with any language * Apply suggestions from code review Co-authored-by: Nicholas C. Zakas <[email protected]> --------- Co-authored-by: Nicholas C. Zakas <[email protected]>
1 parent 6f37b07 commit 742d054

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/src/rules/no-restricted-syntax.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ related_rules:
1111

1212
JavaScript has a lot of language features, and not everyone likes all of them. As a result, some projects choose to disallow the use of certain language features altogether. For instance, you might decide to disallow the use of `try-catch` or `class`, or you might decide to disallow the use of the `in` operator.
1313

14-
Rather than creating separate rules for every language feature you want to turn off, this rule allows you to configure the syntax elements you want to restrict use of. These elements are represented by their [ESTree](https://github.com/estree/estree) node types. For example, a function declaration is represented by `FunctionDeclaration` and the `with` statement is represented by `WithStatement`. You may find the full list of AST node names you can use [on GitHub](https://github.com/eslint/js/blob/main/packages/eslint-visitor-keys/lib/visitor-keys.js) and use [AST Explorer](https://astexplorer.net/) with the espree parser to see what type of nodes your code consists of.
14+
Rather than creating separate rules for every language feature you want to turn off, this rule allows you to configure the syntax elements you want to restrict use of. For the JavaScript language, these elements are represented by their [ESTree](https://github.com/estree/estree) node types. For example, a function declaration is represented by `FunctionDeclaration` and the `with` statement is represented by `WithStatement`. You may use [Code Explorer](https://explorer.eslint.org) to determine the nodes that represent your code.
1515

1616
You can also specify [AST selectors](../extend/selectors) to restrict, allowing much more precise control over syntax patterns.
1717

18+
Note: This rule can be used with any language you lint using ESLint. To see what type of nodes your code in another language consists of, you can use:
19+
20+
* [typescript-eslint Playground](https://typescript-eslint.io/play) if you're using ESLint with `typescript-eslint`.
21+
* [ESLint Code Explorer](https://explorer.eslint.org/) if you're using ESLint to lint JavaScript, JSON, or Markdown.
22+
1823
## Rule Details
1924

2025
This rule disallows specified (that is, user-defined) syntax.

0 commit comments

Comments
 (0)