简体   繁体   中英

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.

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

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 .

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