-
Notifications
You must be signed in to change notification settings - Fork 224
docs: update CONTRIBUTING_JS.md #784
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
base: master
Are you sure you want to change the base?
Conversation
add some more details to align with unknown expectations that I've seen from contributors lately. i.e. ipfs/ipfs-webui#2349
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates CONTRIBUTING_JS.md to provide additional guidelines for contributors on file naming, TypeScript usage, and front-end/UI practices.
- Added a "Files" section addressing TypeScript and case-sensitivity for filenames.
- Introduced a section on importing modules with file extensions to comply with ESM.
- Added front-end guidelines for React projects, including component naming and file extension recommendations.
Comments suppressed due to low confidence (1)
CONTRIBUTING_JS.md:170
- [nitpick] Clarify the rationale for using kebab-case for React components as it deviates from the common practice of using PascalCase. Providing context will help avoid confusion for contributors accustomed to standard React naming conventions.
1. Component Naming: Use kebab-case for component names (e.g., `my-component`). This is different than idiomatic React, which uses PascalCase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, comments inline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self review
|
||
1. Component Naming: Use kebab-case for component names (e.g., `my-component`). This is different than idiomatic React, which uses PascalCase. | ||
2. File Extensions: Use .tsx for files containing React components to leverage TypeScript's JSX support. | ||
3. State Management: Prefer using React's built-in state management features. If additional state management libraries are needed, please ensure they are well-justified, align with the project's architecture, and are well-typed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. State Management: Prefer using React's built-in state management features. If additional state management libraries are needed, please ensure they are well-justified, align with the project's architecture, and are well-typed. | |
3. State Management: Prefer using React's built-in state management features. If additional state management libraries are needed, please ensure they are well-justified, align with the project's architecture, and are well-typed. (e.g. do not use redux-bundler) | |
4. Do not use prop-types or `.defaultProps` | |
5. Use functional components, hooks, and context where appropriate. Classes may be used for the logic of your components, but the component itself should be functional. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@achingbrain any thoughts on these additions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any strong preferences around react/redux/etc. I don't use it much and every time I do, it seems to have changed completely so happy to go with whatever.
Co-authored-by: Alex Potsides <[email protected]>
Co-authored-by: Alex Potsides <[email protected]>
Co-authored-by: Alex Potsides <[email protected]>
|
||
`aegir` can help you set up a new project with an appropriate tsconfig.json. | ||
|
||
##### Case-sensitivity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make a note that this is a recommendation and that at the very least it's important to maintain consistency on a project level. Because currently not all projects use kebab-case.
For example https://github.com/ipfs/ipld-explorer-components/tree/master/src/components uses PascalCase.
|
||
1. Component Naming: Use kebab-case for component names (e.g., `my-component`). This is different than idiomatic React, which uses PascalCase. | ||
2. File Extensions: Use .tsx for files containing React components to leverage TypeScript's JSX support. | ||
3. State Management: Prefer using React's built-in state management features. If additional state management libraries are needed, please ensure they are well-justified, align with the project's architecture, and are well-typed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree redux-bundler proved to be a flop. Either way, I wouldn't prescribe this on an org level. Instead I'd leave it up to the maintainer of the specific library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should advise against redux-bundler at the org level because it breaks type-safety.
add some more details to align with unknown expectations that I've seen from contributors lately.
i.e. ipfs/ipfs-webui#2349