简体   繁体   English

eslintrc 中的 ESLint 配置无效:- 意外的顶级属性“import/no-extraneous-dependencies”

[英]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.对于使用 react-html5-camera-phot 和 grommet,我遇到了这些错误,基本上错误是import/no-extraneous-dependencies错误。

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:因此,为了消除这些错误,我经历了堆栈溢出,并得到了一个解决方案,建议发布import/no-extraneous-dependencies": ["error", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false}]在 my.eslintrc 文件中。我发布了这个,现在我收到了这个错误:

ESLint configuration in.eslintrc is invalid: - Unexpected top-level property "import/no-extraneous-dependencies". .eslintrc 中的 ESLint 配置无效:- 意外的顶级属性“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:您需要根据规则 object:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:.eslintrc.js 中的 ESLint 配置无效:-意外的顶级属性“文件” - Error: ESLint configuration in .eslintrc.js is invalid: - Unexpected top-level property "files" eslint import / no-extraneous-dependencies无法解决依赖关系 - eslint import/no-extraneous-dependencies fails to resolve the depencency eslint 'html-webpack-plugin' 应该列在项目的依赖中,而不是 devDependencies 中。 (导入/无外部依赖项) - eslint 'html-webpack-plugin' should be listed in the project's dependencies, not devDependencies. (import/no-extraneous-dependencies) Webpack 2 - 代码拆分顶级依赖项 - Webpack 2 - Code splitting top-level dependencies 错误:Meteor应用程序的顶级依赖项中的未知程序包 - Error: unknown package in top-level dependencies in Meteor app 如何更改MeteorJS中的顶级程序包依赖关系? - How to change top-level package dependencies in MeteorJS? Eslint 报告依赖配置的 eslintrc 配置问题 - Eslint reporting eslintrc configuration problems for dependency configs 向节点模块中的顶级对象添加属性 - Adding a Property to the Top-level Object in a Node Module Javascript:“顶级 'this' 表达式” - Javascript: "Top-level 'this' expression" Eslint 错误,规则“导入/无循环”的配置无效 - Eslint error, configuration for rule "import/no-cycle" is invalid
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM