forked from atlassian/react-beautiful-dnd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc
117 lines (97 loc) · 4.33 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
"extends": "airbnb",
"parser": "babel-eslint",
"plugins": [
"react",
"jest",
"flowtype"
],
"env": {
"es6": true,
"browser": true,
"node": true,
"jest/globals": true
},
"globals": {
"TimeoutID": true,
"IntervalID": true,
"AnimationFrameID": true
},
// custom rules
"rules": {
// http://eslint.org/docs/rules/comma-dangle
// Custom rules for when trailing comma's are required
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
// When importing files you do not need to add file extensions for the following extensions
"import/extensions": ["error", "always", {
"js": "never",
"jsx": "never"
}],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
// Allowing importing from dev deps (for stories and tests)
"import/no-extraneous-dependencies": "off",
// http://eslint.org/docs/rules/no-plusplus
// Allowing ++ on numbers
"no-plusplus": "off",
// http://eslint.org/docs/rules/no-param-reassign
// Cannot reassign function parameters but allowing modification
"no-param-reassign": ["error", { "props": false }],
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
// Allowing jsx in files with any file extension (old components have jsx but not the extension)
"react/jsx-filename-extension": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
// JSX props must be in alphabetical order
// Disabled as this is creating too much noise in logs and is not being actively addressed
"react/jsx-sort-props": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
// This was turned off for wc - but should be re-enabled eventually
"react/no-unknown-property": ["off"],
// http://eslint.org/docs/rules/no-multiple-empty-lines
// Disallow more than 1 empty lines
"no-multiple-empty-lines": ["error", { "max": 1 }],
// http://eslint.org/docs/rules/padded-blocks
// Enforce no padding within blocks
"padded-blocks": ["error", "never"],
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
// Adding 'skipShapeProps' as the rule has issues with correctly handling PropTypes.shape
"react/no-unused-prop-types": ["error", { "skipShapeProps": true }],
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
// Opt out of preferring stateless functions
// Rationale: https://extranet.atlassian.com/display/AtlasKit/React+component+conventions
"react/prefer-stateless-function": "off",
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
// default props not required for optional values
"react/require-default-props": "off",
// Disallowing the use of variables starting with `_` unless it called on `this`.
// Allowed: `this._secret = Symbol()`
// Not allowed: `const _secret = Symbol()`
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
// Allowing warning and error console logging
"no-console": ["error", { "allow": ["warn", "error"] }],
// All blocks must be wrapped in curly braces {}
// Preventing if(condition) return;
// https://eslint.org/docs/rules/curly
"curly": ["error", "all"],
// Allowing Math.pow rather than forcing `**`
// https://eslint.org/docs/rules/no-restricted-properties
"no-restricted-properties": ["off", {
"object": "Math",
"property": "pow"
}],
// Opting out of prefer destructuring (nicer with flow in lots of cases)
"prefer-destructuring": "off",
// Opting out of specific object styles for now
"object-curly-newline": "off",
// Opting out of specific paren styles for now
"function-paren-newline": "off",
// Require // @flow at the top of files
"flowtype/require-valid-file-annotation": ["error", "always", { "annotationStyle": "line" }]
}
}