@@ -198,3 +198,89 @@ describe("About fixtures/crlf.vue", () => {
198198 assert ( messages . length === 0 )
199199 } )
200200} )
201+
202+ describe ( "About fixtures/typed.vue" , ( ) => {
203+ beforeEach ( ( ) => {
204+ fs . copySync ( ORIGINAL_FIXTURE_DIR , FIXTURE_DIR )
205+ } )
206+ afterEach ( ( ) => {
207+ fs . removeSync ( FIXTURE_DIR )
208+ } )
209+
210+ it ( "should notify no error with 'babel-eslint'" , ( ) => {
211+ const cli = new CLIEngine ( {
212+ cwd : FIXTURE_DIR ,
213+ envs : [ "es6" , "node" ] ,
214+ parser : PARSER_PATH ,
215+ parserOptions : {
216+ parser : "babel-eslint" ,
217+ sourceType : "module" ,
218+ } ,
219+ rules : { semi : [ "error" , "never" ] } ,
220+ useEslintrc : false ,
221+ } )
222+ const report = cli . executeOnFiles ( [ "typed.vue" ] )
223+ const messages = report . results [ 0 ] . messages
224+
225+ assert ( messages . length === 0 )
226+ } )
227+
228+ it ( "should notify no error with 'typescript-eslint-parser'" , ( ) => {
229+ const cli = new CLIEngine ( {
230+ cwd : FIXTURE_DIR ,
231+ envs : [ "es6" , "node" ] ,
232+ parser : PARSER_PATH ,
233+ parserOptions : {
234+ parser : "typescript-eslint-parser" ,
235+ sourceType : "module" ,
236+ } ,
237+ rules : { semi : [ "error" , "never" ] } ,
238+ useEslintrc : false ,
239+ } )
240+ const report = cli . executeOnFiles ( [ "typed.vue" ] )
241+ const messages = report . results [ 0 ] . messages
242+
243+ assert ( messages . length === 0 )
244+ } )
245+
246+ it ( "should fix 'semi' errors with --fix option with 'babel-eslint'" , ( ) => {
247+ const cli = new CLIEngine ( {
248+ cwd : FIXTURE_DIR ,
249+ envs : [ "es6" , "node" ] ,
250+ fix : true ,
251+ parser : PARSER_PATH ,
252+ parserOptions : {
253+ parser : "babel-eslint" ,
254+ sourceType : "module" ,
255+ } ,
256+ rules : { semi : [ "error" , "always" ] } ,
257+ useEslintrc : false ,
258+ } )
259+ CLIEngine . outputFixes ( cli . executeOnFiles ( [ "typed.vue" ] ) )
260+
261+ const actual = fs . readFileSync ( path . join ( FIXTURE_DIR , "typed.vue" ) , "utf8" )
262+ const expected = fs . readFileSync ( path . join ( FIXTURE_DIR , "typed.vue.fixed" ) , "utf8" )
263+
264+ assert ( actual === expected )
265+ } )
266+
267+ it ( "should fix 'semi' errors with --fix option with 'typescript-eslint-parser'" , ( ) => {
268+ const cli = new CLIEngine ( {
269+ cwd : FIXTURE_DIR ,
270+ envs : [ "es6" , "node" ] ,
271+ fix : true ,
272+ parser : PARSER_PATH ,
273+ parserOptions : { //
274+ parser : "typescript-eslint-parser" ,
275+ } ,
276+ rules : { semi : [ "error" , "always" ] } ,
277+ useEslintrc : false ,
278+ } )
279+ CLIEngine . outputFixes ( cli . executeOnFiles ( [ "typed.vue" ] ) )
280+
281+ const actual = fs . readFileSync ( path . join ( FIXTURE_DIR , "typed.vue" ) , "utf8" )
282+ const expected = fs . readFileSync ( path . join ( FIXTURE_DIR , "typed.vue.fixed" ) , "utf8" )
283+
284+ assert ( actual === expected )
285+ } )
286+ } )
0 commit comments