Cannot use another parser with transformer eslint v4
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 772
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When selecting the `ESLint v4` transformer, it automatically switches to the babel-eslint parser.
If you switch the parser to `@typescript-eslint/parser` after this, it doesn't change the parser used in the transform.
**To Reproduce**
Example:
https://astexplorer.net/#/gist/a6c718c40c7797b1e7d071e2180c35ad/a56db076715dc493620243af71bf20cb7ed2e497
Repro steps:
1) parse javascript with `@typescript-eslint/parser`
1) turn on transform to `ESLint v4`
- observe the parser switch to `babel-eslint`
1) create example and transformer as in the above example
1) switch parser back to to `@typescript-eslint/parser`
- observe the AST output pane shows the correct AST.
**Expected behavior**
Transform output should start with:
```
// "TS" TypeAlias (at 1:1)
```
**Actual behavior**
Transform output instead starts with:
```
// "Babel" TypeAlias (at 1:1)
```
**Browser (please complete the following information):**
- OS: macos 10.14.6
- Browser: chrome
- 80.0.3973.0 (Official Build) canary (64-bit)
**astexplorer settings:**
- Selected parser: `@typescript-eslint/parser`
- Selected transformer (if applicable): `ESLint v4`
- Contents of the local storage key `explorerSettingsV1` (code can be removed if you don't want it to be public)
```json
{
"showTransformPanel": false,
"parserSettings": {},
"parserPerCategory": {},
"workbench": {
"parser": "acorn",
"code": "/**\n * Paste or drop some JavaScript here and explore\n * the syntax tree created by chosen parser.\n * You can use all the cool new features from ES6\n * and even more. Enjoy!\n */\n\nlet tips = [\n \"Click on any AST node with a '+' to expand it\",\n\n \"Hovering over a node highlights the \\\n corresponding part in the source code\",\n\n \"Shift click on an AST node expands the whole substree\"\n];\n\nfunction printTips() {\n tips.forEach((tip, i) => console.log(`Tip ${i}:` + tip));\n}\n",
"keyMap": "default",
"transform": {
"code": "",
"transformer": null
}
}
}
```
**Additional context**
Add any other context about the problem here.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue using the linked AST Explorer example with @typescript-eslint/parser and the ESLint v4 transformer. Trace how changing the selected parser affects transform output; done when switching back produces output beginning with // "TS" TypeAlias (at 1:1) rather than the Babel wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100