Skip to content
New issue

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

feat: add a no-negated-async rule #317

Merged
merged 2 commits into from
Jun 10, 2017
Merged

Conversation

connor4312
Copy link
Contributor

Angular's async pipes emit null initially, prior to the observable emitting
any values, or the promise resolving. This can cause negations, like
*ngIf="!(myConditional | async)" to thrash the layout and cause expensive
side-effects like firing off XHR requests for a component which should not
be shown.

This PR adds a linting rule which fails on usages of !(expr | async) and
(expr | async) == false.

Angular's async pipes emit `null` initially, prior to the observable emitting
any values, or the promise resolving. This can cause negations, like
`*ngIf="!(myConditional | async)"` to thrash the layout and cause expensive
side-effects like firing off XHR requests for a component which should not
be shown.

This PR adds a linting rule which fails on usages of !(expr | async) and
(expr | async) == false.
@connor4312
Copy link
Contributor Author

It looks like the failing build is an issue with node-sass on Travis' 32-bit slaves. Tests pass otherwise here!

@mgechev
Copy link
Owner

mgechev commented Jun 8, 2017

@connor4312 thanks for the PR, looks great! I will review and merge as soon as possible.

Looks great, at first!

@mgechev mgechev merged commit 0f0924d into mgechev:master Jun 10, 2017
@mgechev
Copy link
Owner

mgechev commented Jun 10, 2017

@connor4312 merged. Great job!

@connor4312
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants