I have a React app inside a monolith npm component package. The React app serves as a demo site which consumes this component package as an integration step over and above Storybook.
local-component-package
├── .storybook
├── demos
│ └── react
│ ├── node_modules
│ └── package.json
├── node_modules
├── src
├── .eslintignore
├── .eslintrc.json
└── package.json
The component library (parent directory) has ESLint enabled while the demo app does not.
When I build and run my React demo app, I see the appropriate page being served. The moment I make a change and the page gets hot reloaded then I get the following error:
Plugin "react" was conflicted between "../../.eslintrc.json" and "BaseConfig » /path/to/project/demos/react/node_modules/eslint-config-react-app/base.js".
It seems to be telling me that there is an npm package (eslint-config-react-app
) present in the demo app that conflicts with the base (or parent) .eslintrc.json
file but I am not sure why or how to address this.
Here is my demo app's package.json
:
"dependencies": {
"react": "~16.8.5",
"react-dom": "~16.8.5",
"react-scripts": "5.0.0",
"local-component-package": "file:../../build"
},
Note: My base component npm package uses yarn as to get the latest versions of Storybook and Webpack and the numerous necessary plugins to work well together. The demo apps I have running use npm because they simulate running production applications.
I am using VSCode and I have the ESLint extension
dbaeumer.vscode-eslint
installed. I have disabled it to eliminate that it is not causing the problem. The nodule_module specified above does appear inside the react demo app's node_modules and its config is being consumed.I have added an
.eslintignore
file and added ignorePatterns in.eslintrc.json
which also did not take effect. The linter doesn't appear to be actually linting this directory so it seems that the ignore is working but the configuration is still clashing.
What I'd like to know is:
Why is this module inside the demo React app if it is not explicitly part of the node_modules?
How do I get these configs to stop clashing?
Note: I have looked at the following questions that did not help me.
- Plugin "react" was conflicted between "package.json » eslint-config-react-app
- Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >>
- Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >>
I am using:
- macOS Monterey 12.1 (M1)
- Node v16.13.0
- npm 8.3.0
- yarn 1.22.17
Let me know if you need more information.