question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Contributing Guide - yarn proptypes

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

It is easy to fail circleci test_static.

I manually added jsdoc comments to proptypes in component js file to match the .d.ts. I was unaware that yarn proptypes is run as part of ci. Any slight difference between the generated and that of the pull request will result in failure.

I think it should be made clear in Contributing.md that if you change the typescript definition file then yarn proptypes will generate the proptypes in the js and will include the doc comments. ( There is a warning that is generated and written to the js )

Note that even running yarn proptypes can still result in the ci error.

When run on circleci - .circleci/config.yml - disable-cache

test_static:
    <<: *defaults
    steps:
      - checkout
      - install_js
      - run:
          name: Check if yarn prettier was run
          command: yarn prettier check-changed
      - run:
          name: Generate PropTypes
          command: yarn proptypes --disable-cache

If you change the proptypes in js and yarn proptypes locally disable-cache is false.

generateProptypes.ts

return command
        .option('disable-cache', {
          default: false,//***************
          describe: 'Considers all files on every run',
          type: 'boolean',
        })
if (!ignoreCache && (await fse.stat(jsFile)).mtimeMs > (await fse.stat(tsFile)).mtimeMs) {
      // Javascript version is newer, skip file
      return GenerateResult.Skipped;
    }

I suggest then that instead of

If props were added or prop types were changed, the TypeScript declarations were updated.

It should be stated that if props are to change then change the TypeScript declaration and then yarn proptypes. Also mention that yarn proptypes will copy across JsDoc comments.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
eps1loncommented, Apr 18, 2020

Honestly I would just remove the cache. This runs pretty fast as far as I remember. Caching is inherently complex and should have a big improvement. Going from e.g. 10s to 5s is not that.

1reaction
marcosvega91commented, Apr 19, 2020

I think it’s ok @oliviertassinari

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contributing Guide - yarn proptypes · Issue #20622 - GitHub
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >
prop-types | Yarn - Package Manager
Runtime type checking for React props and similar objects. You can use prop-types to document the intended types of properties passed to components....
Read more >
Typechecking with PropTypes In React - Upmostly
PropTypes is a library that provides certain utilities for documenting the intended types of properties that are being passed down to components.
Read more >
How to Contribute - React
Run yarn test --prod to test in the production environment. If you need a debugger, run yarn debug-test --watch TestName , open chrome://inspect...
Read more >
CONTRIBUTING.md · letian777/material-ui - Gitee.com
CONTRIBUTING.md 13.73 KB. # Contributing to Material-UI ... Here are a few guidelines that will help you along the way. ... yarn proptypes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found