Files
memecoin-botV2/.pnpm-store/v10/files/33/f7da8921f9ad83d5337025f1c69903c44c214dc365af9c7a4b6b035e2097ae36bc4eacdb712efbf030ff5d287ed51280d5a5b7f86e3d373eba3f67037b61dd

47 lines
960 B
Plaintext

/**
* @fileoverview Rule to flag nested ternary expressions
* @author Ian Christian Myers
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow nested ternary expressions",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-nested-ternary",
},
schema: [],
messages: {
noNestedTernary: "Do not nest ternary expressions.",
},
},
create(context) {
return {
ConditionalExpression(node) {
if (
node.alternate.type === "ConditionalExpression" ||
node.consequent.type === "ConditionalExpression"
) {
context.report({
node,
messageId: "noNestedTernary",
});
}
},
};
},
};