File tree 2 files changed +46
-0
lines changed
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ var chalk = require ( 'chalk' )
4
+
5
+ module . exports = {
6
+ pattern : / \b ( r o u t e r \s * ?\. \s * ?s t a r t ) \s * ?\( / ,
7
+ warning : function ( match , routerStart ) {
8
+ return {
9
+ reason : 'Starting an app with routing no longer requires a special method - the router can simply be passed to the root Vue instance as option' ,
10
+ fix : (
11
+ 'Replace ' + chalk . red ( routerStart ) + ' with ' +
12
+ chalk . green ( 'router: router' ) +
13
+ ' on your root Vue instance (see link below for details)'
14
+ ) ,
15
+ docsHash : 'router-start-deprecated'
16
+ }
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const check = createRuleChecker ( 'vue-router/router-start' )
4
+
5
+ describe ( 'Rule: router-start' , ( ) => {
6
+ it ( 'does not match an empty line' , ( ) => {
7
+ const warning = check ( '' )
8
+ expect ( warning ) . toBe ( null )
9
+ } )
10
+
11
+ it ( 'does not match "router"' , ( ) => {
12
+ const warning = check ( 'router' )
13
+ expect ( warning ) . toBe ( null )
14
+ } )
15
+
16
+ it ( 'does not match "start"' , ( ) => {
17
+ const warning = check ( 'on' )
18
+ expect ( warning ) . toBe ( null )
19
+ } )
20
+
21
+ it ( 'matches "router.start("' , ( ) => {
22
+ const warning = check ( `
23
+ router.start(
24
+ ` )
25
+ expect ( warning ) . toBeTruthy ( )
26
+ expect ( warning . fix ) . toBe ( 'Replace router.start with router: router on your root Vue instance (see link below for details)' )
27
+ } )
28
+ } )
You can’t perform that action at this time.
0 commit comments