We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prefer-ternary
This rule would enforce using ternary expressions to simple if/then/else statements.
if(condition){ a = 1; } else{ a = 2; }
a = condition ? 1 : 2
if(condition){ doSomeStuff() a = 1; } else{ a = 2; }
This rule could have options for whether it would be enabled for various situations (e.g. variable assignments, return statements, function calls).
I've already written this rule as a normal ESLint plugin so it would just need some minor rewriting to conform to the unicorn linting/documentation
The text was updated successfully, but these errors were encountered:
Accepted
Sorry, something went wrong.
Progress so far: https://github.com/jmoore914/eslint-plugin-unicorn/tree/prefer-ternary
Just need to find time to add documentation which might take a while because of all the different options available.
Successfully merging a pull request may close this issue.
This rule would enforce using ternary expressions to simple if/then/else statements.
Fail
Pass
This rule could have options for whether it would be enabled for various situations (e.g. variable assignments, return statements, function calls).
I've already written this rule as a normal ESLint plugin so it would just need some minor rewriting to conform to the unicorn linting/documentation
The text was updated successfully, but these errors were encountered: