1 | /**
|
2 | * @fileoverview Rule to disallow use of void operator.
|
3 | * @author Mike Sidorov
|
4 | */
|
5 | ;
|
6 |
|
7 | //------------------------------------------------------------------------------
|
8 | // Rule Definition
|
9 | //------------------------------------------------------------------------------
|
10 |
|
11 | module.exports = {
|
12 | meta: {
|
13 | type: "suggestion",
|
14 |
|
15 | docs: {
|
16 | description: "disallow `void` operators",
|
17 | category: "Best Practices",
|
18 | recommended: false,
|
19 | url: "https://eslint.org/docs/rules/no-void"
|
20 | },
|
21 |
|
22 | schema: []
|
23 | },
|
24 |
|
25 | create(context) {
|
26 |
|
27 | //--------------------------------------------------------------------------
|
28 | // Public
|
29 | //--------------------------------------------------------------------------
|
30 |
|
31 | return {
|
32 | UnaryExpression(node) {
|
33 | if (node.operator === "void") {
|
34 | context.report({ node, message: "Expected 'undefined' and instead saw 'void'." });
|
35 | }
|
36 | }
|
37 | };
|
38 |
|
39 | }
|
40 | };
|