-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc
103 lines (103 loc) · 3.34 KB
/
.eslintrc
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
101
102
103
{
"extends": [
"airbnb",
"react-app",
"prettier"
],
"rules": {
// Allow jsx tags inside .js files.
"react/jsx-filename-extension": [1, {"extensions": [".js", ".jsx"]}],
// Disable props spreading (<App {...props} />) warning.
"react/jsx-props-no-spreading": 0,
// Throw warning instead of error when using array index as a key.
"react/no-array-index-key": 1,
// Enforce const `Component = (props) => {}` syntax
"react/function-component-definition": [2, { "namedComponents": "arrow-function" }],
// Allow modules with named exports only.
"import/prefer-default-export": 0,
// Force {foo: 'bar'} object literal syntax.
"object-curly-spacing": ["error", "never"],
// Throw warning instead of error. Feel free to choose your favorite option https://eslint.org/docs/rules/arrow-body-style
"arrow-body-style": ["warn", "as-needed"],
// Make prettier code formatting suggestions more verbose.
"prettier/prettier": ["warn"],
// Throw warning when <a href="#"> or <a href="javascript:void(0)"> are used. Use <button> instead.
"jsx-a11y/anchor-is-valid": ["warn", {"aspects": ["invalidHref"]}],
// Allow using (props) => <Component /> and ({propName}) => <Component /> syntax.
"react/destructuring-assignment": "off",
// Disable <Fragment> => <> replacement. Feel free to change
"react/jsx-fragments": "off",
// Below is the set of functional rules to warn developer about accidental mutations, which may cause error in reducers etc.
// No delete operator.
"fp/no-delete": "warn",
// Warning when Object.assign(a, b) used, since it mutates first argument. Object.assign({}, a, b) is ok.
"fp/no-mutating-assign": "warn",
// Warning when mutating method (pop, push, reverse, shift, sort, splice, unshift, etc) is used. Ramda and lodash/fp are allowed (_.pop, R.push)
"fp/no-mutating-methods": [
"warn",
{
"allowedObjects": ["_", "R"]
}
],
// Warning when mutating operators (++, --, etc) are used, object = {} also. `Component.propTypes`, `Component.defaultProps`, common.js (`module.exports`) and `ref.current` are ok.
"fp/no-mutation": [
"warn",
{
"commonjs": true,
"allowThis": true,
"exceptions": [
{"property": "propTypes"},
{"property": "defaultProps"},
{"property": "current"}
]
}
]
},
"plugins": ["prettier", "fp"],
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "./src"]
}
}
},
"overrides": [
{
"files": ["./*.js", "setupTests.js"],
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true,
"optionalDependencies": false,
"peerDependencies": false
}
],
"global-require": 0
}
},
{
"files": ["**/*.spec.js"],
"rules": {
"react/prop-types": "off"
}
},
{
"files": ["src/lib/**/*.js"],
"rules": {
"import/no-restricted-paths": [
"error",
{"zones": [{"target": "./src/lib", "from": "./src/environment"}]}
]
}
},
{
"files": [
"**/*.stories.*"
],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
]
}