Skip to content

Commit

Permalink
test: add a few more case
Browse files Browse the repository at this point in the history
- inline object/functions
- const functions
  • Loading branch information
MURAKAMI Masahiko authored and arthurgeron committed Oct 7, 2024
1 parent 4484ba4 commit 7e8efea
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions __tests__/require-usememo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,25 @@ describe('Rule - Require-usememo', () => {
}`,
options: [{ ignoredPropNames: ["ignoreProp"] }],
},
{
code: `const Component = () => {
const myCallback = () => {};
return <button onClick={myCallback}>Click me</button>;
}`,
options: [{ ignoredPropNames: ["onClick"] }],
},
{
code: `const Component = () => {
return <div style={{ width: '200px' }} />;
}`,
options: [{ ignoredPropNames: ["style"] }],
},
{
code: `const Component = () => {
return <button onClick={() => {}}>Click me</button>;
}`,
options: [{ ignoredPropNames: ["onClick"] }],
},
],
invalid: [
{
Expand Down

0 comments on commit 7e8efea

Please sign in to comment.