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
Bug: ESLint API cannot find eslint-recommended.js #15575
Comments
As we discussed in the original issue, ESLint isn’t designed to be bundled with Webpack, so this isn’t something the team can prioritize. If you want to experiment with fixing the problem and submit a pull request, we can review it. |
@nzakas, thanks for the response! Could you share your thoughts about how it should be fixed? |
I've dived a bit and found this function which loads config extends. |
The problem is that all config data is loaded via filepaths, so we can’t just swap in an object without changing a lot of the complex plumbing of the config cascade. |
Correct me if I'm wrong. There are two parts of the changes:
// ...
if (extendName === "eslint:recommended") {
return this._normalizeConfigData(this.eslintRecommendedConfig, {
...ctx,
name: `${ctx.name} » ${extendName}`
});
}
// ... Plus there are changes to Do you think if it would work? Thanks! |
I don’t know. Why don’t you try it and see what happens? |
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint/eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint/eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint/eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint/eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint/eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint/eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint/eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Fixes: eslint#15575
Load eslint:recommended and eslint:all configs via import instead file paths. Refs eslint/eslint#15575
Reopening as this isn't fixed until #15616 gets merged. |
Load eslint:recommended and eslint:all configs via require instead file paths. Fixes: #15575
Load eslint:recommended and eslint:all configs via require instead file paths. Fixes: eslint#15575
Environment
Node version: v16.10.0
npm version: 7.24.0
Local ESLint version: 8.8.0
Global ESLint version: N/A
Operating System: macOS Big Sur
What parser are you using?
Default (Espree)
What did you do?
To reproduce the issue:
git clone https://github.com/daidodo/eslint-api-issue.git
cd eslint-api-issue && npm i && npx webpack
node dist/main.js src/index.ts
What did you expect to happen?
I expect the output is the ESLint resolved config for the given file.
If you run
npx tsc && node dist/main.js src/index.ts
, you can get:What actually happened?
If webpacked, the output would be:
Participation
Additional comments
I've submitted a similar issue (#13974) but got aged.
My guess is the
__dirname
in lib/cli-engine/cli-engine.js causes the issue. But I don't have enough context to confirm or fix it.Thanks!
The text was updated successfully, but these errors were encountered: