Skip to content

Latest commit

 

History

History
95 lines (53 loc) · 1.87 KB

boolean-keywords.md

File metadata and controls

95 lines (53 loc) · 1.87 KB

coffee/boolean-keywords

This rule requires or disallows usage of specific boolean keywords

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Options

This rule has a required object option:

"coffee/boolean-keywords": ["error", {"allow": ["yes", "no"]}]

Either:

  • "allow": a list of which boolean keywords are allowed
  • "disallow": a list of which boolean keywords are not allowed

👎 Examples of incorrect code for this rule with the "allow" option:

###eslint coffee/boolean-keywords: ["error", {"allow": ["yes", "no"]}]###

a is true

someFunction(on)

b = false if c()

off


###eslint coffee/boolean-keywords: ["error", {"allow": ["yes", "no", "on", "off"]}]###

x = true

y or false


###eslint coffee/boolean-keywords: ["error", {"allow": ["true", "false"]}]###

someFunction(on)

off

yes if b

c = no

👍 Examples of correct code for this rule with the "allow" option:

###eslint coffee/boolean-keywords: ["error", {"allow": ["yes", "no", "on", "off"]}]###

a is yes

b = no if c()

someSetting = on

someOtherSetting = off

👎 Examples of incorrect code for this rule with the "disallow" option:

###eslint coffee/boolean-keywords: ["error", {"disallow": ["yes", "no"]}]###

a is yes

b = no if c()


###eslint coffee/boolean-keywords: ["error", {"disallow": ["true", "false"]}]###

x = true

y or false

👍 Examples of correct code for this rule with the "disallow" option:

###eslint coffee/boolean-keywords: ["error", {"disallow": ["yes", "no"]}]###

a is true

y or false

someSetting = on

someOtherSetting = off