1
1
import globals from 'globals'
2
2
import js from '@eslint/js'
3
- import { FlatCompat } from '@eslint/eslintrc'
4
3
import ts from 'typescript-eslint'
5
- import eslintConfigPrettier from 'eslint-config-prettier'
4
+ import pritter from 'eslint-config-prettier'
5
+ import vue from 'eslint-plugin-vue'
6
6
7
- const vue = extendVuePlugin ( 'plugin:vue/vue3-recommended' , ts . parser )
8
-
9
- /** @type { import("eslint").Linter.FlatConfig[] } */
10
7
export default [
11
8
// ignore globally
12
9
{
@@ -24,11 +21,6 @@ export default [
24
21
]
25
22
} ,
26
23
27
- js . configs . recommended ,
28
- ...ts . configs . recommended ,
29
- eslintConfigPrettier ,
30
- ...vue ,
31
-
32
24
// globals
33
25
{
34
26
// files: ['**/*.js', '**/*.ts', '**/*.vue', '**/*.json'],
@@ -45,6 +37,44 @@ export default [
45
37
}
46
38
} ,
47
39
40
+ js . configs . recommended ,
41
+
42
+ //...ts.configs.recommended,
43
+ ...ts . configs . recommendedTypeChecked ,
44
+ {
45
+ files : [ '**/*.ts' , '**/*.tsx' , '**/*.cts' , '**/*.mts' , '**/*.vue' ] ,
46
+ languageOptions : {
47
+ parserOptions : {
48
+ project : true ,
49
+ tsconfigRootDir : import . meta. dirname ,
50
+ parser : ts . parser ,
51
+ extraFileExtensions : [ '.vue' ]
52
+ }
53
+ } ,
54
+ rules : {
55
+ '@typescript-eslint/no-unsafe-member-access' : 'off' ,
56
+ '@typescript-eslint/no-unsafe-assignment' : 'off' ,
57
+ '@typescript-eslint/no-unsafe-call' : 'off' ,
58
+ '@typescript-eslint/no-unsafe-argument' : 'off' ,
59
+ '@typescript-eslint/no-unsafe-return' : 'off' ,
60
+ '@typescript-eslint/no-unsafe-enum-comparison' : 'off' ,
61
+ '@typescript-eslint/no-unnecessary-type-assertion' : 'off' ,
62
+ '@typescript-eslint/unbound-method' : 'off' ,
63
+ '@typescript-eslint/no-implied-eval' : 'off' ,
64
+ '@typescript-eslint/no-redundant-type-constituents' : 'off' ,
65
+ '@typescript-eslint/restrict-template-expressions' : 'off' ,
66
+ '@typescript-eslint/no-base-to-string' : 'off'
67
+ }
68
+ } ,
69
+ {
70
+ files : [ '**/*.js' , '**/*.cjs' , '**/*.mjs' ] ,
71
+ ...ts . configs . disableTypeChecked
72
+ } ,
73
+
74
+ ...vue . configs [ 'flat/recommended' ] ,
75
+
76
+ pritter ,
77
+
48
78
// custom rules
49
79
{
50
80
rules : {
@@ -64,34 +94,3 @@ export default [
64
94
}
65
95
}
66
96
]
67
-
68
- /**
69
- * extend eslint-plugin-vue with @typescript-eslint/parser
70
- * (NOTE: eslint-plugin-vue flat config WIP currently https://github.com/vuejs/eslint-plugin-vue/issues/1291)
71
- *
72
- * @param { 'plugin:vue/vue3-essential' | 'plugin:vue/vue3-strongly-recommended' | 'plugin:vue/vue3-recommended' } vueConfigPattern
73
- * @param { import("typescript-eslint").Config.parser } tsParser
74
- *
75
- * @return { import("eslint").Linter.FlatConfig[] }
76
- */
77
- function extendVuePlugin ( vueConfigPattern , tsParser ) {
78
- const compat = new FlatCompat ( )
79
- const vuePlugin = compat . extends ( vueConfigPattern )
80
- const vueLangOptions = vuePlugin [ 2 ]
81
- vueLangOptions . files = [
82
- '**/*.vue' ,
83
- '**/*.ts' ,
84
- '**/*.tsx' ,
85
- '**/*.mts' ,
86
- '**/*.cts'
87
- ]
88
- vueLangOptions . languageOptions = {
89
- // NOTE:
90
- // https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
91
- parserOptions : {
92
- parser : tsParser
93
- } ,
94
- ecmaVersion : 'latest'
95
- }
96
- return vuePlugin
97
- }
0 commit comments