-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
98 lines (92 loc) · 3.16 KB
/
eslint.config.mjs
File metadata and controls
98 lines (92 loc) · 3.16 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
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
// @ts-check
import eslint from '@eslint/js';
import jestPlugin from 'eslint-plugin-jest';
import tseslint from 'typescript-eslint';
/** Custom rules go here */
const customRules = {
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/restrict-template-expressions': 'warn',
};
function buildLanguageOptions(tsconfig) {
return {
parserOptions: {
project: tsconfig,
tsconfigRootDir: import.meta.dirname,
},
};
}
export default tseslint.config(
{
// Global ignores
ignores: [
'packages/sdk.geometry-api-sdk-v2/src/client/**',
'**/build/**',
'**/dist/**',
'**/node_modules/**',
'scripts/**',
],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylistic,
{
files: ['libs/**/*.ts'],
languageOptions: buildLanguageOptions('./tsconfig.package.json'),
rules: customRules,
},
{
files: ['services/**/*.ts'],
languageOptions: buildLanguageOptions('./tsconfig.service.json'),
rules: customRules,
},
{
// disable type-aware linting on JS files
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
},
{
// enable jest rules on test files
files: ['**/*.test.ts'],
languageOptions: buildLanguageOptions('./tsconfig.json'),
...jestPlugin.configs['flat/recommended'],
rules: {
...jestPlugin.configs['flat/recommended'].rules,
/** Jest specific settings */
'jest/expect-expect': 'off',
'jest/no-conditional-expect': 'off',
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/unbound-method': 'off',
},
}
);