-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
55 lines (51 loc) · 1.39 KB
/
eslint.config.js
File metadata and controls
55 lines (51 loc) · 1.39 KB
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
import path from 'path'
import { fileURLToPath } from 'url'
import js from '@eslint/js'
import globals from 'globals'
import { FlatCompat } from '@eslint/eslintrc'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended
})
export default [
{
ignores: ['node_modules/**', 'coverage/**']
},
...compat.extends('standard'),
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node
}
},
rules: {
complexity: ['error', { max: 15 }],
'max-depth': ['error', { max: 4 }],
'max-lines-per-function': ['error', { max: 100, skipBlankLines: true, skipComments: true }],
'max-nested-callbacks': ['error', { max: 3 }],
'max-statements': ['error', { max: 15 }],
'no-constant-condition': ['error', { checkLoops: false }]
}
},
...compat.extends('plugin:jest/recommended').map(config => ({
...config,
files: ['**/__tests__/*'],
languageOptions: {
...(config.languageOptions ?? {}),
globals: {
...(config.languageOptions?.globals ?? {}),
...globals.jest
}
},
rules: {
...(config.rules ?? {}),
'max-lines-per-function': 'off',
'max-statements': 'off'
}
}))
]