Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.9K
Visualizações
The eslint extension is configured as a formatter but cannot format JavaScript files:

I'm having an intermittent issue with ESLint in VS Code. When saving a file, instead of formatting it, this message appears in the status bar:

enter image description here

Apparently no one has ever reported this message to Google.

When I say it's intermittent, it was working fine, then the computer (MBP) crashed and on reboot this is the situation. It's happened before, but I don't remember what I did to fix it.

The app is a fairly complex Vue-based app based on a preconfigured template. In package.json:

 "@vue/cli-plugin-eslint": "^4.5.13", "babel-eslint": "^10.1.0", "eslint": "^7.31.0", "eslint-plugin-import": "^2.23.4", "eslint-plugin-vue": "^7.14.0",

In the VS Code workspace file:

 "editor.codeLens": true, "eslint.format.enable": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true, }, "[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }, "[vue]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }, "eslint.validate": [ "javascript" ], "debug.javascript.usePreview": true, "debug.javascript.usePreviewAutoAttach": true, "[jsonc]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },

I'm really not sure how to go about understanding why vscode-eslint reports that it can't format JavaScript files.

EDIT

This TypeScript related issue gives some clues. It seems that this error can occur when the ESLint server is restarting or the extension host is under a lot of pressure.

In my project now most of the files are formatted fine, although one fails constantly. That file is called eslint.js and is part of a build process, running eslint; I don't fully understand the configuration. I suspect that saving this file somehow causes eslint to run/reload, and while that's happening eslint-vscode also tries to run it and fails.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I was actually experiencing the same problem and I only needed to remove the .eslintignore file, which only contained this line:

.eslintrc.js

You could simply comment that line too.

Hope that helps :)

over 4 years ago · Santiago Trujillo Relatório

0

For me, it seemed as if StandardJS was trying to lint everything in my node_modules folder. The error went away and linting started working again after adding a standard.ignore property to my package.json, followed by reloading VSCode:

{
  "name": "foo",
  "devDependencies": {
    "standard": "^16.0.4"
  },
  "dependencies": {
    // stuff...
  },
  "standard": {
    "ignore": [
      "**/node_modules/**"
    ]
  }
}

No idea why this behavior didn't happen automatically...


UPDATE: I previously had installed eslint alongside standard, which may have been the root cause. My original install command was npm install standard eslint, which installed the latest version of eslint, v8.x.x. However, standard (at the time of writing) depends on eslint v7.x.x, causing a conflict.

The fix:

~$ npm uninstall eslint # remove eslint from package.json
~$ rm -rf node_modules  # remove node_modules
~$ npm install          # get fresh installation
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda