1- import eslint from '@eslint/js' ;
2- import tseslint from 'typescript-eslint' ;
3- import eslintConfigPrettier from 'eslint-config-prettier' ;
1+ import configPrettier from '@vue/eslint-config-prettier' ;
2+ import { defineConfigWithVueTs , vueTsConfigs } from '@vue/eslint-config-typescript' ;
43
54import pluginImport from 'eslint-plugin-import' ;
6- import pluginTsdoc from 'eslint-plugin-tsdoc' ;
7- //import pluginVue from 'eslint-plugin-vue';
5+ import pluginVue from 'eslint-plugin-vue' ;
6+ import pluginVueA11y from 'eslint-plugin-vuejs-accessibility' ;
7+
8+ // To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
9+ // import { configureVueProject } from '@vue/eslint-config-typescript'
10+ // configureVueProject({ scriptLangs: ['ts', 'tsx'] })
11+ // More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
12+
813/**
914 * ESLint Config
1015 */
11- // @ts -check
12- export default tseslint . config (
16+ export default defineConfigWithVueTs (
17+ {
18+ name : 'app/files-to-lint' ,
19+ files : [ '**/*.{ts,mts,tsx,vue}' ]
20+ } ,
1321 {
22+ name : 'app/files-to-ignore' ,
1423 ignores : [
1524 '.vscode/' ,
1625 '.yarn/' ,
17- 'dist/' ,
18- 'docs/' ,
19- 'public/' ,
20- 'src/** /*.generated.*' ,
26+ '**/dist/**' ,
27+ '**/dist-ssr/**' ,
28+ '**/coverage/**' ,
2129 'eslint.config.js' ,
22- ] ,
30+ 'pnpm-lock.yaml' ,
31+ 'playwright-report' ,
32+ 'test-results' ,
33+ 'public/' ,
34+ 'src/**/*.generated.*'
35+ ]
2336 } ,
24- eslint . configs . recommended ,
25- ...tseslint . configs . recommended ,
26- ... tseslint . configs . stylistic ,
37+ pluginVue . configs [ 'flat/ recommended' ] ,
38+ ...pluginVueA11y . configs [ 'flat/ recommended' ] ,
39+ vueTsConfigs . recommended ,
2740 {
28- languageOptions : {
29- parserOptions : {
30- project : [
31- 'tsconfig.app.json' ,
32- 'tsconfig.node.json' ,
33- 'tsconfig.docs.json' ,
34- ] ,
35- tsconfigRootDir : import . meta. dirname ,
36- extraFileExtensions : [ '.vue' ] ,
37- ecmaVersion : 'latest' ,
38- sourceType : 'module' ,
39- } ,
40- } ,
4141 plugins : {
42- import : pluginImport ,
43- tsdoc : pluginTsdoc ,
44- //vue: pluginVue,
42+ import : pluginImport
4543 } ,
44+
4645 settings : {
4746 // This will do the trick
4847 'import/parsers' : {
4948 espree : [ '.js' , '.cjs' , '.mjs' , '.jsx' ] ,
5049 '@typescript-eslint/parser' : [ '.ts' , '.tsx' ] ,
51- 'vue-eslint-parser' : [ '.vue' ] ,
50+ 'vue-eslint-parser' : [ '.vue' ]
5251 } ,
5352 'import/resolver' : {
5453 typescript : true ,
5554 node : true ,
56- alias : {
57- map : [
58- [ '@' , './src' ] ,
59- [ '~' , './node_modules' ] ,
60- [ 'vue-codemirror6' , './src' ] ,
61- ] ,
62- extensions : [ '.js' , '.ts' , '.jsx' , '.tsx' , '.vue' ] ,
63- } ,
55+ 'eslint-import-resolver-custom-alias' : {
56+ alias : {
57+ '@' : './src' ,
58+ '~' : './node_modules'
59+ } ,
60+ extensions : [ '.js' , '.ts' , '.jsx' , '.tsx' , '.vue' ]
61+ }
6462 } ,
6563 vite : {
66- configPath : './vite.config.ts' ,
67- } ,
64+ configPath : './vite.config.ts'
65+ }
6866 } ,
6967 rules : {
70- '@typescript-eslint/consistent-type-imports' : 'error' ,
71- '@typescript-eslint/no-import-type-side-effects' : 'error' ,
7268 // ...importPlugin.configs["recommended"].rules,
7369 'no-unused-vars' : 'warn' ,
7470 // const lines: string[] = []; style
7571 '@typescript-eslint/array-type' : [
7672 'error' ,
7773 {
78- default : 'array' ,
79- } ,
74+ default : 'array'
75+ }
8076 ] ,
8177 // Enable @ts -ignore etc.
8278 '@typescript-eslint/ban-ts-comment' : 'off' ,
8379 // Left-hand side style
84- '@typescript-eslint/consistent-generic-constructors' : [
85- 'error' ,
86- 'type-annotation' ,
87- ] ,
80+ '@typescript-eslint/consistent-generic-constructors' : [ 'error' , 'type-annotation' ] ,
8881 // Enable import sort order, see bellow.
8982 '@typescript-eslint/consistent-type-imports' : [
9083 'off' ,
9184 {
92- prefer : 'type-imports' ,
93- } ,
85+ prefer : 'type-imports'
86+ }
9487 ] ,
9588 // Fix for pinia
9689 '@typescript-eslint/explicit-function-return-type' : 'off' ,
97- // Allow short land for pretter
98- '@typescript-eslint/no-confusing-void-expression' : [
99- 'error' ,
100- {
101- ignoreArrowShorthand : true ,
102- } ,
103- ] ,
10490 '@typescript-eslint/no-explicit-any' : 'off' ,
10591 '@typescript-eslint/no-unused-vars' : 'off' ,
10692 // Fix for vite import.meta.env
@@ -116,55 +102,41 @@ export default tseslint.config(
116102 'import/order' : [
117103 'error' ,
118104 {
119- groups : [
120- 'builtin' ,
121- 'external' ,
122- 'parent' ,
123- 'sibling' ,
124- 'index' ,
125- 'object' ,
126- 'type' ,
127- ] ,
105+ groups : [ 'builtin' , 'external' , 'parent' , 'sibling' , 'index' , 'object' , 'type' ] ,
128106 pathGroups : [
129107 // Vue Core
130108 {
131109 pattern :
132- '{vue,vue-router,vuex,@/stores ,vue-i18n,pinia,vite,vitest,vitest/**,@vitejs/**,@vue/**}' ,
110+ '{vue,vue-router,vuex,@/store ,vue-i18n,pinia,vite,vitest,vitest/**,@vitejs/**,@vue/**}' ,
133111 group : 'external' ,
134- position : 'before' ,
112+ position : 'before'
135113 } ,
136114 // Internal Codes
137115 {
138116 pattern : '{@/**}' ,
139117 group : 'internal' ,
140- position : 'before' ,
141- } ,
118+ position : 'before'
119+ }
142120 ] ,
143121 pathGroupsExcludedImportTypes : [ 'builtin' ] ,
144122 alphabetize : {
145- order : 'asc' ,
123+ order : 'asc'
146124 } ,
147- 'newlines-between' : 'always' ,
148- } ,
125+ 'newlines-between' : 'always'
126+ }
149127 ] ,
150- 'tsdoc/syntax' : 'warn' ,
151- /*
152128 // A tag with no content should be written like <br />.
153129 'vue/html-self-closing' : [
154130 'error' ,
155131 {
156132 html : {
157- void: 'always',
158- },
159- },
133+ void : 'always'
134+ }
135+ }
160136 ] ,
161137 // Mitigate non-multiword component name errors to warnings.
162- 'vue/multi-word-component-names': 'warn',
163- // for Vuetify Labs Fix (v-data-tables etc.)
164- 'vuetify/no-deprecated-components': 'warn',
165- */
166- } ,
138+ 'vue/multi-word-component-names' : 'warn'
139+ }
167140 } ,
168- // ...pluginVue.configs['flat/recommended'],
169- eslintConfigPrettier
141+ configPrettier
170142) ;
0 commit comments