neotan/vscode-auto-restart-typescript-eslint-servers

While on the topic: It would also be nice to avoid restarting ESLint if it isn't running (because no relevant files have been opened yet), as this also creates a notification. I don't know how hard this would be to detect though.

neotan opened this issue · 3 comments

neotan commented
          While on the topic: It would also be nice to avoid restarting ESLint if it isn't running (because no relevant files have been opened yet), as this also creates a notification. I don't know how hard this would be to detect though.

Originally posted by @ehoogeveen-medweb in #1 (comment)

neotan commented

Thanks for the issue, @ehoogeveen-medweb, the fixed version had been released, pls update to v0.0.5. Thanks!
https://marketplace.visualstudio.com/items?itemName=neotan.vscode-auto-restart-typescript-eslint-servers

@neotan It looks like this is still happening with v0.0.5: If I modify/re-save .eslintrc.json before opening any javascript or typescript files, the following notification pops up:
image
The notification from this extension can be disabled via the new setting, but the ESLint extension doesn't like the restart.

neotan commented

@ehoogeveen-medweb Thanks for clarifying the symptom! The msg you posted was that bcoz the ESLint server hasn't been fully started, even the .isActivate === true

I can check the open files' extensions to determine if the ESLint server is fully started, but will run into another edge case: the user opens and then closes all the JS/TS files, then this check will be failed.

// Idea: `isJsFileOpen === true` means ESLint server is fully started
  const isJsFileOpen= window.tabGroups.all  
    .flatMap(({ tabs }) => tabs.map(tab => tab.label))
    .some(label => label.match(/(.ts|.tsx|.js|.jsx)$/))

So let's treat it as an edge case in the current situation, hopefully, the vscode-eslint can provide a more reliable isActivate someday. Again, thanks for bringing this issue up. Cheers🍻!