Skip to content

docs: update CONTRIBUTING_JS.md#784

Merged
SgtPooki merged 4 commits intomasterfrom
SgtPooki-patch-1
May 14, 2025
Merged

docs: update CONTRIBUTING_JS.md#784
SgtPooki merged 4 commits intomasterfrom
SgtPooki-patch-1

Conversation

@SgtPooki
Copy link
Copy Markdown
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
Copy Markdown

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.​

Comment thread CONTRIBUTING_JS.md Outdated
Comment thread CONTRIBUTING_JS.md Outdated
Comment thread CONTRIBUTING_JS.md Outdated
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread CONTRIBUTING_JS.md Outdated
Comment thread CONTRIBUTING_JS.md Outdated
Comment thread CONTRIBUTING_JS.md

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 <alex@achingbrain.net>
Co-authored-by: Alex Potsides <alex@achingbrain.net>
Co-authored-by: Alex Potsides <alex@achingbrain.net>
Comment thread CONTRIBUTING_JS.md

`aegir` can help you set up a new project with an appropriate tsconfig.json.

##### Case-sensitivity
Copy link
Copy Markdown
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.

Comment thread CONTRIBUTING_JS.md

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
Copy Markdown
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
Copy Markdown
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.

@SgtPooki SgtPooki merged commit b99ec42 into master May 14, 2025
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.

4 participants