简体   繁体   English

在已经使用和扩展“eslint-config-airbnb”的同时,我是否必须在 eslintrc.js 配置中使用和“扩展”eslint-plugin-react

[英]Do I have to use and 'extend' eslint-plugin-react in eslintrc.js config while using and extending 'eslint-config-airbnb' already

I updated my Eslint rules using airbnb in my React typescript project.我在我的 React typescript 项目中使用 airbnb 更新了我的 Eslint 规则。

My project doesn't use 'create-reac-app'.我的项目不使用“create-reac-app”。 So I have to extend airbnb since I am also using and extending airbnb-typescript .所以我必须扩展airbnb因为我也在使用和扩展airbnb-typescript

eslint-plugin-react and eslint-plugin-react-hooks are peer dependencies of eslint-config-airbnb . eslint-plugin-reacteslint-plugin-react-hookseslint-config-airbnb的对等依赖。 So do I need to extend plugin:react/recommended' ?那么我需要扩展plugin:react/recommended'吗?

I have this in the extend property inside eslintrc.js:我在 eslintrc.js 的extend属性中有这个:

extends: [
    'airbnb',
    'airbnb-typescript',
    'airbnb/hooks',
    // "plugin:@typescript-eslint/recommended",
    // "plugin:@typescript-eslint/recommended-requiring-type-checking",
    // "plugin:eslint-comments/recommended",
    'plugin:react/recommended',
    'plugin:jest/recommended',
    'plugin:prettier/recommended',
  ],

To get the best out of Eslint and React, do I have to extend 'plugin:react/recommended', or something else or can I remove it since I am using airbnb and airbnb-typescript ?为了充分利用 Eslint 和 React,我是否必须扩展'plugin:react/recommended',或者我可以将其删除,因为我正在使用airbnbairbnb-typescript吗?

And the same question I have with extending yes or no 'plugin:react-hooks/recommended' (since eslint-plugin-react-hooks is also a peer dependency of eslint-config-airbnb as mentioned above).我对扩展 yes or no 'plugin:react-hooks/recommended'有同样的问题(因为eslint-plugin-react-hooks也是eslint-config-airbnb的对等依赖,如上所述)。

As far as I understand you don't need to add plugin:react/recommended since you are using airbnb .据我了解,您不需要添加plugin:react/recommended因为您使用的是airbnb Same with plugin:react-hooks/recommended if you use airbnb/hooks .plugin:react-hooks/recommended如果你使用airbnb/hooks

暂无
暂无

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

相关问题 Eslint 插件“反应”在 eslintrc.json >> eslint-config-airbnb 之间发生冲突 - Eslint Plugin "react"was conflicted between .eslintrc.json >> eslint-config-airbnb Eslint - 找不到 eslint-config-airbnb - Eslint - eslint-config-airbnb not find 在react.js中使用eslint-config-airbnb时,“ fetch”是未定义的,“ localStorage”是未定义的 - “fetch” is undefined and “localStorage” is undefined , on using eslint-config-airbnb in react.js 如何在未反应的项目中使用`eslint-config-airbnb`? - How can I use `eslint-config-airbnb` in a non-react project? 没有eslint插件反应的ESLint + Airbnb - ESLint + Airbnb without eslint-plugin-react 带有 eslint-config-airbnb 的扩展名为“.js”的文件中不允许使用 JSX - JSX not allowed in files with extension ' .js' with eslint-config-airbnb 使用eslint-config-airbnb ESLint“模块构建失败”错误 - ESLint “Module build failed” error with eslint-config-airbnb 无法使用 eslint-config-airbnb 解析依赖树 - Unable to resolve dependency tree with eslint-config-airbnb 更漂亮的 eslint:使用 'prettier' 或 'plugin:prettier/recommended' 和 React Typescript airbnb eslint 配置 - Prettier eslint: use 'prettier' or 'plugin:prettier/recommended' with React Typescript airbnb eslint config 使用 eslint-config-airbnb 后出现 Missing file extension "tsx" for "./reducer" 错误 - Missing file extension "tsx" for "./reducer" error after using eslint-config-airbnb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM