eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.39k stars 4.4k forks source link

Change Request: resolveConfigsRelativeTo #18414

Closed onlywei closed 2 weeks ago

onlywei commented 2 weeks ago

ESLint version

8.57.0

What problem do you want to solve?

ESLint currently has a resolvePluginsRelativeTo parameter in its constructor, but does not have a resolveConfigsRelativeTo param.

Why do I want this? I have a monorepo with the current file structure:

apps/
-  app1/
  -  package.json
   .............
-  app127/
  -  package.json
packages/
-  package1/
  -  package.json
   ............
-  package453/
  -  package.json
repotools/
-  central-linter/
  -  package.json
.eslintrc.json
.eslintignore

I want to install eslint and all of its configs and plugins into the repotools/central-linter/node_modules. I do not want to install a separate copy of eslint and its plugins in each app/package. Also note that there is no package.json file at the root of the repo because I have lots of issues with npm workspaces.

I also want to keep the .eslintrc.json and .eslintignore files at the root of the monorepo for better IDE integration.

I am able to accomplish all of this except for resolving the shared eslint-config-* modules, since they are still resolving relative to the repository root.

What do you think is the correct solution?

Add a resolveConfigsRelativeTo that works the same way as resolvePluginsRelativeTo for extending shared configs.

Participation

Additional comments

No response

aladdin-add commented 2 weeks ago

The option is eslintrc-only, however, it's deprecated and feature-frozen.