New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Request: [flat config] re-read the eslint.config.js file if it has been changed #16576
Comments
Hi @alexander-doroshko, thanks for the issue!
Any ideas on how we could do this? I'm not sure if there's already built-in support for this use case in Node.js. Maybe we could check if the config file's |
The first idea that came to my mind is based on this article. Maybe it will work if you change
to
where 12345 is the file modification stamp? |
I don't know how probable it is that |
I think this would work. And if we always append the file modification stamp, then we don't need to keep the previous one and check if it has changed.
That case most likely wouldn't be covered, but if we manage to reload |
Thanks, being on par with eslintrc sounds reasonable. |
Hi, I see the |
Oops, sorry, I pressed the wrong button, and bots have updated the labels. Sorry about that. I'm afraid I don't have permissions to restore the correct issue state. |
I'm in favor of appending a query with file modification stamp in order to force reloading @nzakas what do you think? |
Appending a time stamp query string seems like an easy way to do this. 👍 @alexander-doroshko by the way, we would love to have your feedback on this discussion: We are rethinking our API and would love feedback from integrators on what the current API isn’t doing for you. (Kind of like in this thread.) |
PR #16608. Unfortunatelly, this approach doesn't seem to work when the config file is a CJS module. |
I'm assuming the issue is that Node.js always caches a CommonJS config file when using |
Yes, per comments from the issues I linked, when I'll try the solution @fasttime suggested in #16608 (comment), just had to contemplate whether we should reload CJS configs always, like in the eslintrc config system, or only if they've changed. I think we should do the latter, so that the behavior is the same as with ESM configs. |
ESLint version
8.28.0
What problem do you want to solve?
Hi from JetBrains! WebStorm ESLint integration has a wrapper Node.js process that lives for a long time and calls
ESLint.lintText()
as needed. ESLint config files might be edited betweenESLint.lintText()
calls.In the 'flat config' mode, the
eslint.config.js
files are never re-read from disk. The reason is that they are loaded using import(), which caches the result forever.So, the problem is that the ESLint results that WebStorm users see do not match the current configuration (
eslint.config.js
files).Cleaning require.cache doesn't help. It looks like there's no way to drop the internal cache of import().
What do you think is the correct solution?
It would be great if the loadFlatConfigFile() function returned up-to-date result each time even if the config file has been edited between loadFlatConfigFile() invocations. Thank you!
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: