66'use strict' ;
77
88const docsUrl = require ( '../util/docsUrl' ) ;
9+ const versionUtil = require ( '../util/version' ) ;
910
1011// ------------------------------------------------------------------------------
1112// Constants
@@ -117,7 +118,7 @@ const SVGDOM_ATTRIBUTE_NAMES = {
117118
118119const DOM_PROPERTY_NAMES = [
119120 // Standard
120- 'acceptCharset' , 'accessKey' , 'allowFullScreen' , 'allowTransparency' , ' autoComplete', 'autoFocus' , 'autoPlay' ,
121+ 'acceptCharset' , 'accessKey' , 'allowFullScreen' , 'autoComplete' , 'autoFocus' , 'autoPlay' ,
121122 'cellPadding' , 'cellSpacing' , 'classID' , 'className' , 'colSpan' , 'contentEditable' , 'contextMenu' ,
122123 'dateTime' , 'encType' , 'formAction' , 'formEncType' , 'formMethod' , 'formNoValidate' , 'formTarget' ,
123124 'frameBorder' , 'hrefLang' , 'htmlFor' , 'httpEquiv' , 'inputMode' , 'keyParams' , 'keyType' , 'marginHeight' , 'marginWidth' ,
@@ -133,6 +134,13 @@ const DOM_PROPERTY_NAMES = [
133134 'autoSave' ,
134135 'itemProp' , 'itemScope' , 'itemType' , 'itemRef' , 'itemID'
135136] ;
137+ function getDOMPropertyNames ( context ) {
138+ // this was removed in React v16.1+, see https://github.com/facebook/react/pull/10823
139+ if ( ! versionUtil . testReactVersion ( context , '16.1.0' ) ) {
140+ return [ 'allowTransparency' ] . concat ( DOM_PROPERTY_NAMES ) ;
141+ }
142+ return DOM_PROPERTY_NAMES ;
143+ }
136144
137145// ------------------------------------------------------------------------------
138146// Helpers
@@ -185,21 +193,23 @@ function tagNameHasDot(node) {
185193/**
186194 * Get the standard name of the attribute.
187195 * @param {String } name - Name of the attribute.
196+ * @param {String } context - eslint context
188197 * @returns {String } The standard name of the attribute.
189198 */
190- function getStandardName ( name ) {
199+ function getStandardName ( name , context ) {
191200 if ( DOM_ATTRIBUTE_NAMES [ name ] ) {
192201 return DOM_ATTRIBUTE_NAMES [ name ] ;
193202 }
194203 if ( SVGDOM_ATTRIBUTE_NAMES [ name ] ) {
195204 return SVGDOM_ATTRIBUTE_NAMES [ name ] ;
196205 }
197206 let i = - 1 ;
198- const found = DOM_PROPERTY_NAMES . some ( ( element , index ) => {
207+ const names = getDOMPropertyNames ( context ) ;
208+ const found = names . some ( ( element , index ) => {
199209 i = index ;
200210 return element . toLowerCase ( ) === name ;
201211 } ) ;
202- return found ? DOM_PROPERTY_NAMES [ i ] : null ;
212+ return found ? names [ i ] : null ;
203213}
204214
205215// ------------------------------------------------------------------------------
@@ -262,7 +272,7 @@ module.exports = {
262272 } ) ;
263273 }
264274
265- const standardName = getStandardName ( name ) ;
275+ const standardName = getStandardName ( name , context ) ;
266276 if ( ! isTagName ( node ) || ! standardName ) {
267277 return ;
268278 }
0 commit comments