/
index.js
113 lines (107 loc) · 4.42 KB
/
index.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
'use strict';
const globals = require('globals');
const allRules = {
'mocha/handle-done-callback': 'error',
'mocha/max-top-level-suites': 'error',
'mocha/no-async-describe': 'error',
'mocha/no-exclusive-tests': 'error',
'mocha/no-exports': 'error',
'mocha/no-global-tests': 'error',
'mocha/no-hooks': 'error',
'mocha/no-hooks-for-single-case': 'error',
'mocha/no-identical-title': 'error',
'mocha/no-mocha-arrows': 'error',
'mocha/no-nested-tests': 'error',
'mocha/no-pending-tests': 'error',
'mocha/no-return-and-callback': 'error',
'mocha/no-return-from-async': 'error',
'mocha/no-setup-in-describe': 'error',
'mocha/no-sibling-hooks': 'error',
'mocha/no-skipped-tests': 'error',
'mocha/no-synchronous-tests': 'error',
'mocha/no-top-level-hooks': 'error',
'mocha/prefer-arrow-callback': 'error',
'mocha/valid-suite-description': 'error',
'mocha/valid-test-description': 'error',
'mocha/no-empty-description': 'error',
'mocha/consistent-spacing-between-blocks': 'error'
};
const recommendedRules = {
'mocha/handle-done-callback': 'error',
'mocha/max-top-level-suites': [ 'error', { limit: 1 } ],
'mocha/no-async-describe': 'error',
'mocha/no-exclusive-tests': 'warn',
'mocha/no-exports': 'error',
'mocha/no-global-tests': 'error',
'mocha/no-hooks': 'off',
'mocha/no-hooks-for-single-case': 'off',
'mocha/no-identical-title': 'error',
'mocha/no-mocha-arrows': 'error',
'mocha/no-nested-tests': 'error',
'mocha/no-pending-tests': 'warn',
'mocha/no-return-and-callback': 'error',
'mocha/no-return-from-async': 'off',
'mocha/no-setup-in-describe': 'error',
'mocha/no-sibling-hooks': 'error',
'mocha/no-skipped-tests': 'warn',
'mocha/no-synchronous-tests': 'off',
'mocha/no-top-level-hooks': 'warn',
'mocha/prefer-arrow-callback': 'off',
'mocha/valid-suite-description': 'off',
'mocha/valid-test-description': 'off',
'mocha/no-empty-description': 'error',
'mocha/consistent-spacing-between-blocks': 'error'
};
const mod = {
rules: {
'handle-done-callback': require('./lib/rules/handle-done-callback'),
'max-top-level-suites': require('./lib/rules/max-top-level-suites'),
'no-async-describe': require('./lib/rules/no-async-describe'),
'no-exclusive-tests': require('./lib/rules/no-exclusive-tests'),
'no-exports': require('./lib/rules/no-exports'),
'no-global-tests': require('./lib/rules/no-global-tests'),
'no-hooks': require('./lib/rules/no-hooks'),
'no-hooks-for-single-case': require('./lib/rules/no-hooks-for-single-case'),
'no-identical-title': require('./lib/rules/no-identical-title'),
'no-mocha-arrows': require('./lib/rules/no-mocha-arrows'),
'no-nested-tests': require('./lib/rules/no-nested-tests'),
'no-pending-tests': require('./lib/rules/no-pending-tests'),
'no-return-and-callback': require('./lib/rules/no-return-and-callback'),
'no-return-from-async': require('./lib/rules/no-return-from-async'),
'no-setup-in-describe': require('./lib/rules/no-setup-in-describe'),
'no-sibling-hooks': require('./lib/rules/no-sibling-hooks'),
'no-skipped-tests': require('./lib/rules/no-skipped-tests'),
'no-synchronous-tests': require('./lib/rules/no-synchronous-tests'),
'no-top-level-hooks': require('./lib/rules/no-top-level-hooks'),
'prefer-arrow-callback': require('./lib/rules/prefer-arrow-callback'),
'valid-suite-description': require('./lib/rules/valid-suite-description'),
'valid-test-description': require('./lib/rules/valid-test-description'),
'no-empty-description': require('./lib/rules/no-empty-description.js'),
'consistent-spacing-between-blocks': require('./lib/rules/consistent-spacing-between-blocks.js')
},
configs: {
all: {
env: { mocha: true },
plugins: [ 'mocha' ],
rules: allRules
},
recommended: {
env: { mocha: true },
plugins: [ 'mocha' ],
rules: recommendedRules
}
}
};
mod.configs.flat = {
all: {
plugins: { mocha: mod },
languageOptions: { globals: globals.mocha },
rules: allRules
},
recommended: {
plugins: { mocha: mod },
languageOptions: { globals: globals.mocha },
rules: recommendedRules
}
};
module.exports = mod;