BenoitZugmeyer / eslint-plugin-html

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

When `eslint-plugin-html` is extended, rules from other plugins don't work. #176

Closed ddubrava closed 2 years ago

ddubrava commented 2 years ago

Description

When eslint-plugin-html is extended, rules from other plugins don't work.

Initially, I ran into a problem in an angular project where the sharable config (it used this plugin) was breaking the extended recommended rules. So I started to find out, simplifying the code, removing deps, and came to the most simple reproduction with a single config file.

There are README files: Minimum reproduction: https://github.com/ddubrava/eslint-plugin-html-repro Angular project reproduction: https://github.com/ddubrava/eslint-config-tinkoff-html-issue

Setup configuration

{
  "root": true,
  "plugins": ["@html-eslint", "html"],
  "parser": "@html-eslint/parser",
  "extends": ["plugin:@html-eslint/recommended"]
}
BenoitZugmeyer commented 2 years ago

You should not use both @html-eslint/* and eslint-plugin-html. Use only one or the other.

ddubrava commented 2 years ago

Why can't I use both of them? eslint-plugin-html is designed to lint inline scripts, while @html-eslint/* to lint HTML markup. The problem is not in the @html-eslint/* package, the problem is that I can't use any other rules or plugins with eslint-plugin-html. That's why there is a repro with an Angular project. Where I'm just trying to use this plugin and angular recommended rules for HTML.

Thank you for your response!

BenoitZugmeyer commented 2 years ago

Ah! I thought @html-eslint goal was similar to eslint-plugin-html. Sorry!

I see what's going on: my plugin takes precedence and keeps only the JavaScript from HTML files. Since you don't have any in your minimal example, the @html-eslint plugin fails to detect any issue.

I have a POC to fix this issue, but still need some work.

BenoitZugmeyer commented 2 years ago

Fixed in v7.1.0! Thank you for your patience. Let me know how it works for you.