diff --git a/.changeset/sharp-glasses-greet.md b/.changeset/sharp-glasses-greet.md new file mode 100644 index 00000000..0d749f82 --- /dev/null +++ b/.changeset/sharp-glasses-greet.md @@ -0,0 +1,9 @@ +--- +"types-react-codemod": minor +--- + +Run `no-implicit-ref-callback-return` and `react-element-default-any` by default in `preset-19` + +The transformed code is not meant to be used as a pattern for new code. +It really is about migrating existing code with as little friction. +Changes can always be reverted and a subset chosen. diff --git a/README.md b/README.md index 7d664693..693e2cb8 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ The reason being that a false-positive can be reverted easily (assuming you have - `deprecated-react-child` - `deprecated-react-text` - `deprecated-void-function-component` - - `no-implicit-ref-callback-return` (off by default) - - `react-element-default-any` (off by default) + - `no-implicit-ref-callback-return` + - `react-element-default-any` - `refobject-defaults` - `scoped-jsx` - `useRef-required-initial` diff --git a/bin/__tests__/types-react-codemod.js b/bin/__tests__/types-react-codemod.js index 4e48de72..5c491e58 100644 --- a/bin/__tests__/types-react-codemod.js +++ b/bin/__tests__/types-react-codemod.js @@ -89,7 +89,7 @@ describe("types-react-codemod", () => { // Everything ok expect(stderr).toMatchInlineSnapshot(`""`); expect(stdout).toContain( - `--preset19Transforms="deprecated-legacy-ref,deprecated-prop-types-types,deprecated-react-child,deprecated-react-node-array,deprecated-react-fragment,deprecated-react-text,deprecated-void-function-component,refobject-defaults,scoped-jsx,useRef-required-initial"`, + `--preset19Transforms="deprecated-legacy-ref,deprecated-prop-types-types,deprecated-react-child,deprecated-react-node-array,deprecated-react-fragment,deprecated-react-text,deprecated-void-function-component,no-implicit-ref-callback-return,react-element-default-any-props,refobject-defaults,scoped-jsx,useRef-required-initial"`, ); }); }); diff --git a/bin/types-react-codemod.cjs b/bin/types-react-codemod.cjs index d2255fbd..fd6455fb 100755 --- a/bin/types-react-codemod.cjs +++ b/bin/types-react-codemod.cjs @@ -28,8 +28,8 @@ const preset19Choices = [ { checked: true, value: "deprecated-react-fragment" }, { checked: true, value: "deprecated-react-text" }, { checked: true, value: "deprecated-void-function-component" }, - { checked: false, value: "no-implicit-ref-callback-return" }, - { checked: false, value: "react-element-default-any-props" }, + { checked: true, value: "no-implicit-ref-callback-return" }, + { checked: true, value: "react-element-default-any-props" }, { checked: true, value: "refobject-defaults" }, { checked: true, value: "scoped-jsx" }, { checked: true, value: "useRef-required-initial" },