Change Request: (Read config files using fs API instead of import) #16660
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
Projects
ESLint version
8.27.0
What problem do you want to solve?
Hi, I am the maintainer of the VS Code ESLint extension and we lately added experimental support for flat configs to the extension.
The VS Code ESLint extension runs eslint as a service, meaning that we load the library once and then reuse the library for every file validation. This is done for performance reasons to avoid process spawns and library loading.
When a config file changes (.eslintrc.*) file we simply revalidate all files that are open on VS Code. This works nicely since the ESLint npm module will re-lookup and re-load the config file from disk.
With flat config files this doesn't work anymore since the config file is loaded via an import statement (see https://vscode.dev/github/eslint/eslint/blob/7190d98ff40023f24b0c6a98319ae8a82c99ff5b/lib/eslint/flat-eslint.js#L284) and according to the NodeJS documentation import statements are cached by URLs (see https://nodejs.org/api/esm.html#urls)
What do you think is the correct solution?
To support loading the current version of the config file as it exists on disk the import statement should be exchanged with FS read file.
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: