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