Skip to content

Commit

Permalink
fix: Avoid __dirname for built-in configs (#15616)
Browse files Browse the repository at this point in the history
Load eslint:recommended and eslint:all configs via require instead file paths.

Fixes: #15575
  • Loading branch information
daidodo committed Feb 25, 2022
1 parent 7cec74e commit cdc5802
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/cli-engine/cli-engine.js
Expand Up @@ -616,8 +616,8 @@ class CLIEngine {
useEslintrc: options.useEslintrc,
builtInRules,
loadRules,
eslintRecommendedPath: path.resolve(__dirname, "../../conf/eslint-recommended.js"),
eslintAllPath: path.resolve(__dirname, "../../conf/eslint-all.js")
getEslintRecommendedConfig: () => require("../../conf/eslint-recommended.js"),
getEslintAllConfig: () => require("../../conf/eslint-all.js")
});
const fileEnumerator = new FileEnumerator({
configArrayFactory,
Expand Down
4 changes: 2 additions & 2 deletions lib/cli-engine/file-enumerator.js
Expand Up @@ -215,8 +215,8 @@ class FileEnumerator {
cwd = process.cwd(),
configArrayFactory = new CascadingConfigArrayFactory({
cwd,
eslintRecommendedPath: path.resolve(__dirname, "../../conf/eslint-recommended.js"),
eslintAllPath: path.resolve(__dirname, "../../conf/eslint-all.js")
getEslintRecommendedConfig: () => require("../../conf/eslint-recommended.js"),
getEslintAllConfig: () => require("../../conf/eslint-all.js")
}),
extensions = null,
globInputPaths = true,
Expand Down

0 comments on commit cdc5802

Please sign in to comment.