Skip to content

Differentially treat specific blocks (use new processor API) #139

@brettz9

Description

@brettz9

Description

#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:

  1. Applying specific overrides config (rules, etc.) for specific script tags
  2. type="module" on the script tags could be used to determine whether the blocks are modules or not (rather than project parserOptions.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:

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!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions