Skip to content
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: (Read config files using fs API instead of import) #16660

Closed
1 task done
dbaeumer opened this issue Dec 13, 2022 · 3 comments
Closed
1 task done

Change Request: (Read config files using fs API instead of import) #16660

dbaeumer opened this issue Dec 13, 2022 · 3 comments
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

Comments

@dbaeumer
Copy link

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

  • I am willing to submit a pull request for this change.

Additional comments

No response

@dbaeumer dbaeumer added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Dec 13, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Dec 13, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Triaging in Triage Dec 13, 2022
@mdjermanovic mdjermanovic removed the triage An ESLint team member will look at this issue soon label Dec 13, 2022
@mdjermanovic
Copy link
Member

I think this is the same request as #16576. We're working on the fix in #16608.

@mdjermanovic
Copy link
Member

Using fs API to solve this wouldn't be simple, as we also need to execute the code from the config file.

@dbaeumer
Copy link
Author

Yes, is a duplicate of #16576

Closing in favor of that one.

Triage automation moved this from Triaging to Complete Dec 14, 2022
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jun 13, 2023
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jun 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Archived in project
Triage
Complete
Development

No branches or pull requests

2 participants