You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use custom parsers to convert JavaScript code into an abstract syntax tree for ESLint to evaluate. You might want to add a custom parser if your code isn't compatible with ESLint's default parser, Espree.
11
+
12
+
## Configure a Custom Parser
13
+
14
+
By default, ESLint uses [Espree](https://github.com/eslint/espree) as its parser. You can optionally specify that a different parser should be used in your configuration file if the parser meets the following requirements:
15
+
16
+
1. It must be a Node module loadable from the config file where the parser is used. Usually, this means you should install the parser package separately using npm.
17
+
1. It must conform to the [parser interface](../../extend/custom-parsers).
18
+
19
+
Note that even with these compatibilities, there are no guarantees that an external parser works correctly with ESLint. ESLint does not fix bugs related to incompatibilities with other parsers.
20
+
21
+
To indicate the npm module to use as your parser, specify it using the `parser` option in your `.eslintrc` file. For example, the following specifies to use Esprima instead of Espree:
*[@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) - A wrapper around the [Babel](https://babeljs.io) parser that makes it compatible with ESLint.
36
+
*[@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser) - A parser that converts TypeScript into an ESTree-compatible form so it can be used in ESLint.
37
+
38
+
Note that when using a custom parser, the `parserOptions` configuration property is still required for ESLint to work properly with features not in ECMAScript 5 by default. Parsers are all passed `parserOptions` and may or may not use them to determine which features to enable.
Copy file name to clipboardExpand all lines: docs/src/use/configure/plugins.md
+2-32Lines changed: 2 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
-
title: Configure Plugins & Parsers
2
+
title: Configure Plugins
3
3
eleventyNavigation:
4
4
key: configure plugins
5
5
parent: configure
6
-
title: Configure Plugins & Parsers
6
+
title: Configure Plugins
7
7
order: 5
8
8
9
9
---
@@ -15,8 +15,6 @@ You can extend ESLint with plugins in a variety of different ways. Plugins can i
15
15
* Custom environments.
16
16
* Custom processors to extract JavaScript code from other kinds of files or preprocess code before linting.
17
17
18
-
You can also use custom parsers to convert JavaScript code into an abstract syntax tree for ESLint to evaluate. You might want to add a custom parser if your code isn't compatible with ESLint's default parser, Espree.
19
-
20
18
## Configure Plugins
21
19
22
20
ESLint supports the use of third-party plugins. Before using a plugin, you have to install it using npm.
@@ -161,31 +159,3 @@ Processors may make named code blocks such as `0.js` and `1.js`. ESLint handles
161
159
```
162
160
163
161
ESLint checks the file path of named code blocks then ignores those if any `overrides` entry didn't match the file path. Be sure to add an `overrides` entry if you want to lint named code blocks other than `*.js`.
164
-
165
-
## Configure a Parser
166
-
167
-
By default, ESLint uses [Espree](https://github.com/eslint/espree) as its parser. You can optionally specify that a different parser should be used in your configuration file if the parser meets the following requirements:
168
-
169
-
1. It must be a Node module loadable from the config file where the parser is used. Usually, this means you should install the parser package separately using npm.
170
-
1. It must conform to the [parser interface](../../extend/custom-parsers).
171
-
172
-
Note that even with these compatibilities, there are no guarantees that an external parser works correctly with ESLint. ESLint does not fix bugs related to incompatibilities with other parsers.
173
-
174
-
To indicate the npm module to use as your parser, specify it using the `parser` option in your `.eslintrc` file. For example, the following specifies to use Esprima instead of Espree:
* [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) - A wrapper around the [Babel](https://babeljs.io) parser that makes it compatible with ESLint.
189
-
* [@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser) - A parser that converts TypeScript into an ESTree-compatible form so it can be used in ESLint.
190
-
191
-
Note that when using a custom parser, the `parserOptions` configuration property is still required for ESLint to work properly with features not in ECMAScript 5 by default. Parsers are all passed `parserOptions` and may or may not use them to determine which features to enable.
0 commit comments