-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
ESLint version
8.0.0-beta.1
What problem do you want to solve?
In the current version of ESLint, it's currently not possible to have plugins as dependencies in shared configs (as detailed in #3458)
It is however possible to patch ModuleResolver
to make this work :
- https://github.com/microsoft/rushstack/tree/master/stack/eslint-patch
- https://github.com/swissquote/crafty/blob/master/packages/crafty-preset-eslint/src/patchModuleResolver.js
The patch isn't anything fancy:
https://github.com/swissquote/crafty/blob/master/packages/crafty-preset-eslint/src/patchModuleResolver.js#L78-L95
But it works better than --resolve-plugins-relative-to
since it allows to have logic for more than one directory and doesn't require the end-user to add it to each of his calls to eslint
Now since this patching accesses the modules directly at their location inside the eslint
or @eslint/eslintrc
package it won't be possible anymore as
- they will be using
exports
inpackage.json
@eslint/eslintrc
is bundled so we can't refer to a module directly- Rollup automatically wraps exports in
Object.freeze
thus effectively blockingrequire("@eslint/eslintrc").Legacy.ModuleResolver.resolve = someNewResolver
- Even if patching worked, Rollup simplifies module references to directly refer to the
resolve
function so it wouldn't take the patch into consideration anyway. ( Fix: ConfigArrayFactory was ignoring the resolver option in some places eslintrc#53 (comment) )
What do you think is the correct solution?
The easiest solution I would see and was proposed by @mdjermanovic : disable the freezing of objects by Rollup : eslint/eslintrc#53 (comment)
That would need to be combined with something that makes sure to not refer to the function directly but to refer to the ModuleResolver
object so that the patching works.
This summary is a follow up of the discussion in eslint/eslintrc#53
Participation
- I am willing to submit a pull request for this change.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status