Rule proposal: forbid superfluous enclosing spaces in same-line jsx components
See original GitHub issueThis would produce a warning:
<span> { tab.title } </span>
as it produces 3 <span>
DOM nodes (typically not wanted)
This wouldn’t:
<span>{ tab.title }</span>
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
eslint-plugin-react/jsx-space-before-closing.md at master
Rule Details. This rule checks if there is one or more spaces before the closing bracket of self-closing JSX elements. Rule Options.
Read more >JSX In Depth - React
User-Defined Components Must Be Capitalized. When an element type starts with a lowercase letter, it refers to a built-in component like <div> or...
Read more >Google JavaScript Style Guide
Trailing whitespace is forbidden. Beyond where required by the language or other style rules, and apart from literals, comments, and JSDoc, a single...
Read more >Department of Labor - Regulations.gov
enclosed spaces, working near energized parts, grounding for ... proposed rule will prevent 116 injuries ... OSHA believes that it is unnecessary to....
Read more >Electric Power Generation, Transmission, and Distribution
The Amoco Corp. made similar comments about the proposed regulations on hazardous energy control and on enclosed spaces (Ex. 3-73).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, i still think this would be a good rule (especially if it autofixed)for consistency’s sake.
It looks like newer versions of React take care of this, throwing away the extra whitespace.
That said, this would be a useful rule to have if only to enforce consistency—is a PR for this something y’all would consider?