-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy patheslint.config.mjs
79 lines (78 loc) · 2.45 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
import eslint from '@eslint/js';
import importPlugin from 'eslint-plugin-import-x';
import prettierPluginRecommended from 'eslint-plugin-prettier/recommended';
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
import tsEslint from 'typescript-eslint';
export default [
eslint.configs.recommended,
...tsEslint.configs.recommendedTypeChecked,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
prettierPluginRecommended,
{
plugins: {
'unused-imports': unusedImportsPlugin,
},
languageOptions: {
ecmaVersion: 6,
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
modules: true,
},
tsconfigRootDir: '.',
projectService: true,
},
},
rules: {
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-member-accessibility': 0,
'@typescript-eslint/no-floating-promises': ['error', { ignoreIIFE: true, ignoreVoid: false }],
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/return-await': ['error', 'always'],
curly: 'error',
eqeqeq: 2,
'import-x/no-named-as-default-member': 0,
'import-x/order': [
'error',
{
'newlines-between': 'always',
alphabetize: { order: 'asc' },
},
],
'no-console': 2,
'no-return-await': 'off', // must be disabled for @typescript-eslint/return-await to work
'no-unused-expressions': 2, // no short-circuit eval, e.g. `!!x && (() => ...)`
'prettier/prettier': ['error', { singleQuote: true }],
'require-await': 'off', // must be disabled for @typescript-eslint/require-await to work
'unused-imports/no-unused-imports': 'error',
},
},
{
ignores: [
// dependencies
'node_modules',
// compiled / generated output
'dist',
'build',
'**/generated',
// test coverage output
'coverage',
// binary scripts
'bin',
],
},
{
/**
* Ignore configs and generated files
*/
files: ['*.mjs', 'dist/**'],
...tsEslint.configs.disableTypeChecked,
},
];