Prettier Parsing Error While Typing
MattMorgis opened this issue · comments
Matt Morgis commented
I wanted to preface this by saying I am unsure if the bug is happening here in this package or in Microsoft/vscode-tslint. I filed issue #405 there as well.
Steps to Reproduce
- Download this sample project that I put together to reproduce the issue.
- Run
npm install
- Open
src/index.ts
and start typing anything. - Result: See error printed to
tslint
output,⚠️ the bottom status bar next to TSLint. It then never recovers and the⚠️ stays there forever
Console Output
[Warn - 2:54:44 PM] The 'prettier' rule threw an error in '/tslint-prettier-vscode-bug/src/index.ts':
SyntaxError: Expression expected. (3:28)
1 | console.log('👍');
2 |
> 3 | const x = "does this work"?
| ^
4 |
at e (/tslint-prettier-vscode-bug/node_modules/prettier/parser-typescript.js:1:422)
at Object.parse (/tslint-prettier-vscode-bug/node_modules/prettier/parser-typescript.js:1:2010094)
at Object.parse$2 [as parse] /tslint-prettier-vscode-bug/node_modules/prettier/index.js:7138:19)
at coreFormat (/Users/morgism/Developer/nodejs/tslint-prettier-vscode-bug/node_modules/prettier/index.js:10398:23)
at format (/tslint-prettier-vscode-bug/node_modules/prettier/index.js:10570:16)
at formatWithCursor (/tslint-prettier-vscode-bug/node_modules/prettier/index.js:10582:12)
at /Users/morgism/Developer/nodejs/tslint-prettier-vscode-bug/node_modules/prettier/index.js:34924:15
at Object.format (/tslint-prettier-vscode-bug/node_modules/prettier/index.js:34943:12)
at Walker.walk /tslint-prettier-vscode-bug/node_modules/tslint-plugin-prettier/rules/prettierRule.js:54:34)
at Rule.AbstractRule.applyWithWalker (/tslint-prettier-vscode-bug/node_modules/tslint/lib/language/rule/abstractRule.js:31:16)
Video
A .gif
demoing this can be found here.