-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
120 lines (97 loc) · 3.87 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
{
"extends": ["airbnb-base", "plugin:@typescript-eslint/recommended", "plugin:import/typescript"],
"plugins": ["@typescript-eslint", "prettier", "import"],
"parser": "@typescript-eslint/parser",
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
"typescript": { }
}
},
"env": {
"node": "true",
"browser": "true"
},
"rules": {
# Necessary in order to have ability to use paths in tsconfig. It will work only for aliases which start w/ "@"
# "import/no-unresolved": "off",
"import/no-unresolved": [2, { "ignore": ["^@.*"] }],
# Extra rule for us< as we have devs working on different os
"linebreak-style": ["error", "unix"],
# Allow import from files without extensions ('./SomeService' instead of './SomeService.ts')
"import/extensions": [ "error", "ignorePackages", { "ts": "never", "js": "never" }],
# Bad practice to use default export
"import/prefer-default-export": "off",
# Function return (void). Disable early returns, deeper nesting is necessary.
"consistent-return": "off",
# JS convention for naming private vars. Example: _db
"no-underscore-dangle": "off",
# If there is no this. call in method -> make it static.
"class-methods-use-this": "off",
# For objects with more than 3 params.
"object-curly-newline": "off",
# This is fine.
"lines-between-class-members": "off",
# Irrelevant
"no-plusplus": "off",
# Allow ForOfStatement
"no-restricted-syntax": [ "error", "ForInStatement", "LabeledStatement", "WithStatement" ],
# Allow continue as we decided to allow ForOfStatement
"no-continue": "off",
# Specifically to node
"no-console": "off",
# They are fine sometimes.
# "no-nested-ternary": "off",
# Up max-len to 140
"max-len": ["error", { "code": 140 }]
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"rules": {
# To allow method overloading
"no-dupe-class-members": "off",
# TS indentation
"@typescript-eslint/indent": [2, 2],
# Allow empty private constructor in order to implement Singleton pattern
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-empty-function": ["error", { "allow": ["constructors"] }],
# Ensure interfaces name start with "I"
# Was removed from `typescript-eslint`
# "@typescript-eslint/interface-name-prefix": ["error", { "prefixWithI": "always" }],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": true
}
}
],
# Ensure use of T[] for simple array annotations and Array<T> for complicated
"@typescript-eslint/array-type": ["error", {
"default" : "array-simple",
"readonly": "array-simple"
}],
# Ordering for class members. Just defaults
# "@typescript-eslint/member-ordering": ["error", { default: ["signature", "field", "constructor", "method"] }]
"@typescript-eslint/member-ordering": ["error"],
# Disable eslint rule and apply enhanced ts-eslint rule
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
# Disable eslint rule and apply enhanced ts-es-eslint rule
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
#
"@typescript-eslint/explicit-module-boundary-types": ["error", { "allowArgumentsExplicitlyTypedAsAny": true }],
# Allow imports from devDependencies for tests
"import/no-extraneous-dependencies": ["error", { "devDependencies": ["**/*.spec.ts", "**/*.spec.tsx"] }],
}
}
]
}