@@ -168,6 +168,24 @@ describe("configInitializer", () => {
168168 assert . deepStrictEqual ( config . extends , [ "eslint:recommended" , "plugin:vue/essential" ] ) ;
169169 } ) ;
170170
171+ it ( "should enable typescript parser and plugin" , ( ) => {
172+ answers . typescript = true ;
173+ const config = init . processAnswers ( answers ) ;
174+
175+ assert . strictEqual ( config . parser , "@typescript-eslint/parser" ) ;
176+ assert . deepStrictEqual ( config . plugins , [ "@typescript-eslint" ] ) ;
177+ assert . deepStrictEqual ( config . extends , [ "eslint:recommended" , "plugin:@typescript-eslint/eslint-recommended" ] ) ;
178+ } ) ;
179+
180+ it ( "should enable typescript parser and plugin with vue" , ( ) => {
181+ answers . framework = "vue" ;
182+ answers . typescript = true ;
183+ const config = init . processAnswers ( answers ) ;
184+
185+ assert . strictEqual ( config . parserOptions . parser , "@typescript-eslint/parser" ) ;
186+ assert . deepStrictEqual ( config . plugins , [ "vue" , "@typescript-eslint" ] ) ;
187+ } ) ;
188+
171189 it ( "should extend eslint:recommended" , ( ) => {
172190 const config = init . processAnswers ( answers ) ;
173191
@@ -317,6 +335,28 @@ describe("configInitializer", () => {
317335 assert . include ( modules , "eslint-plugin-vue@latest" ) ;
318336 assert . include ( modules , "eslint-config-standard@latest" ) ;
319337 } ) ;
338+
339+ it ( "should support custom parser" , ( ) => {
340+ const config = {
341+ parser : "@typescript-eslint/parser"
342+ } ;
343+ const modules = init . getModulesList ( config ) ;
344+
345+ assert . include ( modules , "@typescript-eslint/parser@latest" ) ;
346+ } ) ;
347+
348+ it ( "should support custom parser with Vue.js" , ( ) => {
349+ const config = {
350+
351+ // We should declare the parser at `parserOptions` when using with `eslint-plugin-vue`.
352+ parserOptions : {
353+ parser : "@typescript-eslint/parser"
354+ }
355+ } ;
356+ const modules = init . getModulesList ( config ) ;
357+
358+ assert . include ( modules , "@typescript-eslint/parser@latest" ) ;
359+ } ) ;
320360 } ) ;
321361
322362 describe ( "auto" , ( ) => {
0 commit comments