-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
142 lines (142 loc) · 4.59 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
"extends": [
"airbnb",
"prettier",
"prettier/react",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": ["react", "@typescript-eslint"],
"env": {
"es6": true,
"browser": true,
"node": true
},
"settings": {
"import/resolver": {
"webpack": {
"config": "config/webpack/dev.js"
}
}
},
"rules": {
// When importing files you do not need to add file extensions for the following extensions
"import/extensions": "off",
// For absolute import
"import/no-unresolved": "off",
"import/no-duplicates": "off",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
// Allowing importing from dev deps (for stories and tests)
"import/no-extraneous-dependencies": "off",
"import/prefer-default-export": "off",
"no-case-declarations": "off",
"no-console": "off",
// Allowing ++ on numbers
"no-plusplus": "off",
// Cannot reassign function parameters but allowing modification
"no-param-reassign": [
"error",
{
"props": false
}
],
"no-shadow": 1,
// Enforce ES5 or ES6 class for React Components
"react/prefer-es6-class": [1],
// Prevent missing props validation in a React component definition
"react/prop-types": ["off"],
// Prevent missing React when using JSX
"react/react-in-jsx-scope": ["off"],
// Enforces where React component static properties should be positioned
"react/static-property-placement": ["off"],
// Enforce consistent usage of destructuring assignment of props, state, and context
"react/destructuring-assignment": ["off"],
// Allowing jsx in files with any file extension (old components have jsx but not the extension)
"react/jsx-filename-extension": "off",
// 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",
// Disallow JSX props spreading
"react/jsx-props-no-spreading": 0,
// Allow use setState in componentDidUpdate
"react/no-did-update-set-state": "off",
// This was turned off for wc - but should be re-enabled eventually
"react/no-unknown-property": ["off"],
"react/state-in-constructor": ["off"],
"no-continue": "off",
"no-nested-ternary": 1,
// Disallow more than 1 empty lines
"no-multiple-empty-lines": [
"error",
{
"max": 1
}
],
"no-unused-expressions": ["off"],
"no-unused-vars": [1, {
"args": "none"
}],
// Enforce no padding within blocks
"padded-blocks": ["error", "never"],
// Adding 'skipShapeProps' as the rule has issues with correctly handling PropTypes.shape
"react/no-unused-prop-types": [
"error",
{
"skipShapeProps": true
}
],
// Opt out of preferring stateless functions
// Rationale: https://extranet.atlassian.com/display/AtlasKit/React+component+conventions
"react/prefer-stateless-function": "off",
// default props not required for optional values
"react/require-default-props": "off",
"react/sort-comp": [1, {
"order": [
"instance-variables",
"constructor",
"lifecycle",
"everything-else",
"render"
]
}],
// 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
}
],
// All blocks must be wrapped in curly braces {}
// Preventing if(condition) return;
"curly": 0,
// Allowing Math.pow rather than forcing `**`
"no-restricted-globals": ["warn"],
"no-restricted-properties": [
"off",
{
"object": "Math",
"property": "pow"
}
],
"no-return-assign": "off",
// 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",
"jsx-a11y/anchor-is-valid": [ "error", {
"components": [ "Link" ],
"specialLink": [ "to" ]
}],
"jsx-a11y/no-redundant-roles": ["off"],
"@typescript-eslint/explicit-function-return-type": ["off"],
"@typescript-eslint/ban-ts-ignore": ["off"],
"@typescript-eslint/no-use-before-define": ["off"]
}
}