@@ -126,5 +126,70 @@ ruleTester.run('forbid-element-props', rule, {
126126 column : 8 ,
127127 type : 'JSXAttribute'
128128 } ]
129+ } , {
130+ code : [
131+ 'const First = (props) => (' ,
132+ ' <div className="foo" />' ,
133+ ');'
134+ ] . join ( '\n' ) ,
135+ options : [ {
136+ forbid : [ { propName : 'className' , message : 'Please use class instead of ClassName' } ]
137+ } ] ,
138+ errors : [ {
139+ message : 'Please use class instead of ClassName' ,
140+ line : 2 ,
141+ column : 8 ,
142+ type : 'JSXAttribute'
143+ } ]
144+ } , {
145+ code : [
146+ 'const First = (props) => (' ,
147+ ' <div className="foo">' ,
148+ ' <div otherProp="bar" />' ,
149+ ' </div>' ,
150+ ');'
151+ ] . join ( '\n' ) ,
152+ options : [ {
153+ forbid : [
154+ { propName : 'className' , message : 'Please use class instead of ClassName' } ,
155+ { propName : 'otherProp' , message : 'Avoid using otherProp' }
156+ ]
157+ } ] ,
158+ errors : [ {
159+ message : 'Please use class instead of ClassName' ,
160+ line : 2 ,
161+ column : 8 ,
162+ type : 'JSXAttribute'
163+ } , {
164+ message : 'Avoid using otherProp' ,
165+ line : 3 ,
166+ column : 10 ,
167+ type : 'JSXAttribute'
168+ } ]
169+ } , {
170+ code : [
171+ 'const First = (props) => (' ,
172+ ' <div className="foo">' ,
173+ ' <div otherProp="bar" />' ,
174+ ' </div>' ,
175+ ');'
176+ ] . join ( '\n' ) ,
177+ options : [ {
178+ forbid : [
179+ { propName : 'className' } ,
180+ { propName : 'otherProp' , message : 'Avoid using otherProp' }
181+ ]
182+ } ] ,
183+ errors : [ {
184+ message : 'Prop `className` is forbidden on DOM Nodes' ,
185+ line : 2 ,
186+ column : 8 ,
187+ type : 'JSXAttribute'
188+ } , {
189+ message : 'Avoid using otherProp' ,
190+ line : 3 ,
191+ column : 10 ,
192+ type : 'JSXAttribute'
193+ } ]
129194 } ]
130195} ) ;
0 commit comments