Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier Parsing Error While Typing #271

Closed
MattMorgis opened this issue Oct 24, 2018 · 0 comments
Closed

Prettier Parsing Error While Typing #271

MattMorgis opened this issue Oct 24, 2018 · 0 comments
Labels

Comments

@MattMorgis
Copy link

MattMorgis commented Oct 24, 2018

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

  1. Download this sample project that I put together to reproduce the issue.
  2. Run npm install
  3. Open src/index.ts and start typing anything.
  4. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants