Eslint cannot find module, hyphens vs slashes
In .eslintrc I have this
"extends": [
"standard",
"plugin:react/recommended",
"prettier",
"prettier/react",
"prettier/standard"
],
The first error I receive is:
Error: Cannot find module 'eslint-config-prettier/standard'
In node modules I have `node_modules/eslint-config-prettier-standard`
Note the difference between the slash and the hyphen in the rc file vs the directory.
If I remove the slash (/) in the .eslintrc and replace it with a hyphen ("prettier-standard") the issue goes away and the next issue in the queue is
Error: Cannot find module 'eslint-config-prettier/standard'
Referenced from: [obfuscated for privacy]/node_modules/eslint-config-prettier-standard/end.js
Referenced from: [obfuscated for privacy]/node_modules/eslint-config-prettier-standard/index.js
This seems like a Linux vs. macOS issue possibly - I have to be careful with edits to these files since I'm working on a shared project and the config I'm getting from Git is mostly for Mac users, though the second error is inside the library itself, which is more perplexing. I've searched quite a bit to see if there is something I can change in my yarn or npm config that would've accounted for this, but I'm not finding anything. I've done the same for eslint configs - is there an option that can be passed to Intellij in ESLint "additional rules" or "extra options" that might allow the slashes vs hyphens to be interpreted correctly?
Please sign in to leave a comment.
Does ESLint work in the terminal when using similar settings? cd to project directory and try running eslint to it, like
eslint --config path/to/config .What is a result?Does this mean it's configured to look at global packages rather than local?
This is the output of that command:
As the issue is not related to IntelliJ IDEA, it is better to ask that on a profile forum, or on StackOverflow.
A similar problem has been addressed on the project's Github:
https://github.com/standard/eslint-config-standard/issues/84#issuecomment-315129706
Right, thank you for putting me down the correct path. It seems related to recent updates to ESLint and the way it handles global/local packages... Thank you again!