File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-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 c a c h e \s * ?: \s * ?f a l s e \b / ,
7
+ warning : function ( match ) {
8
+ return {
9
+ reason : 'The cache option on computed properties has been deprecated, as it\'s better to simply use a method instead' ,
10
+ fix : 'Refactor the computed property into a method' ,
11
+ docsHash : 'cache-false' ,
12
+ type : 'js'
13
+ }
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const check = createRuleChecker ( 'vue/cache-false' )
4
+
5
+ describe ( 'Rule: cache-false' , ( ) => {
6
+ it ( 'does not match an empty line' , ( ) => {
7
+ const warning = check ( '' )
8
+ expect ( warning ) . toBe ( null )
9
+ } )
10
+
11
+ it ( 'does not match "cache"' , ( ) => {
12
+ const warning = check ( 'cache' )
13
+ expect ( warning ) . toBe ( null )
14
+ } )
15
+
16
+ it ( 'matches "cache: false,"' , ( ) => {
17
+ const warning = check ( `
18
+ cache: false,
19
+ ` )
20
+ expect ( warning ) . toBeTruthy ( )
21
+ expect ( warning . fix ) . toBe ( 'Refactor the computed property into a method' )
22
+ } )
23
+
24
+ it ( 'matches "cache:false,"' , ( ) => {
25
+ const warning = check ( `
26
+ cache:false,
27
+ ` )
28
+ expect ( warning ) . toBeTruthy ( )
29
+ expect ( warning . fix ) . toBe ( 'Refactor the computed property into a method' )
30
+ } )
31
+
32
+ it ( 'matches "cache: false,"' , ( ) => {
33
+ const warning = check ( `
34
+ cache : false,
35
+ ` )
36
+ expect ( warning ) . toBeTruthy ( )
37
+ expect ( warning . fix ) . toBe ( 'Refactor the computed property into a method' )
38
+ } )
39
+ } )
You can’t perform that action at this time.
0 commit comments