-
Notifications
You must be signed in to change notification settings - Fork 9
/
.eslintrc.yml
109 lines (92 loc) · 3.41 KB
/
.eslintrc.yml
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
env:
es2020: true
node: true
extends:
- airbnb-base
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: 12
sourceType: module
project: tsconfig.json
settings:
import/parsers:
"@typescript-eslint/parser": [".ts"]
import/resolver:
typescript:
alwaysTryTypes: true
plugins:
- "@typescript-eslint"
rules:
no-await-in-loop: off
# Code style is controlled by Prettier, not ESLint.
comma-dangle: off
curly: off
function-paren-newline: off
func-call-spacing: off
implicit-arrow-linebreak: off
indent: off
max-len: off
newline-per-chained-call: off
nonblock-statement-body-position: off
no-spaced-func: off
object-curly-newline: off
operator-linebreak: off
quotes: off
# Some rules in the preset is for JS only, we need the corresponding TS ones.
global-require: off
"@typescript-eslint/no-var-requires": error
no-empty-function: [error, { allow: [constructors] }]
no-dupe-class-members: off
"@typescript-eslint/no-dupe-class-members": error
no-unused-vars: off
"@typescript-eslint/no-unused-vars": error
no-redeclare: off
"@typescript-eslint/no-redeclare": error
no-return-await: off
"@typescript-eslint/return-await": [error, always]
no-shadow: off
"@typescript-eslint/no-shadow": error
no-useless-constructor: off
"@typescript-eslint/no-useless-constructor": error
# `any` is evil. Use `unknown` instead.
"@typescript-eslint/no-explicit-any": error
# Prefer `x => {}` to `(x) => {}` when x is the only argument.
arrow-parens: [error, as-needed]
# We organize almost everything to methods of the related classes since Nest.js's architecture.
# It's fine for some methods not using any dependency class or member variables.
class-methods-use-this: off
# Don't add the extra extensions in import filenames.
import/extensions: [error, never]
# Don't worry about import cycle as we use Nest.js DI.
import/no-cycle: off
# Use a strict order for imports and enforce newlines between them.
# But also allow manually added newlines to emphasize some special imports.
import/order:
- error
- groups: [builtin, external, internal, sibling]
pathGroupsExcludedImportTypes: []
newlines-between: always-and-inside-groups
# import/export default is harmful: https://basarat.gitbook.io/typescript/main-1/defaultisbad.
import/prefer-default-export: off
# This rule is too general. Putting related classes together helps reading the code.
max-classes-per-file: off
# `else { if/return }` and `else if/return` are different in semantics.
# "Lonely" is not a reason to change them.
no-else-return: off
no-lonely-if: off
# "x => a ? b : c" is NOT "confusing" at all
no-confusing-arrow: off
# Right use of `continue` will reduce code complexity -- they're sometimes better than too many `if`s.
no-continue: off
# This rule doesn't have a "allow at the beginning of a function" option so it's hard to use.
no-param-reassign: off
# Only language newbies will be confused by non-evil ++ and -- operators.
no-plusplus: off
# Airbnb uses it to disallow for...in, for...of, with and labels.
# But I use for...of since it's clearer than `Array.prototype.forEach()`.
no-restricted-syntax: off # Disable this ruleset
guard-for-in: error # Disallow for...in
no-with: error # Disallow with
no-labels: error # Disallow labels
# It's NO problem to use before define
no-use-before-define: off