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

Commit

Permalink
Breaking: typescript-estree v5 (#538)
Browse files Browse the repository at this point in the history
* Upgrade: typescript-estree v5

* Simplify options

* Update tests

* Update documentation

* Remove outdated comments in tests
  • Loading branch information
kaicataldo committed Nov 7, 2018
1 parent 6a9b629 commit a9d932a
Show file tree
Hide file tree
Showing 14 changed files with 710 additions and 79 deletions.
26 changes: 18 additions & 8 deletions README.md
Expand Up @@ -17,7 +17,9 @@ npm install --save-dev typescript-eslint-parser
In your ESLint configuration file, set the `parser` property:

```json
"parser": "typescript-eslint-parser"
{
"parser": "typescript-eslint-parser"
}
```

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.
Expand All @@ -30,15 +32,23 @@ Instead, you also need to make use of one more plugins which will add or extend

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).

## Options
## Configuration

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.

**`jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html).

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:
**`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`.

```js
parserOptions: {
ecmaFeatures: {
jsx: true,
}
### .eslintrc.json

```json
{
"parser": "typescript-eslint-parser",
"parserOptions": {
"jsx": true,
"useJSXTextNode": true
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -51,7 +51,7 @@
"dependencies": {
"eslint": "4.19.1",
"eslint-visitor-keys": "^1.0.0",
"typescript-estree": "2.1.0"
"typescript-estree": "5.0.0"
},
"peerDependencies": {
"typescript": "*"
Expand Down
9 changes: 9 additions & 0 deletions tests/lib/__snapshots__/basics.js.snap
Expand Up @@ -94,6 +94,7 @@ Object {
"type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
Expand Down Expand Up @@ -499,6 +500,7 @@ Object {
"type": "DoWhileStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
Expand Down Expand Up @@ -1177,6 +1179,7 @@ Object {
"type": "FunctionDeclaration",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
Expand Down Expand Up @@ -1544,6 +1547,7 @@ Object {
"type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 17,
Expand Down Expand Up @@ -1712,6 +1716,7 @@ Object {
"type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
Expand Down Expand Up @@ -1973,6 +1978,7 @@ Object {
"type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 6,
Expand Down Expand Up @@ -2215,6 +2221,7 @@ Object {
"type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
Expand Down Expand Up @@ -2515,6 +2522,7 @@ Object {
"type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 4,
Expand Down Expand Up @@ -2974,6 +2982,7 @@ Object {
"type": "ExpressionStatement",
},
],
"comments": Array [],
"loc": Object {
"end": Object {
"column": 0,
Expand Down

0 comments on commit a9d932a

Please sign in to comment.