-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
55 lines (53 loc) · 1.67 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
import pluginJs from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
// eslint-disable-next-line import/no-unresolved
import tseslint from 'typescript-eslint';
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: ['dist', '.husky', 'build'],
},
{
files: ['{bin,src}/**/*.{js,mjs,cjs,ts}'],
languageOptions: {
globals: globals.node,
sourceType: 'module',
},
rules: {
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: 'function', next: 'function' },
{ blankLine: 'always', prev: 'function', next: 'export' },
{ blankLine: 'always', prev: 'class', next: '*' },
{ blankLine: 'always', prev: 'directive', next: '*' },
{ blankLine: 'never', prev: 'directive', next: 'directive' },
],
},
plugins: {
'simple-import-sort': simpleImportSort,
},
settings: {
// require eslint-import-resolver-typescript to resolve path
'import/resolver': {
typescript: {
node: true,
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
},
},
'import/no-unresolved': [
2,
{
ignore: ['typescript-eslint'],
},
],
},
},
pluginJs.configs.recommended,
importPlugin.flatConfigs.recommended,
// For no conflict with prettier and eslint
eslintConfigPrettier,
...tseslint.configs.recommended,
];