Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / eslint / lib / rules / no-nested-ternary.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/rules/no-nested-ternary.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/rules/no-nested-ternary.js
new file mode 100644 (file)
index 0000000..87a11e8
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * @fileoverview Rule to flag nested ternary expressions
+ * @author Ian Christian Myers
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+    meta: {
+        type: "suggestion",
+
+        docs: {
+            description: "disallow nested ternary expressions",
+            category: "Stylistic Issues",
+            recommended: false,
+            url: "https://eslint.org/docs/rules/no-nested-ternary"
+        },
+
+        schema: []
+    },
+
+    create(context) {
+
+        return {
+            ConditionalExpression(node) {
+                if (node.alternate.type === "ConditionalExpression" ||
+                        node.consequent.type === "ConditionalExpression") {
+                    context.report({ node, message: "Do not nest ternary expressions." });
+                }
+            }
+        };
+    }
+};