55
66'use strict' ;
77
8+ const minimatch = require ( 'minimatch' ) ;
89const docsUrl = require ( '../util/docsUrl' ) ;
910const getText = require ( '../util/eslint' ) . getText ;
1011const report = require ( '../util/report' ) ;
@@ -39,6 +40,11 @@ module.exports = {
3940 eventHandlerPropPrefix : { type : 'string' } ,
4041 checkLocalVariables : { type : 'boolean' } ,
4142 checkInlineFunction : { type : 'boolean' } ,
43+ ignoreComponentNames : {
44+ type : 'array' ,
45+ uniqueItems : true ,
46+ items : { type : 'string' } ,
47+ } ,
4248 } ,
4349 additionalProperties : false ,
4450 } , {
@@ -51,6 +57,11 @@ module.exports = {
5157 } ,
5258 checkLocalVariables : { type : 'boolean' } ,
5359 checkInlineFunction : { type : 'boolean' } ,
60+ ignoreComponentNames : {
61+ type : 'array' ,
62+ uniqueItems : true ,
63+ items : { type : 'string' } ,
64+ } ,
5465 } ,
5566 additionalProperties : false ,
5667 } , {
@@ -63,6 +74,11 @@ module.exports = {
6374 eventHandlerPropPrefix : { type : 'string' } ,
6475 checkLocalVariables : { type : 'boolean' } ,
6576 checkInlineFunction : { type : 'boolean' } ,
77+ ignoreComponentNames : {
78+ type : 'array' ,
79+ uniqueItems : true ,
80+ items : { type : 'string' } ,
81+ } ,
6682 } ,
6783 additionalProperties : false ,
6884 } , {
@@ -78,6 +94,16 @@ module.exports = {
7894 } ,
7995 additionalProperties : false ,
8096 } ,
97+ {
98+ type : 'object' ,
99+ properties : {
100+ ignoreComponentNames : {
101+ type : 'array' ,
102+ uniqueItems : true ,
103+ items : { type : 'string' } ,
104+ } ,
105+ } ,
106+ } ,
81107 ] ,
82108 } ] ,
83109 } ,
@@ -111,8 +137,17 @@ module.exports = {
111137
112138 const checkInlineFunction = ! ! configuration . checkInlineFunction ;
113139
140+ const ignoreComponentNames = configuration . ignoreComponentNames || [ ] ;
141+
114142 return {
115143 JSXAttribute ( node ) {
144+ const componentName = node . parent . name . name ;
145+
146+ const isComponentNameIgnored = ignoreComponentNames . some ( ( ignoredComponentNamePattern ) => {
147+ const isIgnored = minimatch ( componentName , ignoredComponentNamePattern ) ;
148+ return isIgnored ;
149+ } ) ;
150+
116151 if (
117152 ! node . value
118153 || ! node . value . expression
@@ -124,6 +159,7 @@ module.exports = {
124159 : ! node . value . expression . object
125160 )
126161 )
162+ || isComponentNameIgnored
127163 ) {
128164 return ;
129165 }
0 commit comments