@@ -43,11 +43,35 @@ const cache = new Map<string, Block[]>()
43
43
44
44
export interface Options {
45
45
blocks ?: {
46
+ /**
47
+ * Create virtual files for each `<style>` block
48
+ * @default false
49
+ */
46
50
styles ?: boolean
51
+ /**
52
+ * Enable custom blocks
53
+ * Pass an string array to specify custom block types, or `true` to enable all custom blocks
54
+ * @default false
55
+ */
56
+ customBlocks ?: boolean | string [ ]
57
+ /**
58
+ * Create virtual files for each `<template>` block
59
+ * Generally not recommended, as `eslint-plugin-vue` handles it
60
+ * @default false
61
+ */
47
62
template ?: boolean
63
+ /**
64
+ * Create virtual files for each `<script>` block
65
+ * Generally not recommended, as `eslint-plugin-vue` handles it
66
+ * @default false
67
+ */
48
68
script ?: boolean
69
+ /**
70
+ * Create virtual files for each `<script setup>` block
71
+ * Generally not recommended, as `eslint-plugin-vue` handles it
72
+ * @default false
73
+ */
49
74
scriptSetup ?: boolean
50
- customBlocks ?: boolean
51
75
}
52
76
/**
53
77
* Default language for each block type
@@ -73,6 +97,7 @@ function processor(options: Options = {}): Linter.Processor {
73
97
style : 'css' ,
74
98
template : 'html' ,
75
99
script : 'js' ,
100
+ i18n : 'json' ,
76
101
...options . defaultLanguage ,
77
102
}
78
103
@@ -98,8 +123,13 @@ function processor(options: Options = {}): Linter.Processor {
98
123
99
124
if ( options . blocks ?. styles )
100
125
descriptor . styles . forEach ( style => pushBlock ( style ) )
101
- if ( options . blocks ?. customBlocks )
102
- descriptor . customBlocks . forEach ( block => pushBlock ( block ) )
126
+ if ( options . blocks ?. customBlocks ) {
127
+ descriptor . customBlocks . forEach ( ( block ) => {
128
+ if ( Array . isArray ( options . blocks ?. customBlocks ) && ! options . blocks ?. customBlocks . includes ( block . type ) )
129
+ return
130
+ pushBlock ( block )
131
+ } )
132
+ }
103
133
if ( options . blocks ?. template && descriptor . template )
104
134
pushBlock ( descriptor . template )
105
135
if ( options . blocks ?. script && descriptor . script )
0 commit comments