@@ -3,9 +3,10 @@ import * as parserTs from '@typescript-eslint/parser'
3
3
4
4
// @ts -expect-error missing types
5
5
import pluginVue from 'eslint-plugin-vue'
6
- import { FlatConfig } from '../types'
6
+ import { FlatConfig , NuxtESLintConfigOptions } from '../types'
7
+ import { removeUndefined } from '../utils'
7
8
8
- export default function vue ( ) : FlatConfig [ ] {
9
+ export default function vue ( options : NuxtESLintConfigOptions ) : FlatConfig [ ] {
9
10
return [
10
11
{
11
12
name : 'nuxt:setup-vue' ,
@@ -56,12 +57,16 @@ export default function vue(): FlatConfig[] {
56
57
} ,
57
58
// eslint-disable-next-line @typescript-eslint/no-explicit-any
58
59
processor : pluginVue . processors [ '.vue' ] as any ,
59
- rules : {
60
+ rules : removeUndefined ( {
60
61
...pluginVue . configs . base . rules ,
61
62
...pluginVue . configs [ 'vue3-essential' ] . rules ,
62
63
...pluginVue . configs [ 'vue3-strongly-recommended' ] . rules ,
63
64
...pluginVue . configs [ 'vue3-recommended' ] . rules ,
64
65
66
+ // Deprecated in favor of 'vue/block-order'
67
+ 'vue/component-tags-order' : undefined ,
68
+ 'vue/block-order' : 'warn' ,
69
+
65
70
// Include typescript eslint rules in *.vue files
66
71
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
67
72
'constructor-super' : 'off' , // ts(2335) & ts(2377)
@@ -85,7 +90,19 @@ export default function vue(): FlatConfig[] {
85
90
'prefer-rest-params' : 'error' , // ts provides better types with rest args over arguments
86
91
'prefer-spread' : 'error' , // ts transpiles spread to apply, so no need for manual apply
87
92
'valid-typeof' : 'off' , // ts(2367)
88
- } ,
93
+
94
+ ...( options . features ?. stylistic
95
+ ? { }
96
+ : {
97
+ // Disable Vue's default stylistic rules when stylistic is not enabled
98
+ 'vue/max-attributes-per-line' : undefined ,
99
+ 'vue/no-multi-spaces' : undefined ,
100
+ 'vue/no-spaces-around-equal-signs-in-attribute' : undefined ,
101
+ 'vue/html-indent' : undefined ,
102
+ 'vue/html-quotes' : undefined ,
103
+ 'vue/multiline-html-element-content-newline' : undefined ,
104
+ } ) ,
105
+ } ) ,
89
106
} ,
90
107
]
91
108
}
0 commit comments