-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
65 lines (65 loc) · 1.89 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
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['alloy', 'alloy/react', 'alloy/typescript', 'plugin:prettier/recommended'],
plugins: ['react', '@typescript-eslint', 'prettier'],
env: {
// 你的环境变量(包含多个预定义的全局变量)
//
browser: true,
node: true,
es2021: true,
// mocha: true,
// jest: true,
// jquery: true
},
globals: {
// 你的全局变量(设置为 false 表示它不允许被重新赋值)
//
// myGlobal: false
window: true,
},
rules: {
// 自定义你的规则
'prettier/prettier': 'error',
'@typescript-eslint/ban-ts-comment': 1,
'@typescript-eslint/consistent-type-definitions': 0,
'@typescript-eslint/default-param-last': 2,
'@typescript-eslint/explicit-function-return-type': 2,
'@typescript-eslint/explicit-member-accessibility': 0,
'@typescript-eslint/lines-between-class-members': [
'warn',
'always',
{ exceptAfterOverload: true },
],
'@typescript-eslint/no-dupe-class-members': 2,
'@typescript-eslint/no-empty-function': 1,
'@typescript-eslint/no-explicit-any': 1,
'@typescript-eslint/no-unnecessary-condition': 1,
'@typescript-eslint/no-unsafe-assignment': 1,
'@typescript-eslint/no-unused-vars': 2,
'@typescript-eslint/no-use-before-define': 2,
'react/destructuring-assignment': 1,
'react/no-unstable-nested-components': 0,
'guard-for-in': 0,
'no-console': 1,
'no-nested-ternary': 1,
'prefer-const': 2,
'radix': [2, 'as-needed'],
},
overrides: [{ files: ['**/*.ts', '**/*.tsx'], rules: { 'no-undef': 'off' } }],
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true,
},
project: ['tsconfig.json'],
},
root: true,
settings: {
react: {
version: 'detect',
},
},
};