-
-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(linter): Rename react_perf/jsx_no_new_function_as_props to jsx_no…
…_new_function_as_prop (#2175) s/props/prop/ > https://github.com/cvazac/eslint-plugin-react-perf/blob/master/docs/rules/jsx-no-new-function-as-prop.md Sorry, I overlooked this in #2169 😨
- Loading branch information
Showing
3 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
crates/oxc_linter/src/snapshots/jsx_no_new_function_as_prop.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
source: crates/oxc_linter/src/tester.rs | ||
expression: jsx_no_new_function_as_prop | ||
--- | ||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item prop={function(){return true}} /> | ||
· ─────────────────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item prop={() => true} /> | ||
· ────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item prop={new Function('a', 'alert(a)')}/> | ||
· ───────────────────────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item prop={Function()}/> | ||
· ────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item onClick={this.clickHandler.bind(this)} /> | ||
· ──────────────────────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item callback={this.props.callback || function() {}} /> | ||
· ───────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item callback={this.props.callback ? this.props.callback : function() {}} /> | ||
· ───────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item prop={this.props.callback || this.props.callback ? this.props.callback : function(){}} /> | ||
· ──────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
⚠ eslint-plugin-react-perf(jsx-no-new-function-as-prop): JSX attribute values should not contain functions created in the same scope. | ||
╭─[jsx_no_new_function_as_prop.tsx:1:1] | ||
1 │ <Item prop={this.props.callback || (this.props.cb ? this.props.cb : function(){})} /> | ||
· ──────────── | ||
╰──── | ||
help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array). | ||
|
||
|