Skip to content

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

docs: update CONTRIBUTING_JS.md #784

wants to merge 4 commits into from

Conversation

SgtPooki
Copy link
Member

add some more details to align with unknown expectations that I've seen from contributors lately.

i.e. ipfs/ipfs-webui#2349

add some more details to align with unknown expectations that I've seen from contributors lately. 

i.e. ipfs/ipfs-webui#2349
Copy link

@Copilot Copilot AI left a 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.​

Copy link
Member

@achingbrain achingbrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, comments inline

Copy link
Member Author

@SgtPooki SgtPooki left a 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.
Copy link
Member Author

@SgtPooki SgtPooki Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Member Author

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?

Copy link
Member

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.

SgtPooki and others added 3 commits March 27, 2025 09:54
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
Copy link
Member

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.
Copy link
Member

@2color 2color Mar 28, 2025

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.

Copy link
Member Author

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.

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

Successfully merging this pull request may close these issues.

3 participants