Differentially treat specific blocks (use new processor API)
See original GitHub issueDescription
#123 ties into this (and perhaps could be considered with this), though that issue is focused on inline event handler blocks, and this issue is more for the blocks that are already discovered by eslint-plugin-html
(though supporting their differential treatment).
If supporting the new ESLint processor API, (as eslint-plugin-markdown
is now doing in their v2.0.0), this should I think allow eslint-plugin-html
to support the following:
- Applying specific
overrides
config (rules
, etc.) for specific script tags type="module"
on the script tags could be used to determine whether the blocks are modules or not (rather than projectparserOptions.sourceType
config) they should be weaved together for purposes of undefined/unused variables (since files can have a mix of type or no type).
(Of course, one would only wish to do this if the current beneficial ability to treat the blocks as tied together for purposes of undefined/used variables could be continued when non-module scripts were in use. If necessary, perhaps the non-modules could be strung together even if it means they could not have separate config, while allowing the modules to be treated as the separate entities they are.)
Alternatives
One can use external files and lint those by file name.
Additional context
See:
- https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins
- https://eslint.org/docs/user-guide/configuring/plugins#specifying-processor
I’ll admit this is not a burning need I have, but I figured it might be worth a look given ESLint’s support for the approach, and that the Markdown plugin is now doing so.
Thanks for the great plug-in!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
@brettz9
I want to send a PR to https://github.com/BenoitZugmeyer/eslint-plugin-html, but it’s difficult for me. let’s see if anyone can help?
I try to read the code of
eslint-plugin-html
, it’s really complex, I didn’t understand every part yet. And I thinkhtmlparser2
APIs are not friendly enough.But I will try to solute the
no-unused-vars
problem someday.@BenoitZugmeyer
Are you working on this? It should not be difficult based on my experience by fixing
eslint-plugin-markdown
’s issues and developingeslint-plugin-mdx
, and fixing other tools’ issues due toprocessor
API.If you haven’t started, I can help to start the job when I’m free.