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

Introduce markdown linting #2726

Merged
merged 23 commits into from
Jan 11, 2023
Merged

Introduce markdown linting #2726

merged 23 commits into from
Jan 11, 2023

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Dec 28, 2022

Fixes: https://github.com/github/accessibility/issues/2550

This PR:

  • Introduces markdown linting using GitHub's recommended markdownlint configs (markdownlint-github). These will help us enforce best accessibility practices in our docs.
  • Configures the markdownlint VSCode markdown extension in devcontainer so that issues are flagged in the editor.
  • Adds a CI job for markdown linting. I decided to separate the linting job to eslint and markdownlint.

@changeset-bot
Copy link

changeset-bot bot commented Dec 28, 2022

⚠️ No Changeset found

Latest commit: 5f27844

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@khiga8 khiga8 added the skip changeset This change does not need a changelog label Dec 28, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 28, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 87.38 KB (0%)
dist/browser.umd.js 88.03 KB (0%)

@khiga8 khiga8 temporarily deployed to github-pages December 28, 2022 21:34 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2726 December 28, 2022 21:34 Inactive
@khiga8 khiga8 temporarily deployed to github-pages December 29, 2022 15:35 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2726 December 29, 2022 15:35 Inactive
@khiga8 khiga8 force-pushed the kh-add-markdown-lint branch from e8edee8 to f49aeec Compare December 29, 2022 18:42
@khiga8
Copy link
Contributor Author

khiga8 commented Dec 29, 2022

There are 80 violations. I could either try to address in this PR, but if they are too difficult to address in one go, I'll turn off the rule completely with a note that we want to turn on eventually...

Here are the issues that need to be resolved:

contributor-docs/adrs/adr-004-children-as-api.md:41 GH001/no-default-alt-text Images should set meaningful alternative text (alt text), and not use the macOS default screenshot filename or `Image`. [For image: <img width="373" alt="image" src="https://user-images.githubusercontent.com/1863771/144945223-70c4c800-5827-4985-9f18-0ab416eba058.png">] https://github.com/github/markdownlint-github/blob/main/docs/rules/GH001-no-default-alt-text.md
contributor-docs/adrs/adr-005-box-sx.md:28:1 MD030/list-marker-space Spaces after list markers [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md030
contributor-docs/adrs/adr-008-experimental-components.md:11 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md001
contributor-docs/adrs/adr-008-experimental-components.md:56 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md001
contributor-docs/adrs/adr-XXX-file-structure.md:15 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
contributor-docs/behaviors.md:20 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
contributor-docs/behaviors.md:56 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Examples"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
contributor-docs/behaviors.md:108 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
contributor-docs/component-contents-api-patterns.md:5 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md001
contributor-docs/CONTRIBUTING.md:137 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
contributor-docs/CONTRIBUTING.md:215:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "classnames"] [Context: "[classnames]: https://www.npmj..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
contributor-docs/CONTRIBUTING.md:216:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "spread syntax"] [Context: "[spread syntax]: https://devel..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
contributor-docs/CONTRIBUTING.md:217:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "styled-system"] [Context: "[styled-system]: https://style..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
contributor-docs/CONTRIBUTING.md:218:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "table"] [Context: "[table]: https://jxnblk.com/st..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
contributor-docs/CONTRIBUTING.md:220:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "now"] [Context: "[now]: https://zeit.co/now"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
contributor-docs/principles.md:3 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md001
contributor-docs/testing.md:75 GH002/no-generic-link-text Avoid using generic link text like `Learn more` or `Click here` [For link: here] https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md
contributor-docs/testing.md:103 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Overview"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/anchoredPosition.mdx:116 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Usage"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/anchoredPosition.mdx:141 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### useAnchoredPosition hook"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/anchoredPosition.mdx:148 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Return value"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/Autocomplete.mdx:647 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Autocomplete.Input"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/core-concepts.md:11 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
docs/content/core-concepts.md:27 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
docs/content/deprecated/ActionList.mdx:13 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/ActionList.mdx:27 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/ActionMenu.mdx:13 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/ActionMenu.mdx:30 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/BorderBox.md:12 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/BorderBox.md:18 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/Dropdown.md:51 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md001
docs/content/deprecated/DropdownMenu.mdx:12 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/DropdownMenu.mdx:42 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/Flex.md:12 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/Flex.md:22 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/Grid.md:12 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/Grid.md:25 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/Position.md:12 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/Position.md:24 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/SelectMenu.md:117 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:133 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:151 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:180 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:224 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:243 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:262 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:289 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:315 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:341 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SelectMenu.md:374 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Component Props"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/deprecated/SideNav.md:13 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Before"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/SideNav.md:25 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "After"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/deprecated/SideNav.md:176 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
docs/content/Details.md:7 GH002/no-generic-link-text Avoid using generic link text like `Learn more` or `Click here` [For link: here] https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md
docs/content/FilteredSearch.md:31 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md001
docs/content/FilterList.md:25 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md001
docs/content/focusTrap.mdx:79 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Usage"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/focusZone.mdx:108 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Usage"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/focusZone.mdx:123 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### useFocusZone hook"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md024
docs/content/focusZone.mdx:130 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Return value"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/NavList.mdx:325:84 MD037/no-space-in-emphasis Spaces inside emphasis markers [Context: "* Should `title... be required? *"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md037
docs/content/Overlay.mdx:71 GH002/no-generic-link-text Avoid using generic link text like `Learn more` or `Click here` [For link: here] https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md
docs/content/PageLayout.mdx:313 MD036/no-emphasis-as-heading/no-emphasis-as-header Emphasis used instead of a heading [Context: "Links & Resources"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md036
docs/content/primer-theme.md:13 GH002/no-generic-link-text Avoid using generic link text like `Learn more` or `Click here` [For link: here] https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md
docs/content/ssr.mdx:9 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
docs/content/ssr.mdx:23 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
docs/content/Textarea.mdx:102 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md031
docs/content/Textarea.mdx:102 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
migrating.md:12:12 MD051/link-fragments Link fragments should be valid [Context: "[codemod](#codemods) available to upgrade component identifiers from [v3.x.x-beta](#3-0-0-beta)"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md051
migrating.md:14 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
migrating.md:33:12 MD051/link-fragments Link fragments should be valid [Context: "[codemod](#codemods) available to upgrade from [2.x.x-beta](#2-0-0-beta)"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md051
migrating.md:35 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
migrating.md:49:12 MD051/link-fragments Link fragments should be valid [Context: "[codemod](#codemods) available to upgrade from [1.x.x-beta](#1-0-0-beta)"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md051
migrating.md:51 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
migrating.md:61 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md040
migrating.md:248:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "themeget"] [Context: "[themeget]: http://jxnblk.com/..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
README.md:43 GH002/no-generic-link-text Avoid using generic link text like `Learn more` or `Click here` [For link: here] https://github.com/github/markdownlint-github/blob/main/docs/rules/GH002-no-generic-link-text.md
README.md:55:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "styled-components"] [Context: "[styled-components]: https://w..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
README.md:56:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "primer css"] [Context: "[primer css]: https://github.c..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053
README.md:57:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "flash of unstyled content"] [Context: "[flash of unstyled content]: h..."] https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md053

@github-actions github-actions bot temporarily deployed to storybook-preview-2726 December 29, 2022 18:48 Inactive
@khiga8
Copy link
Contributor Author

khiga8 commented Dec 29, 2022

no-duplicate-header is an issue that appears a lot!!

I think we could configure this rule to be sibling_only: true if primer/doctocat#527 gets resolved. (docs at MD024)

@khiga8
Copy link
Contributor Author

khiga8 commented Dec 29, 2022

Can I get a first-pass review from @primer/react-reviewers on these configs?

@khiga8 khiga8 marked this pull request as ready for review December 29, 2022 18:53
@khiga8 khiga8 requested review from a team and broccolinisoup December 29, 2022 18:53
@khiga8 khiga8 temporarily deployed to github-pages December 29, 2022 18:55 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2726 December 29, 2022 18:55 Inactive
Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

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

👋🏼 @khiga8 Thank you so much for this PR 🙏🏼 I left a couple of comments, let us know what you think!

package.json Outdated Show resolved Hide resolved
@@ -45,6 +45,7 @@
"install:docs": "(cd docs && npm install --legacy-peer-deps)",
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0",
Copy link
Member

Choose a reason for hiding this comment

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

We have a set of rules for the md and mdx files already on the eslint config. I am not sure if there would be any conflict between them? Or what do you suggest for us to do here?

Copy link
Contributor Author

@khiga8 khiga8 Jan 6, 2023

Choose a reason for hiding this comment

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

oooh interesting! I don't think eslint runs the same rulesets as markdownlint. do you know what ESLint rules are running on markdown?

@khiga8 khiga8 temporarily deployed to github-pages January 6, 2023 15:39 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2726 January 6, 2023 15:39 Inactive
// Rules we want to turn on but currently have too many violations
const rulesToEnforce = {
'fenced-code-language': false,
'no-duplicate-header': false, // Fix https://github.com/primer/doctocat/issues/527, then set this rule to `siblings_only: true`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@primer/react-reviewers FYI,no-duplicate-header should be turned on because doctocat messes up the anchor links when headings have the same text. See linked issue. I keep it off for now because there's too many address.

Ideally, the issue is fixed in doctocat so we don't have to set this rule to be strict.

@@ -38,7 +39,7 @@ On the other hand, if we want consumers to have more control over children, a co

With React, `children` is the out-of-the-box way for putting [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#phrasing_content) inside your component. By using `children` instead of our own custom prop, we can make the API “predictable” for its consumers.

<img width="373" alt="image" src="https://user-images.githubusercontent.com/1863771/144945223-70c4c800-5827-4985-9f18-0ab416eba058.png">
<img width="373" alt="image" src="https://user-images.githubusercontent.com/1863771/144945223-70c4c800-5827-4985-9f18-0ab416eba058.png"> <!-- markdownlint-disable-line no-default-alt-text -->
Copy link
Contributor Author

@khiga8 khiga8 Jan 10, 2023

Choose a reason for hiding this comment

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

@primer/react-reviewers This is a TODO! Feel free to suggest something in this PR to fix this!

@khiga8 khiga8 temporarily deployed to github-pages January 10, 2023 15:50 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2726 January 10, 2023 15:50 Inactive
@@ -2,7 +2,7 @@

Consider a React component that renders a list of items. Here are two possible APIs that component might expose, both achieving an equivalent result.

### A: Contents passed as React children
### A: Contents passed as React children <!-- markdownlint-disable-line heading-increment -->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@primer/react-reviewers This is a TODO! I'm not sure what the heading structure should be. Feel free to suggest something in this PR to fix this!

```

[Show full code example →](https://github.com/primer/react/pull/2019/files?diff=split&w=0)
```tsx
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Errr I think prettier ran for these files and updated it, but not sure. @primer/react-reviewers is this expected?

Comment on lines +9 to +22
const rulesToNotEnforce = {
'line-length': false,
'blanks-around-headings': false,
'blanks-around-lists': false,
'no-trailing-spaces': false,
'no-multiple-blanks': false,
'no-trailing-punctuation': false,
'single-trailing-newline': false,
'ul-indent': false,
'no-hard-tabs': false,
'first-line-heading': false,
'no-space-in-emphasis': false,
'blanks-around-fences': false,
}
Copy link
Contributor Author

@khiga8 khiga8 Jan 10, 2023

Choose a reason for hiding this comment

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

These are stylistic rules that I don't think Primer team cares to enforce for now, but not sure. Feel free to configure this to your preference!!!

@khiga8
Copy link
Contributor Author

khiga8 commented Jan 10, 2023

@primer/react-reviewers This is ready for another review. Please review thoroughly as this will impact developer workflow!

For the existing violations listed in #2726 (comment), I addressed some of them. You can go through them by commit.

There were two that I disabled inline, which are open to your fix suggestions:

Two of the rules, there were too many of to address immediately so I turned them off completely for now.
In particular, I think no-duplicate-header should be turned on based on how doctocat messes up heading anchors with the same text. If primer/doctocat#527 is addressed, that would alleviate the need for this rule.

@khiga8 khiga8 temporarily deployed to github-pages January 10, 2023 16:02 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2726 January 10, 2023 16:03 Inactive
@khiga8 khiga8 requested a review from broccolinisoup January 10, 2023 21:38
@joshblack joshblack added the 💓collab a vibrant hub of collaboration label Jan 11, 2023
Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Left a comment for the CI job, let me know what you think about it 👀 Would be great to include, if possible.

Comment on lines 43 to 44
- name: Lint
run: npm run markdownlint
Copy link
Member

Choose a reason for hiding this comment

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

Could we add this to the lint job as a step after npm run lint? Would be great to keep it in the same job for linting, something like:

      - name: Lint JavaScript
        run: npm run lint
      - name: Lint markdown
        run: npm run markdownlint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can do that! I got feedback in the primer/design repo that it's more clear when there are separate linting jobs for error clarity, but we can keep it together if you prefer. I don't have a strong opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

package.json Outdated Show resolved Hide resolved
@khiga8
Copy link
Contributor Author

khiga8 commented Jan 11, 2023

note to self to update the CONTRIBUTING.md

@khiga8
Copy link
Contributor Author

khiga8 commented Jan 11, 2023

Hi @joshblack! I addressed your review suggestions in d1f87d2.

I additionally updated the CONTRIBUTING.md file in 572c744.

@khiga8 khiga8 temporarily deployed to github-pages January 11, 2023 18:50 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2726 January 11, 2023 18:50 Inactive
@joshblack joshblack enabled auto-merge (squash) January 11, 2023 20:17
@joshblack
Copy link
Member

Thanks for doing this @khiga8! 🙌

@joshblack joshblack temporarily deployed to github-pages January 11, 2023 20:23 — with GitHub Actions Inactive
@joshblack joshblack merged commit 2e58630 into main Jan 11, 2023
@joshblack joshblack deleted the kh-add-markdown-lint branch January 11, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💓collab a vibrant hub of collaboration skip changeset This change does not need a changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants