standard/standard
Voir sur GitHubindentation/alignment in jsx (react/jsx-curly-newline)
Open
#1 458 ouverte le 1 déc. 2019
blockedbughelp wanted
Description
What version of this package are you using?
eslint-config-standard-jsx@8.1.0
What operating system, Node.js, and npm version? MacOS Catalina, node 13.2.0, npm 6.13.1 What happened? Weird formatting, in prettier-standard package it's done more "correctly" What did you expect to happen? Another formatting like it's done in prettier-standard Are you willing to submit a pull request to fix this bug? Nope :(
I came across some conflict between prettier-standard and eslint with standard and standard-jsx presets included.
Example:
const A: React.FC = ({ children }) => <div>{children}</div>
const B: React.FC<{ onDelete: () => void }> = ({ children }) => (
<div>{children}</div>
)
const MyComponent: FunctionComponent = () => {
const someLongMethodHandlerName = (obj: {
parameter1: string
parameter2: string
}) => {}
return (
<A>
<B
onDelete={() =>
someLongMethodHandlerName({
parameter1: 'parameter1',
parameter2: 'parameter2'
})
}
>
B
</B>
</A>
)
}
^^ this is how prettier-standard formats the code,
but eslint with standard and standard-jsx presets expects the next version
const A: React.FC = ({ children }) => <div>{children}</div>
const B: React.FC<{ onDelete: () => void }> = ({ children }) => (
<div>{children}</div>
)
const MyComponent: FunctionComponent = () => {
const someLongMethodHandlerName = (obj: {
parameter1: string
parameter2: string
}) => {}
return (
<A>
<B
onDelete={() =>
someLongMethodHandlerName({
parameter1: 'parameter1',
parameter2: 'parameter2'
- })
- }
+ . })}
>
B
</B>
</A>
)
}
To me first variant is more correct /cc @sheerun