-
Notifications
You must be signed in to change notification settings - Fork 808
/
.eslintrc
74 lines (71 loc) · 2.6 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
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"useJSXTextNode": true
},
"plugins": [
"@typescript-eslint",
"react",
"react-hooks",
"import",
"redos-detector"
],
"extends": ["prettier", "plugin:regexp/recommended"],
"rules": {
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/type-annotation-spacing": "error",
"react/jsx-pascal-case": "error",
// "react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"import/no-default-export": "error",
"prefer-arrow-callback": "warn",
"no-sequences": "error",
"no-eval": "error",
"no-return-await": "error",
"no-shadow": "error",
"no-throw-literal": "error",
"no-extra-bind": "error",
"no-var": "error",
"prefer-const": "error",
"eqeqeq": "error",
// No direct replacement for these rules
// "no-internal-module": 1,
// "react-this-binding-issue": 1,
// "react-unused-props-and-state": 1,
// "variable-name": [1, "ban-keywords"]
"use-isnan": "error",
// Regexp
// Regexp security
"redos-detector/no-unsafe-regex": ["error", { "ignoreError": true }], // Prevent DoS regexps
"regexp/no-super-linear-move": "error",
// Auto optimize regexps
"regexp/no-non-standard-flag": "warn",
"regexp/no-control-character": "error",
"regexp/no-contradiction-with-assertion": "error",
"regexp/no-octal": "warn",
"regexp/no-standalone-backslash": "error",
"regexp/prefer-escape-replacement-dollar-char": "error",
"regexp/prefer-quantifier": "error",
"regexp/hexadecimal-escape": ["error", "always"],
"regexp/prefer-lookaround": "error",
"regexp/prefer-unicode-codepoint-escapes": "warn",
"regexp/grapheme-string-literal": "error",
"regexp/no-unused-capturing-group": [
"error",
{
"fixable": true,
"allowNamed": true
}
],
// regex perf
"regexp/prefer-question-quantifier": "off", // `(?:a|b|)` is faster than (?:a|b)?
"regexp/no-empty-alternative": "off", // see above
"regexp/require-unicode-regexp": "warn", // /u flag is faster and enables regexp strict mode
"@typescript-eslint/prefer-regexp-exec": "off",
"regexp/prefer-regexp-exec": "error" // exec is faster than match
}
}