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

Adding example readme template to contributing guidelines. #34847

Open
wants to merge 7 commits into
base: trunk
Choose a base branch
from

Conversation

@ryanwelcher
Copy link
Contributor

@ryanwelcher ryanwelcher commented Sep 15, 2021

Description

Adding an example Readme to Contributing.md to work as a style guide to remove guesswork around formatting. Closes #34694

Types of changes

Docs only

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
Copy link
Contributor

@ciampo ciampo left a comment

Thank you @ryanwelcher for adding this section to the CONTRIBUTING guidelines!

```
# ComponentName
If component is experimental, add the following section:
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

Let's make this line a comment

Suggested change
If component is experimental, add the following section:
<!-- If component is experimental, add the following section: -->

##### Readme example

```
# ComponentName
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

Debatable: should the ComponentName be formatted in monospaced font?

Suggested change
# ComponentName
# `ComponentName`

@@ -292,6 +292,43 @@ All components, in addition to being typed, should be using JSDoc when necessary

Each component that is exported from the `@wordpress/components` package should include a `README.md` file, explaining how to use the component, showing examples, and documenting all the props.

##### Readme example
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

We'll need to re-assess the heading's level since #34877 got merged

This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
</div>
If component is deprecated, add the following section:
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

As above

Suggested change
If component is deprecated, add the following section:
<!-- If component is deprecated, add the following section: -->

### propName
Prop description. With a new line before and after the description and before and after type/required blocks.
- Type: Typescript style type i.e `string`, `number`, `( nextValue: string ) => void`
- Required: Either`yes` or `no`
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

I wonder if we should adopt a slightly different format

Suggested change
### propName
Prop description. With a new line before and after the description and before and after type/required blocks.
- Type: Typescript style type i.e `string`, `number`, `( nextValue: string ) => void`
- Required: Either`yes` or `no`
### `propName`: Typescript style type i.e `string`, `number`, `( nextValue: string ) => void`
Prop description. With a new line before and after the description and before and after type/required blocks.
- Required: Either `yes` or `no`

I've adopted this format in a few components recently (e.g. ItemGroup) and I quite liked it because the type can be spotted more easily.

@@ -292,6 +292,43 @@ All components, in addition to being typed, should be using JSDoc when necessary

Each component that is exported from the `@wordpress/components` package should include a `README.md` file, explaining how to use the component, showing examples, and documenting all the props.

##### Readme example

```
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

Suggested change
```
```md

## Usage
Code example using correct markdown syntax and formatted using project's formatting rules.
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

Suggested change
Code example using correct markdown syntax and formatted using project's formatting rules.
Code example using correct markdown syntax and formatted using project's formatting rules. See [ItemGroup](/packages/components/src/item-group/item-group/README.md#usage) for a real-world example.
```jsx
import { ExampleComponent } from '@wordpress/components';
function Example() {
return (
<ExampleComponent>
<p>Code is poetry</p>
</ExampleComponent>
);
}

### Inherited props
Add this section when there are props that are drilled down into an internal component. See [ClipboardButton](/packages/components/src/clipboard-button/README.md) for an example.
Copy link
Contributor

@ciampo ciampo Sep 16, 2021

We should add an optional section about context

Suggested change
Add this section when there are props that are drilled down into an internal component. See [ClipboardButton](/packages/components/src/clipboard-button/README.md) for an example.
Add this section when there are props that are drilled down into an internal component. See [ClipboardButton](/packages/components/src/clipboard-button/README.md) for an example.
<!-- Only add the next section if the component relies on the [Context System](#context-system) -->
## Context
See examples for this section for the [ItemGroup](/packages/components/src/item-group/item-group/README.md#context) and [`Card`](/packages/components/src/card/card/README.md#context) components.

@ciampo ciampo added this to In progress (owned) ⏳ in WordPress Components via automation Sep 16, 2021
@ciampo ciampo moved this from In progress (owned) ⏳ to In progress ⏳ (un-owned) in WordPress Components Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
WordPress Components
In progress ⏳ (un-owned)
Linked issues

Successfully merging this pull request may close these issues.

2 participants