github-pages-deploy-action/node_modules/eslint/lib/rules/no-ternary.js

42 lines
878 B
JavaScript
Raw Permalink Normal View History

2020-03-07 11:45:40 +08:00
/**
* @fileoverview Rule to flag use of ternary operators.
* @author Ian Christian Myers
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "disallow ternary operators",
category: "Stylistic Issues",
recommended: false,
url: "https://eslint.org/docs/rules/no-ternary"
},
2020-05-15 05:33:08 +08:00
schema: [],
messages: {
noTernaryOperator: "Ternary operator used."
}
2020-03-07 11:45:40 +08:00
},
create(context) {
return {
ConditionalExpression(node) {
2020-05-15 05:33:08 +08:00
context.report({ node, messageId: "noTernaryOperator" });
2020-03-07 11:45:40 +08:00
}
};
}
};