-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.base.mjs
More file actions
83 lines (81 loc) · 1.82 KB
/
Copy patheslint.base.mjs
File metadata and controls
83 lines (81 loc) · 1.82 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
import js from '@eslint/js';
import globals from 'globals';
import prettier from 'eslint-config-prettier';
import pluginVue from 'eslint-plugin-vue';
import tseslint from 'typescript-eslint';
import vueParser from 'vue-eslint-parser';
export function createVueTsConfig({
ignores = ['dist/**', 'coverage/**'],
rules = {},
tsconfigRootDir,
} = {}) {
return tseslint.config(
{ ignores },
{
files: ['**/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs,vue}'],
languageOptions: {
parserOptions: {
tsconfigRootDir,
},
},
},
js.configs.recommended,
...tseslint.configs.recommended,
...pluginVue.configs['flat/recommended'],
prettier,
{
files: ['**/*.{ts,vue,js}'],
languageOptions: {
parser: vueParser,
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
parser: tseslint.parser,
ecmaVersion: 'latest',
sourceType: 'module',
extraFileExtensions: ['.vue'],
tsconfigRootDir,
},
},
rules,
},
);
}
export function createTsConfig({
ignores = ['dist/**', 'coverage/**'],
rules = {},
tsconfigRootDir,
} = {}) {
return tseslint.config(
{ ignores },
{
files: ['**/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs}'],
languageOptions: {
parserOptions: {
tsconfigRootDir,
},
},
},
js.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
files: ['**/*.{ts,js}'],
languageOptions: {
parser: tseslint.parser,
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
tsconfigRootDir,
},
},
rules,
},
);
}