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
Line exceeds 100 characters and arrow body style #1532
Comments
export const filteredItems = (state, filter, value) =>
state.items.filter(item => item.filter === value); // new line it looks worse but hmm yeah if you just wanna get rid of the error message Edited: or maybe export function filteredItems(state, filter, value) {
return state.items.filter(item => item.filter === value);
} |
@luftywiranda13 I'm definitely then disabling the rule manually.. in fact in that case I'd personally go with the arrow/brace syntax and not the one liner. |
@gkatsanos export const filteredItems = (state, filter, value) => (
state.items.filter(item => item.filter === value),
);
export const filteredItems = (state, filter, value) => state.items.filter(
item => item.filter === value,
);
export const filteredItems = ({ items }, _, value) => items.filter(({ filter }) => filter === value); If you do have to disable a rule, disable max-len - line length limits are a really subpar proxy for managing complexity, so imo it's always ok to disable that rule. |
export const filteredItems =
({ items }, _, value) => items.filter(i => i.filter === value); |
Our style guide does not permit arbitrary linebreaks after assignment; it's always better to have too-long a line than to hit "enter" in a random place. |
I have the following:
export const filteredItems = (state, filter, value) => state.items.filter(item => item.filter === value);
which gives the max-len (100) error.
When I rewrite it by changing the arrow function to the version with { } , naturally I get the error: https://github.com/airbnb/javascript#arrows--implicit-return .
What's the way around this?
The text was updated successfully, but these errors were encountered: