📦 theajack / sener

📄 .eslintrc.js · 67 lines
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/*
 * @Author: chenzhongsheng
 * @Date: 2023-03-19 18:03:00
 * @Description: Coding something
 */

// ! 解决子模块中的eslint冲突问题
module.exports = {
    'parser': '@typescript-eslint/parser',

    plugins: [
        '@typescript-eslint',
    ],
    'env': {
        'node': true,
    },
    rules: {
        'no-var': 'error',
        '@typescript-eslint/consistent-type-definitions': [
            'error',
            'interface'
        ],
        '@typescript-eslint/no-unused-vars': 'error', // 使用 ts 未使用变量的规则 比如枚举类型在es中会报错
        'no-extend-native': 0,
        'no-new': 0,
        'no-useless-escape': 0,
        'no-useless-constructor': 0,
        'no-trailing-spaces': [ 'error', { 'skipBlankLines': true } ],
        'indent': [ 'error', 4, {
            'SwitchCase': 1
        } ],
        'space-infix-ops': [ 'error', { 'int32Hint': false } ],
        'space-before-function-paren': [ 'error', {
            'anonymous': 'always',
            'named': 'always',
            'asyncArrow': 'always'
        } ],
        'semi': [ 'error', 'always' ],
        'comma-dangle': 0,
        'no-console': 0,
        'no-debugger': 0,
        'id-length': 0,
        'eol-last': 0,
        'object-curly-spacing': [ 'error', 'always' ],
        'array-bracket-spacing': [ 'error', 'always' ],
        'arrow-spacing': 'error',
        'no-multiple-empty-lines': 'error',
        'no-unused-vars': 'error',
        'spaced-comment': 'error',
        'quotes': [ 'error', 'single', { 'allowTemplateLiterals': true } ],
        'no-unreachable': 'error',
        'keyword-spacing': 'error',
        'space-before-blocks': 'error',
        'semi-spacing': 'error',
        'comma-spacing': 'error',
        'key-spacing': 'error',
        'prefer-const': [ 'error', {
            'destructuring': 'any',
            'ignoreReadBeforeAssign': false
        } ],
        'space-infix-ops': 2,
        'no-irregular-whitespace': 2, // 不规则的空白不允许
        'no-trailing-spaces': 2, // 一行结束后面有空格就发出警告
        '@typescript-eslint/no-empty-function': 1,
    }
};