From 7def79f4433bbe36328a38de6807a9ed58be232f Mon Sep 17 00:00:00 2001 From: Patrick Hayes Date: Tue, 21 Nov 2017 17:23:10 -0800 Subject: [PATCH] Review comments --- lib/rules/jsx-child-element-spacing.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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/;