Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should the code review checklist change given Typescript? #1180

Closed
zepumph opened this issue Jan 6, 2022 · 3 comments
Closed

How should the code review checklist change given Typescript? #1180

zepumph opened this issue Jan 6, 2022 · 3 comments

Comments

@zepumph
Copy link
Member

zepumph commented Jan 6, 2022

No description provided.

@zepumph
Copy link
Member Author

zepumph commented Feb 28, 2022

This was discussed during today's dev meeting about typescript conventions.

@samreid: We have https://github.com/phetsims/phet-info/blob/7100adc9d8bf5b79d1aa9da38b1f8302f3b059c1/doc/typescript-conventions.md, which I think of as code review items, but they aren't linked to the document yet.

@zepumph: Perhaps just an item in the CRC to link to that document?

@samreid: then perhaps make the typescript conventions document into checkboxes so you can copy paste them into a side issue of a code review.

@samreid, I think we should modularize the code review checklist.

@zepumph, the coding conventions doc is 5/8 of the document already, can we split that out? UPDATE: see phetsims/phet-info#186, the coding conventions were split out to their own document.

zepumph added a commit to phetsims/phet-info that referenced this issue Feb 28, 2022
@zepumph
Copy link
Member Author

zepumph commented Feb 28, 2022

Ok, the CRC has a checkbox to go look at the typescript conventions doc now:

image

From here, I feel like another important piece is to look into what can be shed for the document because of TypeScript. If not removed, perhaps we want to move some content into a "JavaScript only" section, because it doesn't apply to new code being written in Javascript. Some items that come to mind:

In Coding Conventions:

  • "type expressions" and "visibility annotations" sections are javascript-specific.
  • This is outdated:

    For constructors, use parameters for things that don’t have a default. Use options for things that have a default value. This improves readability at the call site, especially when the number of parameters is large. It also eliminates order dependency that is required by using parameters.

  • The checkbox starting in this quote mentions outdated extend/merge calls:

    When options are passed through one constructor to another, a "nested options" pattern should be used

  • Self should be replaced with arrow functions:

    If references are needed to the enclosing object, such as for a closure, self should be defined

  • Javascript-specific:

    Constructor and function documentation. Parameter types and names should be clearly specified for each constructor and function using @param annotations.

I didn't see any other changes to be done in the CRC checklist.

samreid pushed a commit to phetsims/phet-info that referenced this issue Apr 23, 2022
@jonathanolson
Copy link
Contributor

JO and CM didn't see anything else that should be added to the checklist. @zepumph anything else that should be added in your opinion? Feel free to close if not.

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

No branches or pull requests

2 participants