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

conflict with react/jsx-curly-newline #91

Open
havenchyk opened this issue Nov 30, 2019 · 5 comments
Open

conflict with react/jsx-curly-newline #91

havenchyk opened this issue Nov 30, 2019 · 5 comments

Comments

@havenchyk
Copy link

havenchyk commented Nov 30, 2019

Hey @sheerun, 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>
  )
}

Is it some expected behaviour or is it a bug? If you need any other information, please let me know.

@sheerun
Copy link
Owner

sheerun commented Nov 30, 2019

prettier-standard version looks better to me :) I'd consider it the bug in standard the same way as #76

@havenchyk
Copy link
Author

@sheerun do you mean in standard-jsx? could you please help with issue description I need to create in standard-jsx?

@sheerun
Copy link
Owner

sheerun commented Dec 1, 2019 via email

@sheerun
Copy link
Owner

sheerun commented Dec 1, 2019

btw. prettier-standard has linting built-in that disables whitespace rules, just use --lint flag

@havenchyk
Copy link
Author

yeah, I used it, but I have other project specific rules which are not related to formatting, so I need to use eslint as a pre-step.

submitted standard/standard#1458

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

No branches or pull requests

2 participants