-
-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy patheslint.config.js
More file actions
103 lines (101 loc) · 2.47 KB
/
eslint.config.js
File metadata and controls
103 lines (101 loc) · 2.47 KB
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
/* eslint-disable @typescript-eslint/no-require-imports */
const eslint = require('@eslint/js');
const vitest = require('@vitest/eslint-plugin');
const { defineConfig } = require('eslint/config');
const prettier = require('eslint-config-prettier');
const { importX } = require('eslint-plugin-import-x');
const simpleImportSort = require('eslint-plugin-simple-import-sort');
const globals = require('globals');
const tseslint = require('typescript-eslint');
module.exports = defineConfig(
{
ignores: [
'.git/*',
'.nyc_output/*',
'.vscode/*',
'.yarn/*',
'.yarnrc.yml',
'coverage/*',
'dist/*',
'docs/*',
'node_modules/*',
],
},
eslint.configs.recommended,
tseslint.configs.recommended,
importX.flatConfigs.recommended,
prettier,
{
files: ['**/*.{js,mjs,cjs,ts,cts,mts}'],
languageOptions: {
parser: tseslint.parser,
globals: {
...globals.node,
...globals.es2022,
},
parserOptions: {
sourceType: 'script',
},
},
settings: {
'import-x/resolver': {
typescript: {},
},
'import-x/external-module-folders': ['node_modules'],
},
rules: {
'no-console': 1,
'no-warning-comments': ['warn', { terms: ['todo', 'fixme', '@@@'] }],
'import-x/first': 'warn',
'import-x/newline-after-import': 'warn',
'import-x/no-duplicates': ['error', { 'prefer-inline': true }],
'import-x/order': [
'warn',
{ 'newlines-between': 'always', alphabetize: { order: 'asc' } },
],
'import-x/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-x/order': 'off',
},
},
{
files: ['test/**/*.{js,ts}'],
languageOptions: {
parser: tseslint.parser,
globals: {
...vitest.environments.env.globals,
...globals.mocha,
...globals.es2022,
},
parserOptions: {
sourceType: 'script',
},
},
plugins: {
vitest,
'simple-import-sort': simpleImportSort,
},
rules: {
...vitest.configs.recommended.rules,
},
},
);