My project is not using create-react-app. I am upadting my Eslint. How do I add React properly to the eslintrc.js file?
Currently I have this in the extend
property:
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', ],
For example now eslint throws error:
Function component is not a function declarationeslintreact/function-component-definition)
How can I just use arrow functions for my React components etc?
"react/function-component-definition": [ 2, { namedComponents: "arrow-function", unnamedComponents: "arrow-function", }, ],
"react/function-component-definition": [ 2, { namedComponents: "arrow-function", unnamedComponents: "arrow-function", }, ],
Just add these line in your eslintrc.js file. This only allow you to add arrow function.
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.