-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
95 lines (94 loc) · 3.3 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
91
92
93
94
95
module.exports = {
extends: "erb",
rules: {
// A temporary hack related to IDE not resolving correct package.json
"import/no-extraneous-dependencies": "off",
"class-methods-use-this": "warn",
"no-restricted-syntax": [
// Copied from $ eslint --print-config file.js
"error",
{
selector: "ForInStatement",
message:
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
},
// {
// selector: 'ForOfStatement',
// message:
// 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
// },
{
selector: "LabeledStatement",
message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
},
{
selector: "WithStatement",
message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
},
],
"import/prefer-default-export": "off",
"@typescript-eslint/lines-between-class-members": "warn",
"@typescript-eslint/no-inferrable-types": "warn",
// ShellPiper eslint adjustments
yoda: ["warn", "never", { exceptRange: true }],
"no-underscore-dangle": ["error", { allowAfterThis: true }],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
"no-extend-native": "off", // Extending the lame native prototype is highly encouraged
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
"react/jsx-props-no-spreading": "off",
"react/jsx-no-duplicate-props": ["error", { ignoreCase: false }],
"no-alert": "off",
"no-multi-assign": ["warn", { ignoreNonDeclaration: true }],
"prefer-destructuring": [
"warn",
{
array: false,
object: true,
},
{
enforceForRenamedProperties: false,
},
],
"@typescript-eslint/naming-convention": [
"warn",
{
// Enforce that boolean variables are prefixed with an allowed verb
selector: "variable",
types: ["boolean"],
format: ["PascalCase"],
prefix: ["is", "should", "has", "can", "did", "will"],
},
{
// Allow underscore for parameters (indicates unused)
selector: "parameter",
format: ["camelCase"],
leadingUnderscore: "allow",
},
],
"prettier/prettier": "warn",
"import/no-cycle": "warn",
"@typescript-eslint/no-explicit-any": "off",
"no-console": ["warn", { allow: ["warn", "error"] }],
"spaced-comment": "warn",
},
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
settings: {
"import/resolver": {
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
node: {},
webpack: {
config: require.resolve("./.erb/configs/webpack.config.eslint.js"),
},
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
},
};