-
Notifications
You must be signed in to change notification settings - Fork 65
/
eslint.config.cjs
64 lines (61 loc) · 1.73 KB
/
eslint.config.cjs
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
const prettier_plugin = require('eslint-plugin-prettier/recommended');
const path = require('node:path');
const typescript_eslint = require('typescript-eslint');
const default_ignores_pool = ['**/.git/**/*', '**/dist/**/*', '**/node_modules/**/*', '**/uploads/**/*'];
const root_path = path.dirname(__filename);
const tsconfig_path = path.resolve(root_path, 'tsconfig.json');
/** @type {import("eslint").Linter.Config[]} */
module.exports = [
...[typescript_eslint.configs.recommendedTypeChecked[1], typescript_eslint.configs.recommendedTypeChecked[2]].map((config) => ({
...config,
languageOptions: {
parser: typescript_eslint.parser,
parserOptions: {
sourceType: 'module',
tsconfigRootDir: root_path,
project: tsconfig_path,
},
},
plugins: {
'@typescript-eslint': typescript_eslint.plugin,
},
rules: {
'no-unused-vars': 'off',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['src/*'],
message: 'No import from src!',
},
],
},
],
},
files: ['**/*.{ts,mts}'],
ignores: [...default_ignores_pool],
})),
{
...typescript_eslint.configs.stylisticTypeChecked[2],
languageOptions: {
parser: typescript_eslint.parser,
parserOptions: {
sourceType: 'module',
tsconfigRootDir: root_path,
project: tsconfig_path,
projectService: true,
},
},
plugins: {
'@typescript-eslint': typescript_eslint.plugin,
},
files: ['**/*.{ts,mts}'],
ignores: [...default_ignores_pool],
},
{
...prettier_plugin,
name: 'prettier/recommended',
ignores: [...default_ignores_pool],
},
];