forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.yaml
93 lines (81 loc) · 3.85 KB
/
.eslintrc.yaml
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
root: true
extends:
- eslint:recommended
- airbnb-base
settings:
import/resolver:
node:
extensions:
- .js
- .jsx
- .ts
- .tsx
- .d.ts
env:
browser: true
node: true
es6: true
jest: true
globals:
cc: false
wx: false
Editor: false
rules:
# https://eslint.org/docs/rules/
# !!!!!!!!!!!!!!!!!!!!!!!!!
# BEFORE ADDING ANY RULES
# PLEASE EXPLAIN THE REASON IN THE COMMENT.
##### RECOMMENDED RULE OVERRIDES #####
global-require: off # we use dynamic requires a lot
no-await-in-loop: off # we use async/await a lot
camelcase: off # underscores may come in handy in some cases
eqeqeq: warn # important check missing from recommended
keyword-spacing: warn # we require this explicitly
no-multi-spaces: off # useful for manually align some expression across lines
prefer-rest-params: off # we need ES5 to be fast too
prefer-spread: off # we need ES5 to be fast too
space-before-function-paren: [warn, always] # we require this explicitly
radix: off # we sometimes do not need to pass a second parameter
# allow underscores, we still widely use pre-dangle naming in our naming convention
# e.g. private properties, private functions, module scope shared variables etc.
no-underscore-dangle: off
quotes: [warn, single, { allowTemplateLiterals: true }] # force single, but allow template literal
no-else-return: off # else-return is a common pattern which clearly expresses the control flow
##### AIRBNB-SPECIFIC RULE OVERRIDES #####
class-methods-use-this: off # so empty functions could work
guard-for-in: off # for-in is a efficient choice for plain objects
import/export: off # so export declare namespace could work
import/no-unresolved: off # TODO: fix internal modules
import/prefer-default-export: off # prefer named exports
import/no-extraneous-dependencies: off # we have a lot of internal modules
indent: [error, 4, {
SwitchCase: 0,
ignoredNodes: [ # https://stackoverflow.com/a/72897089
"FunctionExpression > .params[decorators.length > 0]",
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key",
]
}]
lines-between-class-members: off # be more lenient on member declarations
max-classes-per-file: off # helper classes are common
max-len: [warn, 150] # more lenient on max length per line
no-console: off # prefer the uniform logging methods
no-plusplus: off # allow increment/decrement operators
no-continue: off # allow unlabeled continues
no-mixed-operators: off # this is just cumbersome
no-multi-assign: off # it is handy sometimes
no-nested-ternary: off # it is handy sometimes
no-param-reassign: off # the output object is passed as parameters all the time
no-restricted-syntax: off # for-in is a efficient choice for plain objects
no-return-assign: off # it is handy sometimes
no-shadow: off # TODO: this throws false-positives?
no-sequences: off # it is handy sometimes
no-bitwise: off # we use this extensively
no-use-before-define: off # just too much work
no-useless-constructor: off # gives false-positives for empty constructor with parameter properties
object-curly-newline: off # we want manual control over this
one-var-declaration-per-line: off # auto-fix has order issues with `one-var`
prefer-destructuring: off # auto-fix is not smart enough to merge different instances
linebreak-style: off # we don't enforce this on everyone's dev environment for now
spaced-comment: off # for license declarations
default-case-last: off # Place default case clause to first make it more clear that this switch statement has handled all cases