--no* options automatically set to false
andrewsokolov committed
Sep 14, 2015 at 17:17 UTC
0610fd93b4ec6c2dce1715b6d5a601f3992ba5ce
5 files changed
+8
-8
packages/react-codemod/README.md
+3
-3
@@ -39,13 +39,13 @@ are using the master version (>0.13.1) of React as it is using
39
`class` transforms `React.createClass` calls into ES2015 classes.
40
41
* `jscodeshift -t react/packages/react-codemod/transforms/class.js <file>`
42
- * If `--no-super-class=true` is specified it will not extend
42
+ * If `--no-super-class` is specified it will not extend
43
`React.Component` if `setState` and `forceUpdate` aren't being called in a
44
class. We do recommend always extending from `React.Component`, especially
45
if you are using or planning to use [Flow](http://flowtype.org/). Also make
46
sure you are not calling `setState` anywhere outside of your component.
47
48
-These three scripts take an option `--no-explicit-require=true` if you don't have a
48
+These three scripts take an option `--no-explicit-require` if you don't have a
49
`require('React')` statement in your code files and if you access React as a
50
global.
51
@@ -87,7 +87,7 @@ systems.
87
* Creates a constructor if necessary. This is necessary if either
88
`getInitialState` exists in the `React.createClass` spec OR if functions
89
need to be bound to the instance.
90
- * When `--no-super-class=true` is passed it only optionally extends
90
+ * When `--no-super-class` is passed it only optionally extends
91
`React.Component` when `setState` or `forceUpdate` are used within the
92
class.
93
packages/react-codemod/test/__tests__/transform-tests.js
+1
-1
@@ -54,7 +54,7 @@ describe('Transform Tests', () => {
54
test('class', 'class-test');
55
56
test('class', 'class-test2', {
57
- 'no-super-class': true,
57
+ 'super-class': false
58
});
59
60
test('class', 'class-test3');
packages/react-codemod/transforms/class.js
+2
-2
@@ -522,7 +522,7 @@ module.exports = (file, api, options) => {
522
};
523
524
if (
525
- options['no-explicit-require'] || ReactUtils.hasReact(root)
525
+ !options['explicit-require'] || ReactUtils.hasReact(root)
526
) {
527
const apply = (path, type) =>
528
path
@@ -531,7 +531,7 @@ module.exports = (file, api, options) => {
531
.filter(canConvertToClass)
532
.forEach(classPath => updateToClass(
533
classPath,
534
- !options['no-super-class'],
534
+ !options['super-class'],
535
type
536
));
537
packages/react-codemod/transforms/findDOMNode.js
+1
-1
@@ -124,7 +124,7 @@ function getDOMNodeToFindDOMNode(file, api, options) {
124
};
125
126
if (
127
- options['no-explicit-require'] ||
127
+ !options['explicit-require'] ||
128
ReactUtils.hasReact(root)
129
) {
130
const didTransform = ReactUtils
packages/react-codemod/transforms/pure-render-mixin.js
+1
-1
@@ -165,7 +165,7 @@ function removePureRenderMixin(file, api, options) {
165
};
166
167
if (
168
- options['no-explicit-require'] ||
168
+ !options['explicit-require'] ||
169
ReactUtils.hasReact(root)
170
) {
171
const didTransform = ReactUtils