brigand / brigand/babel-plugin-flow-react-proptypes

Suppression only works for the very first directive (which might not be user-controllable)

Open
#240 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
427
Forks
42
PR merge metrics
No merged PRs in 30d

Description

An attempt was made to workaround bug #206 downstream by using the suppression feature: https://github.com/bvaughn/react-virtualized/pull/1635
However, that workaround didn't seem to work - the problem still exists with the version deployed afterwards.

I didn't try debugging it, but after a quick code-review I theorize this is caused by additional directives being added before babel-plugin-flow-react-proptypes runs. It might be a different reason, but this stands out.

---

The code only checks the first directive:

https://github.com/brigand/babel-plugin-flow-react-proptypes/blob/67027b99cad045f894ff9995116750c4524a6120/src/index.js#L516-L522

I'm not sure why this isn't something like:

```ts
const directives = path.node.directives ?? [];
directives.forEach((directive) => {
if (directive.value && directive.value.value === SUPPRESS_STRING) {
suppress = true;
}
})
```

Obviously a fix for #206 would be more important, but I think the suppression should also be improved.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.