Mike Scotty
Mike Scotty

Reputation: 10782

eslint not running for html files

It would seem the eslint extension is not startet in VSCode when I open .html files.

If I execute ESLint: Fix all auto-fixable Problems with a .html file opened I get the following message:

ESLint is not running. By default only JavaScript files are validated. If you want to validate other file types please specify them in the \'eslint.validate\' setting.

Everything is working fine when I open .js files in vscode.

I have already installed the eslint-plugin-html plugin.

Everything is working fine when I manually pass the .html file to eslint CLI, thus I gusss it's not an issue with the eslint plugin.

Here's my complete settings.json file:

{
    "eslint.options": {
        "extensions": [".html", ".js"]
    },
    "eslint.validate": [
        "javascript",
        {
            "language": "html",
            "autoFix": true
        }
    ]
}

Here's the start of my .eslintrc.js file:

module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: 'airbnb-base',
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
  },
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module',
  },
  plugins: [
    "align-assignments", "html",
  ],
  settings: {
    "html/report-bad-indent": "error",
  },
  rules: { ...

I have already looked at eslint is running but not showing any lint errors/warnings and at How can I get ESLint to lint HTML files in VSCode? but none of the answers did help me.

Note that I do not even see the ESLint output channel as described in the screenshot here: https://stackoverflow.com/a/54138880/4349415

I can only see this ESLint output channel, telling me that the ESLint server has startet, when I open a .js file.

Upvotes: 2

Views: 4655

Answers (1)

Mike Scotty
Mike Scotty

Reputation: 10782

The issue was not with ESLint or VSCode, but with another VSCode third party extension: Mako (version 0.2.0)

https://marketplace.visualstudio.com/items?itemName=tommorris.mako

Disabling this extension fixed the ESLint support in HTML files.

Upvotes: 1

Related Questions