我必须使用和扩展' Eslint-Plugin-react在Eslintrc.js config中的使用和扩展' eslint-config-airbnb'已经

发布于 2025-02-12 20:47:29 字数 1002 浏览 1 评论 0原文

我在React TypeScript项目中使用Airbnb更新了我的ESLINT规则。

我的项目不使用“ create-reac-app”。因此,我必须扩展 airbnb,因为我还使用并扩展了airbnb-typescript

ESLINT-PLUGIN-REACTEslint-Plugin-react-HooksEslint-Config-airbnb的同伴依赖性。那么,我需要扩展插件:react/推荐'吗?

我在Eslintrc.js中的扩展属性中都有这个:

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',
  ],

要从Eslint和React中获得最佳还有其他东西,或者我可以将其删除,因为我正在使用airbnbairbnb-typescript

以及我在扩展是或否'插件的问题上也有同样的问题:react-hooks/puseed'(因为eSlint-plugin-react-hooks也是<的同行依赖性<代码> Eslint-Config-airbnb ,如上所述)。

I updated my Eslint rules using airbnb in my React typescript project.

My project doesn't use 'create-reac-app'. So I have to extend airbnb since I am also using and extending airbnb-typescript.

eslint-plugin-react and eslint-plugin-react-hooks are peer dependencies of eslint-config-airbnb. So do I need to extend plugin:react/recommended'?

I have this in the extend property inside eslintrc.js:

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?

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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终弃我 2025-02-19 20:47:29

据我所知href =“ https://www.npmjs.com/package/eslint-config-airbnb#:%7e:text=OUR%20Default%20Export%20Contains%20Contains%20Most%20OF%20OF%20OF%20OF%20ESLINT%20ESLINT%20RULES%20RULES%2C%20INCLUDINGINGIMPIM20ECMASSCMASSCMASSCMASSCRAPTERCMASSCRAPT %206%2B%20和%20REACT“ rel =” nofollow noreferrer“> airbnb 。与插件相同:React-Hooks/推荐如果使用airbnb/hooks

As far as I understand you don't need to add plugin:react/recommended since you are using airbnb. Same with plugin:react-hooks/recommended if you use airbnb/hooks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文