1 | /**
|
2 | * @fileoverview Rule to flag use of ternary operators.
|
3 | * @author Ian Christian Myers
|
4 | */
|
5 |
|
6 | ;
|
7 |
|
8 | //------------------------------------------------------------------------------
|
9 | // Rule Definition
|
10 | //------------------------------------------------------------------------------
|
11 |
|
12 | module.exports = {
|
13 | meta: {
|
14 | docs: {
|
15 | description: "disallow ternary operators",
|
16 | category: "Stylistic Issues",
|
17 | recommended: false,
|
18 | url: "https://eslint.org/docs/rules/no-ternary"
|
19 | },
|
20 |
|
21 | schema: []
|
22 | },
|
23 |
|
24 | create(context) {
|
25 |
|
26 | return {
|
27 |
|
28 | ConditionalExpression(node) {
|
29 | context.report({ node, message: "Ternary operator used." });
|
30 | }
|
31 |
|
32 | };
|
33 |
|
34 | }
|
35 | };
|