BenoitZugmeyer / eslint-plugin-html

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

fix: don't crash when ESLint is not loaded #267

Closed BenoitZugmeyer closed 7 months ago

BenoitZugmeyer commented 7 months ago

Before ESLint 9, the plugin needed to be imported only when actually linting files. Tools inspecting the configuration didn't need to import the plugin, as the configuration was declared as a plain JSON.

With ESLint 9, tools inspecting the configuration actually need to evaluate the configuration file wich imports the plugin. So it has a higher chance to be evaluated outside of ESLint.

To allow such use case, don't throw an exception when the plugin is not loaded through ESLint, but rather display a warning. The bug report template should be enough to gather the needed information.

Fixes https://github.com/BenoitZugmeyer/eslint-plugin-html/issues/264