Skip to content

Commit

Permalink
[Tests] destructuring-assignment: Add more modern context cases
Browse files Browse the repository at this point in the history
  • Loading branch information
102 committed Jun 8, 2023
1 parent 2e3f1ef commit a93cae7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/lib/rules/destructuring-assignment.js
Expand Up @@ -374,6 +374,18 @@ ruleTester.run('destructuring-assignment', rule, {
code: `
import { useContext } from 'react';
const MyComponent = (props) => {
const {foo} = useContext(aContext);
return <div>{foo}</div>
};
`,
options: ['always'],
settings: { react: { version: '16.9.0' } },
},
{
code: `
import { useContext } from 'react';
const MyComponent = (props) => {
const foo = useContext(aContext);
return <div>{foo.test}</div>
Expand All @@ -382,6 +394,18 @@ ruleTester.run('destructuring-assignment', rule, {
options: ['never'],
settings: { react: { version: '16.9.0' } },
},
{
code: `
import { useContext } from 'react';
const MyComponent = (props) => {
const foo = useContext(aContext);
return <div>{foo.test}</div>
};
`,
options: ['always'],
settings: { react: { version: '16.9.0' } },
},
{
code: `
const MyComponent = (props) => {
Expand Down

0 comments on commit a93cae7

Please sign in to comment.