SublimeLinter-eslint icon indicating copy to clipboard operation
SublimeLinter-eslint copied to clipboard

Excessive Tasks on Queue

Open nicholas-ochoa opened this issue 3 years ago • 3 comments

I've noticed warnings on the ST console where the linter seems to be getting called excessively for file loads / modifications:

image

full output

In this example there were 17 copies of the linter executed simultaneously. Usually it's less but I can't figure out any kind of pattern to it (sometimes 4 launch, sometimes 9 launch, etc..). I'm just opening files in the project and and soon as the tab is focused or a change made in the file tons of tasks are fired off.

I've tried increasing the background delay setting from 0.1 to 0.5 or even 1.0 but it doesn't seem to make a difference - the delay works but after 0.5 seconds I still see a bunch of ESLint tasks executing.

nicholas-ochoa avatar Nov 20 '20 20:11 nicholas-ochoa

(Where is that double logging coming from? 🤔 )

We report these excessive tasks because sometimes the configuration might be not what you want. 17(!) is truly excessive. Usually it comes from the selector setting. I noticed eslint runs on an html file here, did you have eslint-plugin-html installed? Or hav you changed the default selector in your settings? (If you have 17 tasks on one html file it looks like it runs every <script> content through a separate eslint process. Just a guess.)

kaste avatar Nov 21 '20 22:11 kaste

It appears to be worst on Angular component HTML files - your comment is pretty much spot on, it's the scope within the file that's causing the excessive number of ESLint instances. In this case, within the Angular component there were 17 separate areas that were scoped for TS/JS code and those were individually being sent for linting...at the same time.

Is there a better or alternative way to have linting done in this case? In most cases it looks like ES Lint is getting spun up to lint a single one word variable or a simple condition.

nicholas-ochoa avatar Nov 23 '20 15:11 nicholas-ochoa

You need the official angular plugin for eslint which supports the template/html files. After that we need to figure out a good root selector. This selector depends on the Sublime syntax you use for the template files.

kaste avatar Nov 23 '20 17:11 kaste

Closing as this plugin now detects the @angular-eslint/eslint-plugin and configures the selector automatically. (Added in v4.2.5)

kaste avatar Aug 27 '22 00:08 kaste