@@ -43,11 +43,35 @@ const cache = new Map<string, Block[]>()
4343
4444export interface Options {
4545 blocks ?: {
46+ /**
47+ * Create virtual files for each `<style>` block
48+ * @default false
49+ */
4650 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+ */
4762 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+ */
4868 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+ */
4974 scriptSetup ?: boolean
50- customBlocks ?: boolean
5175 }
5276 /**
5377 * Default language for each block type
@@ -73,6 +97,7 @@ function processor(options: Options = {}): Linter.Processor {
7397 style : 'css' ,
7498 template : 'html' ,
7599 script : 'js' ,
100+ i18n : 'json' ,
76101 ...options . defaultLanguage ,
77102 }
78103
@@ -98,8 +123,13 @@ function processor(options: Options = {}): Linter.Processor {
98123
99124 if ( options . blocks ?. styles )
100125 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+ }
103133 if ( options . blocks ?. template && descriptor . template )
104134 pushBlock ( descriptor . template )
105135 if ( options . blocks ?. script && descriptor . script )
0 commit comments