Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

False positive in shopify/jest/no-if #311

Closed
BPScott opened this issue Jun 19, 2019 · 1 comment · Fixed by #331
Closed

False positive in shopify/jest/no-if #311

BPScott opened this issue Jun 19, 2019 · 1 comment · Fixed by #331

Comments

@BPScott
Copy link
Member

BPScott commented Jun 19, 2019

One more edge case relating to #263.

It warns when the if is within a function, such as a react component you're defining within a test:

it('has a child with contentContext', () => {
    const Child: React.SFC = (_props, context) => {
      return context.withinContentContainer ? <div /> : null;
    };
}

As discovered in Shopify/polaris#1713

@BPScott
Copy link
Member Author

BPScott commented Jun 19, 2019

I guess this will also stop https://github.com/Shopify/web/pull/14716 throwing a bunch of warnings when web updates to the newest SK too. (That PR changed ifs to ternarys but that loophole was recently closed in #298).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant