-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
94 lines (93 loc) · 2.48 KB
/
.eslintrc.cjs
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
root: true,
env: {
browser: true,
es2022: true,
node: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
ecmaVersion: 'latest',
},
plugins: [
// Base plugins
'json',
// React
'react',
'react-hooks',
'react-perf',
'import',
// Accessibility
'jsx-a11y',
// Testing
'testing-library',
// Documentation
'markdown',
'jsdoc',
],
extends: [
// Base config
'eslint:recommended',
'plugin:json/recommended-legacy',
'prettier',
// React
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:react-perf/recommended',
'plugin:import/react',
// Accessibility
'plugin:jsx-a11y/recommended',
// Testing
'plugin:testing-library/react',
// Documentation
'plugin:markdown/recommended-legacy',
'plugin:jsdoc/recommended',
],
settings: {
react: {
version: 'detect',
},
},
rules: {
// Turning off React import in JSX as handled through transforms
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
// Force display names
// Allow unused vars if they appear before the first used argument, or start with an underscore
'no-unused-vars': ['error', { args: 'after-used', argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_' }],
'import/no-anonymous-default-export': ['error', { allowObject: true }],
'import/no-extraneous-dependencies': 'error',
'jsdoc/tag-lines': ['warn', 'never', { startLines: null }],
'jsdoc/require-returns-description': 'off',
'jsdoc/require-param-description': 'off',
curly: ['error', 'all'],
},
overrides: [
// JSX files, i.e. react components
{
files: ['**/*.jsx'],
rules: {
// Turning off params since that is documented through proptypes
'jsdoc/require-param': 'off',
// Turning off returns since since vast majority of functions in a jsx file should be React components
'jsdoc/require-returns': 'off',
},
},
// Test related files
{
files: ['**/*.test.*'],
rules: {
'react/prop-types': 'off',
'jsdoc/require-jsdoc': 'off',
'react-perf/jsx-no-new-object-as-prop': 'off',
'react-perf/jsx-no-new-array-as-prop': 'off',
'react-perf/jsx-no-new-function-as-prop': 'off',
'react-perf/jsx-no-jsx-as-prop': 'off',
},
},
],
}