-
Notifications
You must be signed in to change notification settings - Fork 14
/
eslint.config.js
59 lines (55 loc) · 1.52 KB
/
eslint.config.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
const js = require('@eslint/js');
const globals = require('globals');
const styleRules = {
quotes: ['error', 'single', { avoidEscape: true }],
'no-trailing-spaces': 'error',
indent: 'error',
'linebreak-style': ['error', 'unix'],
semi: ['error', 'always'],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'keyword-spacing': 'error',
'space-before-blocks': 'error',
'space-before-function-paren': [
'error',
{ anonymous: 'always', named: 'never' },
],
'no-mixed-spaces-and-tabs': 'error',
'comma-spacing': ['error', { before: false, after: true }],
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
};
module.exports = [
js.configs.recommended,
{
ignores: ['example/public/**']
},
{
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.node,
}
},
rules: {
'no-unused-vars': [
'error',
{ argsIgnorePattern: '^(err|req|res|next)$' },
],
'one-var': ['error', { initialized: 'never' }],
'no-var': 'error',
...styleRules,
},
},
// Unit tests
{
files: ['test/**'],
languageOptions: {
globals: {
...globals.mocha,
sinon: 'readonly',
request: 'readonly',
response: 'readonly',
expect: 'readonly'
},
},
},
];