eslint-plugin-html icon indicating copy to clipboard operation
eslint-plugin-html copied to clipboard

Linting non-inline scripts

Open KTibow opened this issue 5 years ago • 1 comments
trafficstars

Description

Right now, you can only lint non-inline scripts. It'd be good if you could lint stuff using the syntax of

<script src="/confetti.js"></script>

Ideally it would use the syntax of **/confetti.js, because projects might have it in a different place than the root or the same dir.

Alternatives

Use some kind of plugin to replace it with an inline script.

Additional context

KTibow avatar Nov 14 '20 01:11 KTibow

Just to suggest another alternative. With my project es-file-traverse, you can point to an HTML file (or a file with import or require) to extract the script file names to be linted. The CLI currently has no option for base directory, but you should be able to use the programmatic API to adapt it.

brettz9 avatar Feb 15 '21 01:02 brettz9

ESLint works on a per-file basis. Linting JS files referenced in HTML files is out of scope for this plugin. The alternative pointed by @brettz9 looks like a fine alternative.

BenoitZugmeyer avatar Feb 10 '24 09:02 BenoitZugmeyer