-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslintrc.js
More file actions
100 lines (99 loc) · 2.7 KB
/
Copy patheslintrc.js
File metadata and controls
100 lines (99 loc) · 2.7 KB
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
95
96
97
98
99
100
const a11yWarn = Object.keys(require('eslint-plugin-jsx-a11y').rules).reduce(
(acc, rule) => {
acc[`jsx-a11y/${rule}`] = 'warn';
return acc;
},
{},
);
module.exports = {
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'airbnb',
'prettier',
],
plugins: ['react-hooks', 'prettier'],
rules: {
...a11yWarn,
'react/prop-types': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-filename-extension': 'off',
'react/jsx-props-no-spreading': 'off',
'react/jsx-one-expression-per-line': 'off',
'react/jsx-wrap-multilines': 'off',
'react/jsx-indent': 'off',
'react/jsx-curly-newline': 'off',
'react/static-property-placement': ['error', 'static public field'],
'react/state-in-constructor': ['error', 'never'],
'prettier/prettier': 'warn',
'import/no-cycle': 'off',
'arrow-parens': 'off',
'operator-linebreak': 'off',
indent: 'off',
'no-underscore-dangle': 'off',
'no-nested-ternary': 'warn',
'no-shadow': ['error', { allow: ['error'] }],
'no-param-reassign': [
'error',
{
// Copied from airbnb config: https://github.com/airbnb/javascript/blob/6d05dd898acfec3299cc2be8b6188be542824965/packages/eslint-config-airbnb-base/rules/best-practices.js#L190-L204
// with extra added and unnecessary removed
props: true,
ignorePropertyModificationsFor: [
'acc', // for reduce accumulators
'accumulator', // for reduce accumulators
'e', // for e.returnvalue
'req', // for Express requests
'request', // for Express requests
'res', // for Express responses
'response', // for Express responses
'staticContext', // for ReactRouter context,
'draft', // for immer draft
],
},
],
'no-magic-numbers': [
'warn',
{
ignore: [0, 1],
ignoreArrayIndexes: true,
enforceConst: true,
detectObjects: false,
},
],
},
overrides: [
{
files: ['common/components/**/*.js', 'common/containers/**/*.js'],
rules: {
'no-nested-ternary': 'off',
},
},
{
files: ['server/controllers/**/*.js', 'common/pages/**/*.js'],
rules: {
'class-methods-use-this': 'off',
},
},
{
files: ['server/models/**/*.js'],
rules: {
'no-use-before-define': ['error', { classes: false }],
},
},
],
};