question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension 'ESLint' cannot format '*.tsx'

See original GitHub issue

Hello, I’m getting this error once I save my .tsx (react) file:

Extension 'ESLint' cannot format 'file.tsx'

@ the statusbar. The output window of eslint reports no errors / warnings, both with debug on & off.

My stuff:

system & vscode:

$ uname -a
Linux arch-usb 5.4.3-arch1-1 #1 SMP PREEMPT Fri, 13 Dec 2019 09:39:02 +0000 x86_64 GNU/Linux

$ vscodium --version
1.41.0
9579eda04fdb3a9bba2750f15193e5fafe16b959
x64

$ code-insiders --version
1.42.0-insider
e74405d11443c5361c31e2bc341866d146eee206
x64

.ts files work just fine.


Edit:

Demo: https://github.com/sarpik/cra-ts-vscode-eslint-broken-demo

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
piotrblasiakcommented, Dec 21, 2019

Formatter is set correctly, as indicated by the error message

Extension 'ESLint' cannot format ...

and running

npx eslint --fix nameOfFile.ts also works so eslint config is clearly good.

And both Eslint and extension host output/logs are empty. So no idea what to do next…

1reaction
dbaeumercommented, Jan 8, 2020

ESLint itself is very sensitive when it comes to global configuration and installs. In principal the eslint module and all plugins need to be installed either globally or locally. This is why they mainly recommend local installs.

The extension should actully react to changes in the .eslintrc configuration file if it is part of the workspace. I tested this and it does work for me. Anything special you can remember here?

The VS Code eslint plugin uses the ESLint npm module and hence is bound to their behavior and I don’t want to change this. Major reason is that otherwise linting in VS Code will produce other results than linting in the terminal.

Bottom line: if it works in the terminal but not in VS Code it is a bug. If it doesn’t work in both it is expected 😃.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extension 'eslint' is configured as formatter but it cannot format ...
I was fighting with this for a while, turns out you need to head to Settings , under User go to Extensions >...
Read more >
Auto Format with ESLint and Prettier for React TypeScript Project
This error means linter cannot resolve tsx file without .tsx extension. So if you write it with ./App.tsx , you can avoid it....
Read more >
How to Format Code on Save in VS Code with ESlint
I've read my fair share of posts on what you'd think would be a simple task: how to format code on save in...
Read more >
jsEnable": true ). eslint - ADocLib
Extension eslint cannot format /[id]/index.tsx files. The command to format code is not using ESLint yet, it uses VSCode's own formatter (or another...
Read more >
Developers - Extension eslint cannot format .../[id]/index.tsx files -
Extension eslint cannot format . ... I use eslint as a formatter for .tsx? files but it is unable to format files that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found