File tree Expand file tree Collapse file tree 3 files changed +112
-0
lines changed Expand file tree Collapse file tree 3 files changed +112
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Disallow unnecessary ` await ` for sync queries (no-await-sync-query)
2
+
3
+ Please describe the origin of the rule here.
4
+
5
+
6
+ ## Rule Details
7
+
8
+ This rule aims to...
9
+
10
+ Examples of ** incorrect** code for this rule:
11
+
12
+ ``` js
13
+
14
+ // fill me in
15
+
16
+ ```
17
+
18
+ Examples of ** correct** code for this rule:
19
+
20
+ ``` js
21
+
22
+ // fill me in
23
+
24
+ ```
25
+
26
+ ### Options
27
+
28
+ If there are any options, describe them here. Otherwise, delete this section.
29
+
30
+ ## When Not To Use It
31
+
32
+ Give a short description of when it would be appropriate to turn off this rule.
33
+
34
+ ## Further Reading
35
+
36
+ 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 Disallow unnecessary `await` for sync queries
3
+ * @author Mario
4
+ */
5
+ 'use strict' ;
6
+
7
+ // ------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ // ------------------------------------------------------------------------------
10
+
11
+ module . exports = {
12
+ meta : {
13
+ docs : {
14
+ description : 'Disallow unnecessary `await` for sync queries' ,
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
+ // variables should be defined here
26
+
27
+ // ----------------------------------------------------------------------
28
+ // Helpers
29
+ // ----------------------------------------------------------------------
30
+
31
+ // any helper functions should go here or else delete this section
32
+
33
+ // ----------------------------------------------------------------------
34
+ // Public
35
+ // ----------------------------------------------------------------------
36
+
37
+ return {
38
+ // give me methods
39
+ } ;
40
+ } ,
41
+ } ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @fileoverview Disallow unnecessary `await` for sync queries
3
+ * @author Mario
4
+ */
5
+ 'use strict' ;
6
+
7
+ // ------------------------------------------------------------------------------
8
+ // Requirements
9
+ // ------------------------------------------------------------------------------
10
+
11
+ var rule = require ( '../../../lib/rules/no-await-sync-query' ) ;
12
+ var RuleTester = require ( 'eslint' ) . RuleTester ;
13
+
14
+ // ------------------------------------------------------------------------------
15
+ // Tests
16
+ // ------------------------------------------------------------------------------
17
+
18
+ var ruleTester = new RuleTester ( ) ;
19
+ ruleTester . run ( 'no-await-sync-query' , rule , {
20
+ valid : [
21
+ // give me some code that won't trigger a warning
22
+ ] ,
23
+
24
+ invalid : [
25
+ {
26
+ code : "await getByText('foo')" ,
27
+ errors : [
28
+ {
29
+ message : 'Fill me in.' ,
30
+ type : 'Me too' ,
31
+ } ,
32
+ ] ,
33
+ } ,
34
+ ] ,
35
+ } ) ;
You can’t perform that action at this time.
0 commit comments