Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no-ternary.js 793B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * @fileoverview Rule to flag use of ternary operators.
  3. * @author Ian Christian Myers
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. type: "suggestion",
  12. docs: {
  13. description: "disallow ternary operators",
  14. category: "Stylistic Issues",
  15. recommended: false,
  16. url: "https://eslint.org/docs/rules/no-ternary"
  17. },
  18. schema: []
  19. },
  20. create(context) {
  21. return {
  22. ConditionalExpression(node) {
  23. context.report({ node, message: "Ternary operator used." });
  24. }
  25. };
  26. }
  27. };