'How to find the eslint rules for react with typescript?
So I have set of rules of ESLint that I was using in react with javascript but now I am using typescript in my new project but I am not getting which rules should be used for typescript.
Set of rules while using javascript:
rules: {
'react/jsx-filename-extension': [
1,
{ extensions: [ '.js', '.jsx'] },
],
'react/jsx-props-no-spreading': 'off',
'no-use-before-define': [
'error',
{ functions: true, classes: true, variables: false },
],
'react/react-in-jsx-scope': 'off',
'no-prototype-builtins': 'off',
'react/function-component-definition': [ 2, { namedComponents: 'function-declaration', },
],
}
Set of rules while using typescript:
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".ts", ".tsx"] }],
"react/jsx-props-no-spreading": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": [
"error",
{ "functions": true, "classes": true, "variables": false }
],
"react/react-in-jsx-scope": "off",
"no-prototype-builtins": "off",
"react/function-component-definition": [
2,
{ "namedComponents": "function-declaration" }
]
}
Here while using typescript we have to first turn off the no-use-before-define then use the typescript alternative of the same that is @typescript-eslint/no-use-before-define. So what are the alternatives for other rules if any?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
