-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
106 lines (104 loc) · 2.38 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
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
// @ts-check
import pluginImport from 'eslint-plugin-import';
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
// eslint-disable-next-line import/no-default-export
export default tseslint.config([
{
files: ['**/*.{ts,tsx,cts,mts,js,cjs,mjs}'],
},
{
ignores: ['**/node_modules/**', 'lib/**', 'coverage/**', 'eslint.config.mjs'],
},
js.configs.recommended,
tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
globals: { ...globals.node },
ecmaVersion: 'latest',
parserOptions: {
tsConfigRootDir: import.meta.dirname,
project: './tsconfig.dev.json',
},
},
},
// import-plugin config
{
...pluginImport.flatConfigs.recommended,
settings: {
'import/resolver': {
node: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
},
},
},
// prettier-plugin config
{
...pluginPrettierRecommended,
rules: {
'prettier/prettier': [
2,
{
arrowFunctionParenthesis: true,
singleQuote: true,
semi: true,
bracketSpacing: true,
printWidth: 100,
trailingComma: 'all',
},
{ usePrettierrc: false },
],
},
},
// Shared rules
{
rules: {
'no-console': 2,
'prefer-destructuring': 1,
'import/no-default-export': 2,
'import/no-extraneous-dependencies': 2,
'import/order': [
2,
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
},
],
'import/prefer-default-export': 0,
},
},
// Typescript rules
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'import/extensions': [
'error',
'ignorePackages',
{
'': 'never',
ts: 'never',
tsx: 'never',
},
],
'import/no-default-export': 2,
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
'@typescript-eslint/consistent-type-imports': [
2,
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-explicit-any': 2,
},
},
]);