coffeelint-prefer-english-operator-streamline

A custom CoffeeLint rule to prefer English natural language operators while allowing Streamline.js futures syntax (`!_`)

Usage no npm install needed!

<script type="module">
  import coffeelintPreferEnglishOperatorStreamline from 'https://cdn.skypack.dev/coffeelint-prefer-english-operator-streamline';
</script>

README

coffeelint-prefer-english-operator-streamline

This is a custom rule for CoffeeLint extending prefer_english_operator to allow Streamline.js futures syntax (!_).

It disallows use of symbolic operators such as ==, !=, &&, ||, and !. Instead, it recommends using is, isnt, and, or, and not instead. Double not !! is allowed by default for boolean coercion but can be disallowed via doubleNotLevel configuration.

a is a    # yes
a == a    # no

a isnt a  # yes
a != a    # no

a and b   # yes
a && b    # no

a or b    # yes
a || b    # no

!!a       # yes
not not a # yes

f !_      # yes

How to Install

  1. Run npm install --save-dev coffeelint-prefer-english-operator-streamline.

How to Use

In your coffeelint.json, add

{
  // other lint rules
  "prefer_english_operator_streamline": {
    "module": "coffeelint-prefer-english-operator-streamline",
    "level": "error"
  }
}

and run coffeelint.

Acknowledgements

Forked from coffeelint-prefer-english-operator by @parakeety.