-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Variant of no-unused-expressions that allows type assertions? #271
Comments
Scratched this itch with #272 |
Love this one! Thanks! |
Not working for me. Eslint: 4.14 Eslint error: Expected an assignment or function call and instead saw an expression. (no-unused-expressions). const reducer = (state: ConfigState = initialState, action: ConfigActions): ConfigState => {
switch (action.type) {
case APP_CONFIG_SUCCESS:
return {
...state,
config: action.config,
};
default:
(action: empty); // eslint caught error
return state;
}
}; |
Hey, this doesn't work for me either, my eslintrc:
How do you guys disable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's sometimes helpful to write a bare type assertion with no side-effects. For example when discriminating a disjoint union in a switch:
Unfortunately these are caught by ESLint's
no-unused-expressions
rule.Is there a clean way to "fix" this with
eslint-plugin-flowtype
? Maybe we could expose aflowtype/no-unused-expressions
that additionally ignores type assertions?The text was updated successfully, but these errors were encountered: