File tree Expand file tree Collapse file tree 5 files changed +32
-1
lines changed
test/fixtures/react-create-class-custom-name Expand file tree Collapse file tree 5 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,22 @@ You would use:
225225classNameMatchers: [" BaseComponent" ]
226226```
227227
228+ ### ` createReactClassName `
229+
230+ Use this option to set a custom name for the import of the ` create-react-class ` package that is different than ` createReactClass ` .
231+
232+ Given this example:
233+
234+ ``` js
235+ import createClass from ' create-react-class' ;
236+ ```
237+
238+ You would use:
239+
240+ ``` js
241+ createReactClassName: ' createClass'
242+ ```
243+
228244## Is it safe?
229245
230246If you are using the ` propTypes ` in a conventional way,
Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ export default function(api) {
175175 removeImport : state . opts . removeImport || false ,
176176 libraries : ( state . opts . additionalLibraries || [ ] ) . concat ( 'prop-types' ) ,
177177 classNameMatchers,
178+ createReactClassName : state . opts . createReactClassName || 'createReactClass' ,
178179 }
179180
180181 if ( state . opts . plugins ) {
@@ -222,7 +223,7 @@ export default function(api) {
222223 }
223224
224225 return (
225- currentNode . get ( 'callee' ) . node . name === 'createReactClass' ||
226+ currentNode . get ( 'callee' ) . node . name === globalOptions . createReactClassName ||
226227 currentNode . get ( 'callee' ) . node . property . name === 'createClass'
227228 )
228229 } )
Original file line number Diff line number Diff line change 1+ var createSomethingReallySpecial = require ( 'create-react-class' ) ;
2+ var PropTypes = require ( 'prop-types' ) ;
3+
4+ createSomethingReallySpecial ( {
5+ propTypes : {
6+ foo : PropTypes . string ,
7+ } ,
8+ } ) ;
Original file line number Diff line number Diff line change 1+ var createSomethingReallySpecial = require ( 'create-react-class' ) ;
2+
3+ createSomethingReallySpecial ( { } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "createReactClassName" : " createSomethingReallySpecial"
3+ }
You can’t perform that action at this time.
0 commit comments