]> git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-ternary.js
8b2e10a34a4e5c40b1c538d0eefd90091c636bb5
[pve-eslint.git] / eslint / lib / rules / no-ternary.js
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
12 module.exports = {
13 meta: {
14 type: "suggestion",
15
16 docs: {
17 description: "disallow ternary operators",
18 recommended: false,
19 url: "https://eslint.org/docs/rules/no-ternary"
20 },
21
22 schema: [],
23
24 messages: {
25 noTernaryOperator: "Ternary operator used."
26 }
27 },
28
29 create(context) {
30
31 return {
32
33 ConditionalExpression(node) {
34 context.report({ node, messageId: "noTernaryOperator" });
35 }
36
37 };
38
39 }
40 };