BenoitZugmeyer / eslint-plugin-html

An ESLint plugin to extract and lint scripts from HTML files.
ISC License
430 stars 51 forks source link

Twig handlebars result in parsing errors #238

Closed pimhakkertgc closed 1 year ago

pimhakkertgc commented 1 year ago

Description

When using Twig handles in the Javascript of a Twig file, ESLint's parser breaks.

Try using {{ }}, {% %}, or {# #} and the parser will not accept it. Is there a workaround?

Setup configuration

module.exports = {
  extends: [
    'eslint:recommended'
  ],
  plugins: [
    'html'
  ],
  settings: {
    "html/html-extensions": [".html", ".twig", ".html.twig"]
  },
  rules: {
    "no-undef": "off",
    "no-empty": "off",
    "no-unused-vars": "off"
  },
  parserOptions: {
    ecmaVersion: "latest"
  },
  env: {
    es6: true
  }
};
BenoitZugmeyer commented 1 year ago

See the README Troubleshooting section: https://github.com/BenoitZugmeyer/eslint-plugin-html#linting-templates-or-php