astexplorer
astexplorer copied to clipboard
Cannot use another parser with transformer eslint v4
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:
- parse javascript with
@typescript-eslint/parser
- turn on transform to
ESLint v4
- observe the parser switch to
babel-eslint
- observe the parser switch to
- create example and transformer as in the above example
- 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)
{
"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.
Unfortunately this works "as designed". The selected parser isn't connected to the selected transformer at all. I have plans to change this though.