-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
eslint.config.js
102 lines (100 loc) · 2.46 KB
/
eslint.config.js
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
/* eslint-disable @typescript-eslint/no-require-imports */
const babelParser = require('@babel/eslint-parser');
const js = require('@eslint/js');
const prettier = require('eslint-config-prettier');
const importPlugin = require('eslint-plugin-import');
const jest = require('eslint-plugin-jest');
const jestDOM = require('eslint-plugin-jest-dom');
const simpleImportSort = require('eslint-plugin-simple-import-sort');
const globals = require('globals');
const tseslint = require('typescript-eslint');
module.exports = tseslint.config(
{
ignores: [
'.git/*',
'.nyc_output/*',
'.vscode/*',
'.yarn/*',
'.yarnrc.yml',
'coverage/*',
'dist/*',
'docs/*',
'node_modules/*',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
importPlugin.flatConfigs.recommended,
prettier,
{
files: ['**/*.{js,mjs,cjs,ts,cts,mts}'],
languageOptions: {
parser: babelParser,
globals: {
...globals.node,
...globals.es2022,
},
parserOptions: {
sourceType: 'script',
},
},
settings: {
'import/resolver': {
typescript: {},
},
'import/external-module-folders': ['node_modules'],
},
rules: {
'no-console': 1,
'no-warning-comments': ['warn', { terms: ['todo', 'fixme', '@@@'] }],
'import/first': 'warn',
'import/newline-after-import': 'warn',
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'import/order': [
'warn',
{ 'newlines-between': 'always', alphabetize: { order: 'asc' } },
],
'import/named': 'warn',
},
},
{
files: ['src/**/*.{js,mjs,cjs,ts,cts,mts}'],
languageOptions: {
parser: tseslint.parser,
globals: {
...globals.browser,
...globals.es2022,
},
parserOptions: {
sourceType: 'module',
},
},
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'import/order': 'off',
},
},
{
files: ['test/**/*.{js,ts}'],
languageOptions: {
parser: babelParser,
globals: {
...jest.environments.globals.globals,
...globals.mocha,
...globals.es2022,
},
parserOptions: {
sourceType: 'script',
},
},
plugins: {
jest,
'jest-dom': jestDOM,
'simple-import-sort': simpleImportSort,
},
},
);