-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
109 lines (106 loc) · 2.49 KB
/
.eslintrc.cjs
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
const rootdir = __dirname
const extensions = [
'.js',
'.cjs',
'.mjs',
'.ts',
'.mts',
'.cts',
'.d.ts',
'.d.mts',
'.d.cts',
]
const commonPaths = [
'node_modules',
'node_modules/@types',
'node_modules/@types/node',
]
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2022,
tsConfigRootDir: rootdir,
project: ['./tsconfig.json', './tsconfig.tests.json'],
},
plugins: [
'@typescript-eslint',
'import',
'prettier',
'promise',
'sonarjs',
'unicorn',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:node/recommended-module',
'plugin:promise/recommended',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
'prettier',
],
rules: {
'node/no-missing-import': [
'off', // For now, until TS 4.7 is released and the linter understands .mjs imports
{
resolvePaths: [
`${rootdir}/src`,
`${rootdir}/node_modules`,
`${rootdir}/node_modules/@types`,
`${rootdir}/node_modules/@types/node`,
],
tryExtensions: extensions,
},
],
'prettier/prettier': 'error',
quotes: ['error', 'single', { avoidEscape: true }],
'sort-imports': 'error',
'unicorn/filename-case': 'off',
'unicorn/prevent-abbreviations': 'off',
},
settings: {
'import/resolver': {
node: {
paths: [
'src',
'node_modules',
'node_modules/@types',
'node_modules/@types/node',
],
extensions: extensions,
},
typescript: {},
},
},
overrides: [
{
files: ['**/__tests__/**/*.test.ts'],
plugins: ['jest'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
env: {
'jest/globals': true,
},
rules: {
'jest/no-disabled-tests': 'error',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/consistent-test-it': 'error',
'jest/valid-expect': ['error', { alwaysAwait: true }],
'node/no-unpublished-import': 'off',
},
},
],
ignorePatterns: [
'bin/distiller.mjs',
'.eslintrc.cjs',
'jest.config.mjs',
'tsconfig.json',
'tsconfig.base.json',
'tsconfig.tests.json',
],
}