|
| 1 | +/** |
| 2 | + * Copyright (c) 2020 Coremail.cn, Ltd. All Rights Reserved. |
| 3 | + */ |
1 | 4 |
|
| 5 | +const error = 'error', off = 'off', first = 'first'; |
2 | 6 |
|
3 | | -extends: [standard] |
| 7 | +module.exports = { |
4 | 8 |
|
| 9 | + extends : ['standard'], |
5 | 10 |
|
6 | | -parserOptions: |
7 | | - ecmaVersion: 2018 |
| 11 | + parserOptions : { |
| 12 | + ecmaVersion : 2020, |
| 13 | + }, |
8 | 14 |
|
| 15 | + rules : { |
| 16 | + /* eslint-disable indent *//* @formatter:off */ |
9 | 17 |
|
10 | | -rules: |
11 | | - no-var : [error] |
12 | | - no-tabs : [error] |
13 | | - indent : |
14 | | - - error |
15 | | - - 4 |
16 | | - - SwitchCase : 0 |
17 | | - VariableDeclarator : { var : 1, let : 1, const : 1 } |
18 | | - ImportDeclaration : first |
19 | | - ArrayExpression : first |
20 | | - ObjectExpression : first |
21 | | - FunctionDeclaration : {parameters: first} |
22 | | - FunctionExpression : {parameters: first} |
23 | | - CallExpression : {arguments: 1} |
24 | | - MemberExpression : off |
25 | | - ignoreComments : true |
26 | | - semi : [off, never] |
27 | | - quotes : [error, single, avoid-escape] |
28 | | - arrow-parens : [error, as-needed] |
29 | | - operator-linebreak : [error, before] # corrected now, ternary operator should has nothing special |
30 | | - comma-dangle : [error, always-multiline] # more friendly to VCS system / manual code arrangements |
31 | | - padded-blocks : [off] # extra space in blocks should not be a problem |
32 | | - prefer-const : [off] |
33 | | - yoda : [off] |
34 | | - no-new : [off] |
35 | | - default-case : [off] |
36 | | - one-var : [off] |
37 | | - space-before-function-paren : [error, {named: never, anonymous: ignore, asyncArrow: always}] |
38 | | - space-before-blocks : [error] |
39 | | - no-multiple-empty-lines : [off] |
40 | | - no-multi-spaces : |
41 | | - - error |
42 | | - - exceptions: {VariableDeclarator: true, ImportDeclaration: true} |
43 | | - ignoreEOLComments: true |
44 | | - keyword-spacing : [error] |
45 | | - key-spacing : [off] |
46 | | - comma-spacing : [error] |
47 | | - space-infix-ops : [error] |
48 | | - spaced-comment : [error] |
49 | | - eol-last : [error] |
| 18 | + 'no-var' : [error], |
| 19 | + 'no-tabs' : [error], |
| 20 | + 'indent' : [error, 4, { |
| 21 | + SwitchCase : 0, |
| 22 | + VariableDeclarator : { var : 1, let : 1, const : 1 }, |
| 23 | + ImportDeclaration : first, |
| 24 | + ArrayExpression : first, |
| 25 | + ObjectExpression : first, |
| 26 | + FunctionDeclaration : {parameters: first}, |
| 27 | + FunctionExpression : {parameters: first}, |
| 28 | + CallExpression : {arguments: 1}, |
| 29 | + MemberExpression : off, |
| 30 | + ignoreComments : true, |
| 31 | + }], |
| 32 | + 'semi' : [off, 'never'], |
| 33 | + 'quotes' : [error, 'single', 'avoid-escape'], |
| 34 | + 'arrow-parens' : [error, 'as-needed'], |
| 35 | + 'operator-linebreak' : [error, 'before'], // corrected now, ternary operator should has nothing special |
| 36 | + 'comma-dangle' : [error, { // more friendly to VCS system / manual code arrangements |
| 37 | + arrays : 'always-multiline', |
| 38 | + objects : 'always-multiline', |
| 39 | + imports : 'always-multiline', |
| 40 | + exports : 'always-multiline', |
| 41 | + functions : 'only-multiline', |
| 42 | + }], |
| 43 | + 'padded-blocks' : [off], // extra space in blocks should not be a problem |
| 44 | + 'prefer-const' : [off], |
| 45 | + 'yoda' : [off], |
| 46 | + 'no-new' : [off], |
| 47 | + 'no-void' : [off], |
| 48 | + 'no-case-declarations' : [off], |
| 49 | + 'default-case' : [off], |
| 50 | + 'one-var' : [off], |
| 51 | + 'dot-notation' : [off], |
| 52 | + 'quote-props' : [off], |
| 53 | + 'object-curly-spacing' : [off], |
| 54 | + 'space-before-function-paren' : [error, {named: 'never', anonymous: 'ignore', asyncArrow: 'always'}], |
| 55 | + 'space-before-blocks' : [error], |
| 56 | + 'no-multiple-empty-lines' : [off], |
| 57 | + 'no-multi-spaces' : [error, { |
| 58 | + exceptions: {VariableDeclarator: true, ImportDeclaration: true}, |
| 59 | + ignoreEOLComments: true, |
| 60 | + }], |
| 61 | + 'keyword-spacing' : [error], |
| 62 | + 'key-spacing' : [off], |
| 63 | + 'comma-spacing' : [error], |
| 64 | + 'space-infix-ops' : [error], |
| 65 | + 'spaced-comment' : [error], |
| 66 | + 'eol-last' : [error], |
| 67 | + }, |
| 68 | +}; |
0 commit comments