Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit a9d932a

Browse files
authored
Breaking: typescript-estree v5 (#538)
* Upgrade: typescript-estree v5 * Simplify options * Update tests * Update documentation * Remove outdated comments in tests
1 parent 6a9b629 commit a9d932a

14 files changed

+710
-79
lines changed

Diff for: README.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ npm install --save-dev typescript-eslint-parser
1717
In your ESLint configuration file, set the `parser` property:
1818

1919
```json
20-
"parser": "typescript-eslint-parser"
20+
{
21+
"parser": "typescript-eslint-parser"
22+
}
2123
```
2224

2325
There is sometimes an incorrect assumption that the parser itself is what does everything necessary to facilitate the use of ESLint with TypeScript. In actuality, it is the combination of the parser _and_ one or more plugins which allow you to maximize your usage of ESLint with TypeScript.
@@ -30,15 +32,23 @@ Instead, you also need to make use of one more plugins which will add or extend
3032

3133
By far the most common case will be installing the [eslint-plugin-typescript](https://github.com/nzakas/eslint-plugin-typescript) plugin, but there are also other relevant options available such a [eslint-plugin-tslint](https://github.com/JamesHenry/eslint-plugin-tslint).
3234

33-
## Options
35+
## Configuration
36+
37+
The following additional configuration options are available by specifying them in [`parserOptions`](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) in your ESLint configuration file.
38+
39+
**`jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html).
3440

35-
The full list of options can be found in the [typescript-estree README](https://github.com/JamesHenry/typescript-estree#parsecode-options). Use them like this in your eslintrc:
41+
**`useJSXTextNode`** - default `false`. The JSX AST changed the node type for string literals inside a JSX Element from `Literal` to `JSXText`. When value is `true`, these nodes will be parsed as type `JSXText`. When value is `false`, these nodes will be parsed as type `Literal`.
3642

37-
```js
38-
parserOptions: {
39-
ecmaFeatures: {
40-
jsx: true,
41-
}
43+
### .eslintrc.json
44+
45+
```json
46+
{
47+
"parser": "typescript-eslint-parser",
48+
"parserOptions": {
49+
"jsx": true,
50+
"useJSXTextNode": true
51+
}
4252
}
4353
```
4454

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"dependencies": {
5252
"eslint": "4.19.1",
5353
"eslint-visitor-keys": "^1.0.0",
54-
"typescript-estree": "2.1.0"
54+
"typescript-estree": "5.0.0"
5555
},
5656
"peerDependencies": {
5757
"typescript": "*"

Diff for: tests/lib/__snapshots__/basics.js.snap

+9
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Object {
9494
"type": "ExpressionStatement",
9595
},
9696
],
97+
"comments": Array [],
9798
"loc": Object {
9899
"end": Object {
99100
"column": 0,
@@ -499,6 +500,7 @@ Object {
499500
"type": "DoWhileStatement",
500501
},
501502
],
503+
"comments": Array [],
502504
"loc": Object {
503505
"end": Object {
504506
"column": 0,
@@ -1177,6 +1179,7 @@ Object {
11771179
"type": "FunctionDeclaration",
11781180
},
11791181
],
1182+
"comments": Array [],
11801183
"loc": Object {
11811184
"end": Object {
11821185
"column": 0,
@@ -1544,6 +1547,7 @@ Object {
15441547
"type": "ExpressionStatement",
15451548
},
15461549
],
1550+
"comments": Array [],
15471551
"loc": Object {
15481552
"end": Object {
15491553
"column": 17,
@@ -1712,6 +1716,7 @@ Object {
17121716
"type": "ExpressionStatement",
17131717
},
17141718
],
1719+
"comments": Array [],
17151720
"loc": Object {
17161721
"end": Object {
17171722
"column": 0,
@@ -1973,6 +1978,7 @@ Object {
19731978
"type": "ExpressionStatement",
19741979
},
19751980
],
1981+
"comments": Array [],
19761982
"loc": Object {
19771983
"end": Object {
19781984
"column": 6,
@@ -2215,6 +2221,7 @@ Object {
22152221
"type": "ExpressionStatement",
22162222
},
22172223
],
2224+
"comments": Array [],
22182225
"loc": Object {
22192226
"end": Object {
22202227
"column": 0,
@@ -2515,6 +2522,7 @@ Object {
25152522
"type": "ExpressionStatement",
25162523
},
25172524
],
2525+
"comments": Array [],
25182526
"loc": Object {
25192527
"end": Object {
25202528
"column": 4,
@@ -2974,6 +2982,7 @@ Object {
29742982
"type": "ExpressionStatement",
29752983
},
29762984
],
2985+
"comments": Array [],
29772986
"loc": Object {
29782987
"end": Object {
29792988
"column": 0,

0 commit comments

Comments
 (0)