-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc.js
90 lines (87 loc) · 2.87 KB
/
.eslintrc.js
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
const defaultConfig = {
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
],
"rules": {
"eqeqeq": "error",
"indent": ["error", 4, { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"no-alert": "error",
"no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
"no-confusing-arrow": "error",
"no-console": ["error", {"allow": ["warn", "error"]}],
"no-implied-eval": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"prettier/prettier": "warn",
"no-new": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-throw-literal": "error", // only allow Errors to be thrown; the name is a historical artifact
"no-trailing-spaces": "error",
"no-var": "error",
"prefer-const": "error",
"yoda": "error",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/prop-types": "warn", // to become an error
"react/default-props-match-prop-types": "error",
"react/forbid-foreign-prop-types": "error",
"react/no-unused-prop-types": "error",
"react/sort-prop-types": "off",
"react/no-string-refs": "warn", // to become an error
"eol-last": ["error", "always"],
},
};
module.exports = {
...defaultConfig,
"env": {
"browser": true,
"es6": true,
},
"globals": {
"Atomics": "readonly",
"Buffer": "readonly",
"SharedArrayBuffer": "readonly",
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
},
"ecmaVersion": 2018,
"sourceType": "module",
},
"plugins": [
"react",
"prettier"
],
"settings": {
"react": {
"version": "detect",
},
},
"overrides": [
{
// enable the rule specifically for TypeScript files
"files": ["*.ts", "*.tsx"],
"extends": [
// Import the global config, because defining `extends` clears
// all rules of an override.
...defaultConfig.extends,
// Extending this sets the parser to @typescript-eslint/parser
"plugin:@typescript-eslint/recommended",
// Disabled because further configuration is required.
//"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
// We also need to re-apply the rules, because defining `extends`
// clears all rules of an override.
rules: {
...defaultConfig.rules,
"no-dupe-class-members": "off", // overloads are mistaken for dupes
},
}
]
};