diff --git a/lib/rules/jsx-child-element-spacing.js b/lib/rules/jsx-child-element-spacing.js index d39470559b..82d56917cb 100644 --- a/lib/rules/jsx-child-element-spacing.js +++ b/lib/rules/jsx-child-element-spacing.js @@ -1,6 +1,7 @@ 'use strict'; -const INLINE_ELEMENTS = [ +// This list is taken from https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements +const INLINE_ELEMENTS = new Set([ 'a', 'abbr', 'acronym', @@ -32,7 +33,7 @@ const INLINE_ELEMENTS = [ 'textarea', 'tt', 'var' -]; +]); module.exports = { meta: { @@ -61,7 +62,7 @@ module.exports = { const isInlineElement = node => ( node.type === 'JSXElement' && - INLINE_ELEMENTS.indexOf(elementName(node)) !== -1 + INLINE_ELEMENTS.has(elementName(node)) ); const TEXT_FOLLOWING_ELEMENT_PATTERN = /^\s*\n\s*\S/;