Skip to content

Commit

Permalink
Run no-implicit-ref-callback-return and react-element-default-any
Browse files Browse the repository at this point in the history
… by default in `preset-19` (#433)
  • Loading branch information
eps1lon authored Dec 2, 2024
1 parent 55eb569 commit 10085c8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .changeset/sharp-glasses-greet.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion bin/__tests__/types-react-codemod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"`,
);
});
});
4 changes: 2 additions & 2 deletions bin/types-react-codemod.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down

0 comments on commit 10085c8

Please sign in to comment.