-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
72 lines (70 loc) · 1.88 KB
/
eslint.config.mjs
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
import eslint from '@eslint/js';
import globals from 'globals';
import jsoncParser from 'jsonc-eslint-parser';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
ignores: [
'**/build/**',
'**/dist/**',
'**/node_modules/**',
'**/*.mjs',
'**/__tests__/**',
],
},
eslint.configs.recommended,
tseslint.configs.recommended,
tseslint.configs.strict,
{
plugins: {
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
globals: {
...globals.node,
},
parserOptions: {
ecmaVersion: 'latest',
},
},
rules: {
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
// Rules for better TypeScript safety
'@typescript-eslint/no-floating-promises': 'error', // Ensures Promises are handled
'@typescript-eslint/await-thenable': 'error', // Ensures `await` is only used on Promises
'@typescript-eslint/no-misused-promises': 'error', // Prevents misuse of Promises in logical expressions
'@typescript-eslint/no-explicit-any': 'warn',
},
},
{
files: ['**/*.{ts,tsx,js,jsx}'],
languageOptions: {
parserOptions: {
project: true,
projectService: true,
ecmaVersion: 'latest',
},
},
},
{
files: ['**/*.json'],
languageOptions: {
parser: jsoncParser,
},
rules: {
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
},
},
{
files: ['**/*.d.ts', '**/*.test.ts', '**/*.test.js', '**/*.spec.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
},
},
);