简体   繁体   English

在 ESLint 上禁用所有与 React 相关的 lint 警告

[英]Disabling all React related lint warnings on ESLint

I am working on a project which uses JSX without React.我正在开发一个使用 JSX 而没有 React 的项目。 ESLint thinks I am using React because of JSX, how can I disable all React related linter warnings?由于 JSX,ESLint 认为我正在使用 React,如何禁用所有与 React 相关的 linter 警告?

For example, I am having these warnings:例如,我收到以下警告:

Standard: error
Missing "key" prop for element in iterator (react/jsx-key)

Standard: error
Empty components are self-closing (react/self-closing-comp)

Is there a way I can disable all the warnings that start with react ?有没有办法可以禁用所有以react开头的警告?

Thank you.谢谢你。

Look into eslint documentaion ESLint official docs , the only way you can disable react/*** rules is by creating .eslintrc file and disabling the rules explicitly.查看 eslint 文档ESLint 官方文档,禁用react/***规则的唯一方法是创建.eslintrc文件并显式禁用规则。

Another work around for it would be to remove the npm package of eslint-plugin-react which will remove the React ESLint rules totally and you won't have to explicitly disable the rules in .eslintrc file.另一种解决方法是删除eslint-plugin-react的 npm package ,这将完全删除 React ESLint 规则,您不必显式禁用.eslintrc文件中的规则。

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

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