-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Hello there 👋
I'm using yarn v3.1.1 with PnP enabled.
I have a monorepository architecture:
Notice how the root package is dependent on the eslint-config-convergence-json workspace itself.
In my root ESLint config, I extend from the config exposed by the eslint-config-convergence-json package:
// .eslintrc.json
{
// ...
"overrides": [
{
"extends": ["convergence-json"], // Note: ESLint automatically adds the `eslint-config-` prefix.
"files": "*.json"
}
]
}The eslint-config-convergence-json workspace has a single dependency:
// packages/eslint-config-json/package.json
{
// ...
"dependencies": {
"eslint-plugin-jsonc": "^2.0.0"
},
"main": "index.js",
"peerDependencies": {
"eslint": *,
}It exposes an ESLint config that one can extend from:
// packages/eslint-config-json/index.js
module.exports = {
// ...
plugins: ["jsonc"],
};Running the command (from the root):
yarn eslint any-json-file.jsonGives me the following error:
Oops! Something went wrong! :(
ESLint: 8.5.0
ESLint couldn't find the plugin "eslint-plugin-jsonc".
(The package "eslint-plugin-jsonc" was not found when loaded as a Node module from the directory "/Users/blackjelly/code/resume-studio/eslint-config-convergence".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm install eslint-plugin-jsonc@latest --save-dev
The plugin "eslint-plugin-jsonc" was referenced from the config file in ".eslintrc.json#overrides[0] » eslint-config-convergence-json".My guess is that, because eslint-plugin-jsonc is not referenced directly in the root package.json's dependencies, ESLint can't access it from there, even though it is referenced as a dependency of the eslint-config-convergence-json package, which itself is a dependency of the root package.
Note that adding --resolve-plugins-relative-to packages/json to the previous command does make it work. It's not a viable option though, as I plan to add more configs (i.e. more workspaces), and those might depend on plugins as well.
Any workaround apart from switching nodeLinker to node-module?