There are two package.json files in my project
root folder
└ app ---- /public
└ /styles
└ /src
└ package.json
└ eslintrc.json
└ webpack.config.js
└ server - /something
└ /something
└ package.json
└ ...etc
An error is being shown in atom editor for linting
import React from 'react';
// 'react' should be listed in the project's dependencies. Run 'npm i -S react' to add it (import/no-extraneous-dependencies)
In package.json
"dependencies": {
"@types/chart.js": "^2.6.8",
"@types/react": "^16.0.10",
"@types/react-dom": "^16.0.1",
"bootstrap": "^4.0.0-beta",
"chart.js": "2.6.0",
"font-awesome": "^4.7.0",
"history": "4.7.2",
"jwt-decode": "^2.2.0",
"prop-types": "^15.6.0",
"react": "^15.6.1",
"react-chartjs-2": "2.6.1",
"react-dom": "^15.6.1",
"react-router-dom": "4.2.2",
"react-transition-group": "^1.2.0",
"reactstrap": "^4.8.0",
"simple-line-icons": "^2.4.1"
},
and in eslintrc.json
module.exports = {
"extends": "airbnb",
"env": {
"browser": true,
"node": true
},
"rules": {
"no-mixed-operators": [2, { "allowSamePrecedence": true }],
"react/no-find-dom-node": 1,
"react/no-string-refs": 1,
"react/no-unused-prop-types": 1, // TODO: enable
"jsx-a11y/no-static-element-interactions": 1, // TODO: enable
"no-plusplus": 1, // TODO: enable
"no-console": 0, // TODO: enable
"no-alert": 0,
"max-len": ["error", 120],
"no-underscore-dangle": ["error", { "allow": ["_isMounted"] }],
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
},
};
I believe that eslint is recognizing the package.json in the root folder as standard. But I want it to ignore the package.json in the root folder and recognize the one in the src folder.
How can I achieve this?