UNPKG

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