question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

conflict with react/jsx-curly-newline

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sheeruncommented, Dec 1, 2019

Yes. Maybe you can try it first? Just describe this formatting in standard-jsx and show prettier-standard formatting

On Sun, 1 Dec 2019 at 09:44, Uladzimir Havenchyk notifications@github.com wrote:

@sheerun https://github.com/sheerun do you mean in standard-jsx? could you please help with issue description I need to create in standard-jsx?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sheerun/prettier-standard/issues/91?email_source=notifications&email_token=AACHMDPYUOPYRXZ6ZF3XSKDQWN2PFA5CNFSM4JTIFO6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFRBUCY#issuecomment-560077323, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACHMDNFY4H7IIYXEDVNH33QWN2PFANCNFSM4JTIFO6A .

1reaction
sheeruncommented, Nov 30, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

react/jsx-curly-newline rule in conflict with eslint-config-airbnb
eslint-config-airbnb enabled the rule react/jsx-curly-newline in version 18. ... This is in conflict with the current config for eslint-config- ...
Read more >
eslint object-curly-newline conflicts prettier multi-line rationale
In your .eslintrc.js add this to your rules . ... is a configuration-option for this rule, which you can look up here object-curly-newline....
Read more >
object-curly-newline - ESLint - Pluggable JavaScript Linter
"consistent": true (default) requires that either both curly braces, or neither, directly enclose newlines.
Read more >
conflict with react/jsx-curly-newline - Bountysource
Hey @sheerun, I came across some conflict between prettier-standard and eslint with standard and standard-jsx presets included. Example:
Read more >
eslint-config-prettier | Yarn - Package Manager
Added: react/jsx-newline. Version 7.1.0 (2020-12-19). Added: unicorn/empty-brace-spaces. Thanks to fisker Cheung (@fisker)!. Version 7.0.0 (2020-12-05). Changed ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found