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.

jsx-wrap-multiline false positives

See original GitHub issue

I think the case below should not cause error:

https://github.com/ant-design/ant-design-mobile/blob/master/components/accordion/demo/basic.tsx#L13

components/accordion/demo/basic.tsx[13, 9]: Multiline JSX elements must be wrapped in parentheses
// bad
const button = <button type="submit">
    Submit
</button>;
// good
const button = (
    <button type="submit">
        Submit
    </button>
);

// why this is bad ? any reason we need wrap inner button with parentheses?
const button = (
   <div>
       <button type="submit">
          Submit
      </button>
   <div>
);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
wichertcommented, Dec 29, 2017

Another repro using React 16.2:

return (
  <>
    <div>One</div>
    <div>Two</div>
  </>
)
7reactions
adidahiyacommented, Mar 28, 2017

more false positives I’ve found:

return [
    <button type="submit">
        Submit
    </button>,
    <button type="button">
        Cancel
    </button>
];
Read more comments on GitHub >

github_iconTop Results From Across the Web

Lint rules related to React & JSX for TSLint
Enforces that multiline JSX expressions are wrapped with parentheses. · Opening parenthesis must be followed by a newline. · Closing parenthesis ...
Read more >
eslint-plugin-react | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Eslint Plugin React v7.0.0 Release - GitClear
Fixed ; Fix no-unused-prop-types false positive with nextProps (#1079 @Kerumen) ; Fix prefer-stateless-function to not warn on classes with decorators (#1034 @ ...
Read more >
Changelog - JavaScript Standard Style
This release brings better performance, tons of bug fixes, improved JSX, React ⚛️ ... around multiline JSX (react/jsx-wrap-multilines) #710 #1382 (0%) ...
Read more >
eslint-config-dbk - npm
... "react/jsx-sort-prop-types": "off", "react/jsx-sort-props": [ "off" ... "react/wrap-multilines": "off", "react/jsx-first-prop-new-line": ...
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