You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Is your rule for a general problem or is it specific to your development style?
General problem.
What does your suggested rule do?
Check if there is a duplicate in a if statement.
List several examples where your rule could be used
const foo = true;
if (foo && foo) { // <- Tslint error/warning at second foo
console.log('Second foo check was unneccessary.');
}
Additional context
Here an example from real code from my project:
if (this.urlParam.start && this.urlParam.start) {
...
}
Problem was: The code-block should only be executed if a .start and .end was set. I accidentally checked .start and .start. The suggested rule would have prevented that.
The text was updated successfully, but these errors were encountered:
@DerZyklop agreed! The first foo && foo case should be covered by the new no-tautology-expression rule. As for this.urlParam.start && this.urlParam.start, it looks like it's not yet covered by the rule's test cases, but should be.
adidahiya
changed the title
Rule suggestion: no-duplicate-statement
no-tautology-expression should check property access expressions
Mar 22, 2019
TSLint is no longer accepting most feature requests per #4534. See typescript-eslint.io for the new, shiny way to lint your TypeScript code with ESLint. ✨
Rule Suggestion
Is your rule for a general problem or is it specific to your development style?
General problem.
What does your suggested rule do?
Check if there is a duplicate in a if statement.
List several examples where your rule could be used
Additional context
Here an example from real code from my project:
Problem was: The code-block should only be executed if a .start and .end was set. I accidentally checked .start and .start. The suggested rule would have prevented that.
The text was updated successfully, but these errors were encountered: