BenoitZugmeyer / eslint-plugin-html

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

Possible bug w/ viewing in Sublime text 3 #47

Closed nharn85 closed 7 years ago

nharn85 commented 7 years ago

With the plugin installed globally, and SublimeLinter working with eslint in .js files with no issue, when I add "plugins": [ "html" ] to my .eslintrc file, the linting does not give any feedback in my .html file with script tags however, it does give feed back when the command is run in terminal. When I remove "plugins": [ "html" ] the linting displays errors in Sublime but not in the terminal.

I don't need it in terminal and Sublime, was just curious if I'm missing a setting somewhere? Possibly in SublimeLinter itself that you know of?

Thanks

BenoitZugmeyer commented 7 years ago

Not a ST user myself, I managed to reproduce your setup. It looks like the SublimeText-contrib-eslint package is sending only JS code to the eslint command: if you have a file containing <script>var a;</script>, it will feed only var a; to the eslint command. It will also send the file name alongside, so the eslint command will apply the eslint-plugin-html, which will try to extract script tags from the given input. Since var a; has no script tags, no JS will actually be linted.

Long story short: the ST package does the job of my ESLint plugin, so you don't need to (or even shouldn't) use my plugin when you are coding in ST, but it is still needed when using ESLint on the command line.

I can't to anything about that. Maybe ask the SublimeText-contrib-eslint devs to add an option so their package sends the HTML content as-is, instead of the extracted JS?

nharn85 commented 7 years ago

Ah gotcha. Thanks!