forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
137 lines (133 loc) · 4.2 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
module.exports = {
root: true,
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
// ES6 syntax
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
modules: true,
},
// 'project': './tsconfig.json'
},
plugins: [
'@typescript-eslint',
// 'jsdoc',
// 'prettier',
],
rules: {
'quote-props': ['error', 'as-needed'],
// 'prettier/prettier': 'warn',
'keyword-spacing': ['warn', {
before: true,
after: true,
}],
camelcase: ['warn', {
properties: 'always',
}],
indent: ['error', 4, { SwitchCase: 1, CallExpression: { arguments: 'off' }, ArrayExpression: 'first' }],
// 'no-else-return': 'error',
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'semi-spacing': ['error', {
before: false,
after: true,
}],
'rest-spread-spacing': ['error', 'never'],
'space-in-parens': ['error', 'never'],
curly: 'error',
semi: ['error', 'always'],
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'no-whitespace-before-property': 'error',
'no-tabs': ['error', { allowIndentationTabs: true }],
'no-unused-vars': ['warn', 'all'],
'no-empty': ['error', { allowEmptyCatch: true }],
'consistent-return': ['warn', { treatUndefinedAsUnspecified: true }],
eqeqeq: ['warn', 'always'],
// 'line-comment-position': ['warn', { 'position': 'above' }],
'max-len': ['warn', {
code: 180,
}],
'no-undef': 0,
'no-constant-condition': ['warn', {
checkLoops: false,
}],
'no-inner-declarations': ['warn'],
'no-case-declarations': ['warn'],
// 'jsdoc/check-alignment': 1,
// 'jsdoc/check-param-names': 1,
// 'jsdoc/check-tag-names': 1,
// 'jsdoc/check-types': 1,
// 'jsdoc/implements-on-classes': 1,
// 'jsdoc/newline-after-description': 1,
// 'jsdoc/no-undefined-types': 1,
// 'jsdoc/require-jsdoc': 1,
// 'jsdoc/require-param': 1,
// 'jsdoc/require-param-description': 1,
// 'jsdoc/require-param-name': 1,
// 'jsdoc/require-param-type': 1,
// 'jsdoc/require-returns': 1,
// 'jsdoc/require-returns-check': 1,
// 'jsdoc/require-returns-description': 1,
// 'jsdoc/require-returns-type': 1,
// 'jsdoc/valid-types': 1,
// 行尾逗号
'comma-style': ['error', 'last'],
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'only-multiline',
}],
'comma-spacing': ['error', {
before: false,
after: true,
}],
// 空格、空行约定
'unicode-bom': ['warn', 'never'],
'block-spacing': ['error', 'always'],
'arrow-spacing': ['error', {
before: true,
after: true,
}],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'space-before-blocks': ['error', 'always'],
'space-infix-ops': ['warn'],
'space-unary-ops': ['warn', {
words: true,
nonwords: false,
}],
'spaced-comment': ['warn', 'always', {
line: {
markers: ['/'],
exceptions: ['/', '*'],
},
},
],
'switch-colon-spacing': ['warn', {
before: false,
after: true,
}],
'eol-last': ['error', 'always'],
'no-trailing-spaces': ['error', { ignoreComments: true }],
},
};