简体   繁体   中英

ESLint configuration in .eslintrc is invalid: - Unexpected top-level property “import/no-extraneous-dependencies”

I was writing a code to access webcam, click a picture through my react app or browse and upload the picture from your files. For using react-html5-camera-phot and grommet I was getting these errors , Basically the error was import/no-extraneous-dependencies error.

For resolving this, I ran the suggested commands but the issue persisted and I kept getting the same error.

Therefore to remove these errors i went through stack overflow, and got a solution that suggested to post import/no-extraneous-dependencies": ["error", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false}] in my.eslintrc file. I posted this and now I am getting this error:

ESLint configuration in.eslintrc is invalid: - Unexpected top-level property "import/no-extraneous-dependencies".

I tried resolving this error too but could not find anything helpful. Please if you can tell me what I am doing wrong, itll be very helpful. Thanks in advance.

You need to put under rules object:

"rules": {
    "import/no-extraneous-dependencies": ["error",  {"devDependencies": true}],
    ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM