-
-
Notifications
You must be signed in to change notification settings - Fork 220
/
react.js
60 lines (58 loc) · 1.85 KB
/
react.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* Opinionated config base for projects using react.
* @see https://github.com/belgattitude/nextjs-monorepo-example/tree/main/packages/eslint-config-bases
*/
const reactPatterns = {
files: ['*.{jsx,tsx}'],
};
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
settings: {
react: {
version: 'detect',
},
},
overrides: [
{
files: reactPatterns.files,
extends: [
// @see https://github.com/yannickcr/eslint-plugin-react
'plugin:react/recommended',
// @see https://www.npmjs.com/package/eslint-plugin-react-hooks
'plugin:react-hooks/recommended',
// @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
'plugin:jsx-a11y/recommended',
],
rules: {
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
'react/no-unknown-property': ['error', { ignore: ['css'] }],
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
'react/no-unescaped-entities': ['error', { forbid: ['>'] }],
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
// Fine-tune naming convention react typescript jsx (function components)
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md
'@typescript-eslint/naming-convention': [
'warn',
{
selector: 'variable',
format: ['camelCase', 'PascalCase'],
},
{
selector: ['function'],
format: ['camelCase', 'PascalCase'],
},
{
selector: 'parameter',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
},
],
},
},
],
};