|
1 | 1 | /**
|
2 |
| - * Copyright (c) 2023 Coremail.cn, Ltd. All Rights Reserved. |
| 2 | + * Copyright (c) 2024 Coremail.cn, Ltd. All Rights Reserved. |
3 | 3 | */
|
4 | 4 |
|
5 |
| -import standard from 'eslint-config-standard'; |
| 5 | +import {baseRules, plugins, styleRules} from './imported.js'; |
6 | 6 | import {error, first, mergeRules, never, off} from './util.js';
|
7 | 7 |
|
8 | 8 | export default {
|
9 |
| - |
10 | 9 | languageOptions : {
|
11 | 10 | ecmaVersion : 'latest',
|
12 | 11 | parserOptions : {ecmaFeatures : {jsx : true}},
|
13 | 12 | },
|
14 | 13 |
|
15 |
| - plugins : Object.fromEntries(await Promise.all(standard.plugins.map(async key => [ |
16 |
| - key, (await import(`eslint-plugin-${key}`)).default, |
17 |
| - ]))), |
| 14 | + plugins, |
| 15 | + rules : mergeRules(baseRules, styleRules, { /* eslint-disable @stylistic/indent */// @formatter:off |
| 16 | + 'no-var' : [error], |
| 17 | + '@stylistic/no-tabs' : [error], |
| 18 | + '@stylistic/indent' : [error, 4, { |
| 19 | + SwitchCase : 0, |
| 20 | + VariableDeclarator : {var : 1, let : 1, const : 1}, |
| 21 | + ImportDeclaration : first, |
| 22 | + ArrayExpression : first, |
| 23 | + ObjectExpression : first, |
| 24 | + FunctionDeclaration : {parameters: first}, |
| 25 | + FunctionExpression : {parameters: first}, |
| 26 | + CallExpression : {arguments: 1}, |
| 27 | + MemberExpression : off, |
| 28 | + ignoreComments : true, |
| 29 | + ignoredNodes : styleRules['@stylistic/indent'][2].ignoredNodes, |
| 30 | + }], |
| 31 | + '@stylistic/semi' : [off], |
| 32 | + '@stylistic/quotes' : [error, 'single', 'avoid-escape'], |
| 33 | + '@stylistic/arrow-parens' : [error, 'as-needed'], |
| 34 | + '@stylistic/operator-linebreak' : [error, 'before'], // ternary operator should have nothing special |
| 35 | + '@stylistic/multiline-ternary' : [off], |
| 36 | + '@stylistic/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 | + '@stylistic/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 | + 'no-inner-declarations' : [off], |
| 50 | + 'default-case' : [off], |
| 51 | + 'one-var' : [off], |
| 52 | + 'dot-notation' : [off], |
| 53 | + '@stylistic/quote-props' : [off], |
| 54 | + '@stylistic/object-curly-spacing' : [off], |
| 55 | + '@stylistic/space-before-function-paren' : [error, {named: 'never', anonymous: 'ignore', asyncArrow: 'always'}], |
| 56 | + '@stylistic/generator-star-spacing' : [error, 'after'], |
| 57 | + '@stylistic/yield-star-spacing' : [error, 'after'], |
| 58 | + '@stylistic/no-multiple-empty-lines' : [off], |
| 59 | + '@stylistic/no-multi-spaces' : [error, { |
| 60 | + exceptions: {VariableDeclarator: true, ImportDeclaration: true}, |
| 61 | + ignoreEOLComments: true, |
| 62 | + }], |
| 63 | + '@stylistic/key-spacing' : [off], |
| 64 | + 'camelcase' : [error, { |
| 65 | + properties : never, |
| 66 | + ignoreDestructuring : true, |
| 67 | + ignoreGlobals : true, |
| 68 | + }], |
| 69 | + |
| 70 | + 'array-callback-return' : [off], |
| 71 | + 'no-empty' : [off], |
| 72 | + 'no-restricted-globals' : [error, { |
| 73 | + name : 'event', |
| 74 | + message : 'Use local parameter instead.', |
| 75 | + }], |
18 | 76 |
|
19 |
| - /* eslint-disable indent */// @formatter:off |
20 |
| - rules : mergeRules(standard.rules, { |
21 |
| - 'no-var' : [error], |
22 |
| - 'no-tabs' : [error], |
23 |
| - 'indent' : [error, 4, { |
24 |
| - SwitchCase : 0, |
25 |
| - VariableDeclarator : { var : 1, let : 1, const : 1 }, |
26 |
| - ImportDeclaration : first, |
27 |
| - ArrayExpression : first, |
28 |
| - ObjectExpression : first, |
29 |
| - FunctionDeclaration : {parameters: first}, |
30 |
| - FunctionExpression : {parameters: first}, |
31 |
| - CallExpression : {arguments: 1}, |
32 |
| - MemberExpression : off, |
33 |
| - ignoreComments : true, |
34 |
| - }], |
35 |
| - 'semi' : [off, never], |
36 |
| - 'quotes' : [error, 'single', 'avoid-escape'], |
37 |
| - 'arrow-parens' : [error, 'as-needed'], |
38 |
| - 'operator-linebreak' : [error, 'before'], // corrected now, ternary operator should have nothing special |
39 |
| - 'comma-dangle' : [error, { // more friendly to VCS system / manual code arrangements |
40 |
| - arrays : 'always-multiline', |
41 |
| - objects : 'always-multiline', |
42 |
| - imports : 'always-multiline', |
43 |
| - exports : 'always-multiline', |
44 |
| - functions : 'only-multiline', |
45 |
| - }], |
46 |
| - 'padded-blocks' : [off], // extra space in blocks should not be a problem |
47 |
| - 'prefer-const' : [off], |
48 |
| - 'yoda' : [off], |
49 |
| - 'no-new' : [off], |
50 |
| - 'no-void' : [off], |
51 |
| - 'no-case-declarations' : [off], |
52 |
| - 'no-inner-declarations' : [off], |
53 |
| - 'default-case' : [off], |
54 |
| - 'one-var' : [off], |
55 |
| - 'dot-notation' : [off], |
56 |
| - 'quote-props' : [off], |
57 |
| - 'object-curly-spacing' : [off], |
58 |
| - 'space-before-function-paren' : [error, {named: never, anonymous: 'ignore', asyncArrow: 'always'}], |
59 |
| - 'space-before-blocks' : [error], |
60 |
| - 'no-multiple-empty-lines' : [off], |
61 |
| - 'no-multi-spaces' : [error, { |
62 |
| - exceptions: {VariableDeclarator: true, ImportDeclaration: true}, |
63 |
| - ignoreEOLComments: true, |
64 |
| - }], |
65 |
| - 'keyword-spacing' : [error], |
66 |
| - 'key-spacing' : [off], |
67 |
| - 'comma-spacing' : [error], |
68 |
| - 'space-infix-ops' : [error], |
69 |
| - 'spaced-comment' : [error], |
70 |
| - 'eol-last' : [error], |
71 |
| - 'camelcase' : [error, { |
72 |
| - properties : never, |
73 |
| - ignoreDestructuring : true, |
74 |
| - ignoreGlobals : true, |
75 |
| - }], |
76 |
| - 'multiline-ternary' : [off], |
77 |
| - 'array-callback-return' : [off], |
78 |
| - 'no-empty' : [off], |
79 |
| - 'n/no-path-concat' : [off], |
80 |
| - 'n/no-exports-assign' : [off], |
| 77 | + 'n/no-path-concat' : [off], |
| 78 | + 'n/no-exports-assign' : [off], |
81 | 79 |
|
82 |
| - // waiting https://github.com/import-js/eslint-plugin-import/issues/2556 |
83 |
| - 'import/export' : [off], |
| 80 | + 'import/no-webpack-loader-syntax' : [off], |
84 | 81 | }),
|
85 | 82 | };
|
0 commit comments