This repository was archived by the owner on Mar 19, 2024. It is now read-only.
File tree 3 files changed +116
-0
lines changed
3 files changed +116
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Preventing using this in asyncData (no-this-in-async-data)
2
+
3
+ Please describe the origin of the rule here.
4
+
5
+ ## Rule Details
6
+
7
+ This rule aims to...
8
+
9
+ Examples of ** incorrect** code for this rule:
10
+
11
+ ``` js
12
+
13
+ // fill me in
14
+
15
+ ```
16
+
17
+ Examples of ** correct** code for this rule:
18
+
19
+ ``` js
20
+
21
+ // fill me in
22
+
23
+ ```
24
+
25
+ ### Options
26
+
27
+ If there are any options, describe them here. Otherwise, delete this section.
28
+
29
+ ## When Not To Use It
30
+
31
+ Give a short description of when it would be appropriate to turn off this rule.
32
+
33
+ ## Further Reading
34
+
35
+ If there are other links that describe the issue this rule addresses, please include them here in a bulleted list.
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @fileoverview Preventing using this in asyncData
3
+ * @author Clark Du
4
+ */
5
+ "use strict" ;
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ module . exports = {
12
+ meta : {
13
+ docs : {
14
+ description : "Preventing using this in asyncData" ,
15
+ category : "Fill me in" ,
16
+ recommended : false
17
+ } ,
18
+ fixable : null , // or "code" or "whitespace"
19
+ schema : [
20
+ // fill in your schema
21
+ ]
22
+ } ,
23
+
24
+ create : function ( context ) {
25
+
26
+ // variables should be defined here
27
+
28
+ //----------------------------------------------------------------------
29
+ // Helpers
30
+ //----------------------------------------------------------------------
31
+
32
+ // any helper functions should go here or else delete this section
33
+
34
+ //----------------------------------------------------------------------
35
+ // Public
36
+ //----------------------------------------------------------------------
37
+
38
+ return {
39
+
40
+ // give me methods
41
+
42
+ } ;
43
+ }
44
+ } ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @fileoverview Preventing using this in asyncData
3
+ * @author Clark Du
4
+ */
5
+ "use strict" ;
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Requirements
9
+ //------------------------------------------------------------------------------
10
+
11
+ var rule = require ( "../../../lib/rules/no-this-in-async-data" ) ,
12
+
13
+ RuleTester = require ( "eslint" ) . RuleTester ;
14
+
15
+
16
+ //------------------------------------------------------------------------------
17
+ // Tests
18
+ //------------------------------------------------------------------------------
19
+
20
+ var ruleTester = new RuleTester ( ) ;
21
+ ruleTester . run ( "no-this-in-async-data" , rule , {
22
+
23
+ valid : [
24
+
25
+ // give me some code that won't trigger a warning
26
+ ] ,
27
+
28
+ invalid : [
29
+ {
30
+ code : "this.await fetch(`/api${this.$route.path}`)" ,
31
+ errors : [ {
32
+ message : "Fill me in." ,
33
+ type : "Me too"
34
+ } ]
35
+ }
36
+ ]
37
+ } ) ;
You can’t perform that action at this time.
0 commit comments