Skip to content

Commit

Permalink
remove br tag from list of inline elements, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalpp committed May 18, 2021
1 parent 9aa539d commit ad2b39d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rules/jsx-child-element-spacing.js
Expand Up @@ -3,14 +3,16 @@
const docsUrl = require('../util/docsUrl');

// This list is taken from https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements

// Note: 'br' is not included because whitespace around br tags is
// inconsequential to the rendered output
const INLINE_ELEMENTS = new Set([
'a',
'abbr',
'acronym',
'b',
'bdo',
'big',
'br',
'button',
'cite',
'code',
Expand Down
25 changes: 25 additions & 0 deletions tests/lib/rules/jsx-child-element-spacing.js
Expand Up @@ -139,6 +139,31 @@ ruleTester.run('jsx-child-element-spacing', rule, {
B
</App>
`
}, {
code: `
<App>
A
<br/>
B
</App>
`
}, {
code: `
<App>
A<br/>
B
</App>
`
}, {
code: `
<App>
A<br/>B
</App>
`
}, {
code: `
<App>A<br/>B</App>
`
}],

invalid: [{
Expand Down

0 comments on commit ad2b39d

Please sign in to comment.