-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.cjs
92 lines (91 loc) · 2.38 KB
/
eslint.config.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
const tsParser = require('@typescript-eslint/parser');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const jestPlugin = require('eslint-plugin-jest');
const importPlugin = require('eslint-plugin-import');
const prettierPlugin = require('eslint-plugin-prettier');
module.exports = [
{
ignores: ['dist/**', 'coverage/**', 'node_modules/**', 'build/**', 'infra/**', 'CHANGELOG.md', 'jest.config.*', 'jest.setup.*']
},
// Special config for jest.config.ts without type checking
{
files: ['jest.config.ts', 'jest.setup.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022
}
},
rules: {
'no-console': 'off',
'import/no-extraneous-dependencies': 'off'
}
},
// Main TypeScript config
{
files: ['**/*.ts'],
ignores: ['jest.config.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: ['./tsconfig.json', './tsconfig.build.json'],
ecmaVersion: 2022
}
},
plugins: {
'@typescript-eslint': tsPlugin,
jest: jestPlugin,
import: importPlugin,
prettier: prettierPlugin
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
},
'import/resolver': {
typescript: {}
}
},
rules: {
...tsPlugin.configs.recommended.rules,
...jestPlugin.configs.recommended.rules,
...importPlugin.configs.recommended.rules,
'import/no-unresolved': 'error',
'import/order': [
'warn',
{
groups: ['external', 'builtin', 'internal', 'sibling', 'parent', 'index']
}
],
'no-restricted-imports': ['error', { patterns: ['src/*'] }],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['**/*.test.ts', 'jest.config.ts', 'test/**/*.ts']
}
],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
],
'import/no-named-as-default': 'off'
}
},
{
files: ['**/*.test.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'import/namespace': 'off'
}
},
{
files: ['src/api/**/*.ts'],
rules: {
'import/no-extraneous-dependencies': 'off'
}
}
];