1.1.0 • Published 8 years ago
eslint-plugin-ternaries v1.1.0
eslint-plugin-ternaries

Eslint rules concerning ternaries
Installation
You'll first need to install ESLint:
$ npm i eslint --save-devNext, install eslint-plugin-ternaries:
$ npm install eslint-plugin-ternaries --save-devNote: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-ternaries globally.
Usage
Add ternaries to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
+ "ternaries"
]
}Then configure the rules you want to use under the rules section.
{
"rules": {
+ "ternaries/no-null-ternary": 2,
+ "ternaries/no-empty-ternary": 2
}
}Supported Rules
- no-null-ternary - Disallows ternaries with null as either the consequent or alternate condition.
- no-empty-ternary - Disallows ternaries that have '' or "" as either condition.