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
ESlint plugins are conflicted each other migrating to pnpm #4619
Comments
Just to be sure, can you try a fresh pnpm install in your current project directory, BUT put a .npmrc file with node-linker=hoisted as the setting? Just to be sure it's not about node module resolution issues? In my experience, it solves half of my problems with pnpm. |
@jasongodev I tried your solution.
Failed and other errors were occurred 😢 |
Will it be possible for you to share your project so we can test? Remove all business critical code, api keys, and personal identifiers. |
@jasongodev As I said in description, I couldn't figure out exact cause of this issue. So, I cannot reproduce this situation. Is there any guess you think? |
I had a similar issue:
The problem is I'm using
Using PNPM's "pnpm": {
"overrides": {
"@typescript-eslint/eslint-plugin": "latest",
"eslint": "latest",
"prettier": "latest",
"eslint-plugin-jsonc": "latest",
"eslint-plugin-unicorn": "latest"
}, The problem still persisted, because So I made a So the final patch checks is the file is hardlinked to the same place on disk... not sure if this is 100% correct, because of these different "node_modules contexts" but it works for me. The patch generated using # generated by patch-package 6.4.10
#
# command:
# npx patch-package @eslint/eslintrc
#
# declared package:
# @eslint/eslintrc: 1.3.0 || *
#
diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
index 8b07ba1..31c2c80 100644
--- a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
+++ b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
@@ -563,12 +563,24 @@ class PluginConflictError extends Error {
* @param {{filePath:string, importerName:string}[]} plugins The resolved plugins.
*/
constructor(pluginId, plugins) {
- super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`);
+ super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}. Files not linking to the same place on disk: ${plugins.map(p => p.filePath).join(' and ')}`);
this.messageTemplate = "plugin-conflict";
this.messageData = { pluginId, plugins };
}
}
+function isSameFile(pathA, pathB) {
+ try {
+ const statA = fs.statSync(pathA)
+ const statB = fs.statSync(pathB)
+ if(typeof statA?.ino !== 'number' || typeof statB?.ino !== 'number') return false
+ else return statA.ino === statB.ino
+ } catch(error) {
+ console.error(error)
+ return false
+ }
+}
+
/**
* Merge plugins.
* `target`'s definition is prior to `source`'s.
@@ -594,7 +606,7 @@ function mergePlugins(target, source) {
throw sourceValue.error;
}
target[key] = sourceValue;
- } else if (sourceValue.filePath !== targetValue.filePath) {
+ } else if (!isSameFile(sourceValue.filePath, targetValue.filePath)) {
throw new PluginConflictError(key, [
{
filePath: targetValue.filePath, I'm not sure about performance of the synchronous Also, I'm using Ubuntu WSL - I'm not exactly sure how cross-platform node's |
Also facing this, even though I was forcing a version through
There was a difference on the ESLint version on the folder structure that pnpm uses to name the folder. |
+1 - same issue here. |
Same issue here, you can reproduce it on https://github.com/ggascoigne/festive-beverage/tree/d6f0e76fa5208dd923351fc3ad50f7ca72c81378. Clone it, pnpm install && pnpm lint - boom.
|
Is there some workaround? Seems Error: Plugin "import" was conflicted between "package.json » @packages/eslint-config-hub/.remix.js » ./.react.js » ./.base.js » plugin:import/recommended" and "package.json » @packages/eslint-config-hub/.remix.js » ./.react.js » ./.base.js » plugin:github/recommended". If you debug where error is happens: else if (sourceValue.filePath !== targetValue.filePath) {
console.log(targetValue.filePath)
console.log(sourceValue.filePath)
throw new PluginConflictError(key, [
{
filePath: targetValue.filePath,
importerName: targetValue.importerName
},
{
filePath: sourceValue.filePath,
importerName: sourceValue.importerName
}
]);
}
} You will get this: /Users/dormammun/code/random-video-chat/hub/node_modules/.pnpm/eslint-plugin-import@2.26.0/node_modules/eslint-plugin-import/lib/index.js
/Users/dormammun/code/random-video-chat/hub/node_modules/.pnpm/eslint-plugin-import@2.26.0_k6edyionkpwtvb5fzwjupgro4y/node_modules/eslint-plugin-import/lib/index.js
|
Fixed with: auto-install-peers = true |
May you explain what you did there? Did you also removed node_modules and did Edit: Yes! It solved issue for me too. My warning was little different though.
This was occuring during |
same issue
|
I'll add that I've been using the patch that @atablash provided (updated to the latest @eslint/eslintrc@2.0.1), and find that it's still required regardless of how I configure pnpm. My pnpm flags are: auto-install-peers=true |
auto fixed when I update pnpm to v8.0.0 😂 |
It's already been year I posted this issue and I think this issue could be solved by updating recent version of pnpm 😄 |
@baeharam "recent"as in latest 7, or 8? |
pnpm version: 6.32.9
Code to reproduce the issue:
I tried to reproduce error using CRA, but couldn't figure out exact condition 😢
Expected behavior:
ESLint plugins don't conflict
Actual behavior:
The reason why I posted this issue on pnpm is that eslint didn't conflict when we were using npm. This error was occurred migrating from npm to pnpm. I tried lots of experiments.
node_modules
and install from scratch -> FailedFrom this situation, I cannot no longer guess what is the real problem? I think installation mechanism of pnpm is related to this issue. Is there other reason that you think? Thanks for your reading.
The text was updated successfully, but these errors were encountered: