Skip to content

Commit

Permalink
feat(lint): Implement front matter validator and linter (#26410)
Browse files Browse the repository at this point in the history
* feat(lint): Implement front matter validator and linter

* run unit tests on commit

* Use 'anyOf' in schema and add to unit tests

* Fix some content pages
  • Loading branch information
OnkarRuikar authored Apr 28, 2023
1 parent f4bdc61 commit 307cd1c
Show file tree
Hide file tree
Showing 25 changed files with 3,852 additions and 821 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/markdown-lint-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
run: yarn --frozen-lockfile

- name: Lint markdown files
run: yarn fix:md
run: |
yarn fix:md
yarn fix:fm
- name: Create PR with only fixable issues
if: success()
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jobs:
run: |
echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json"
yarn lint:md
yarn lint:fm
2 changes: 2 additions & 0 deletions .github/workflows/pr-check_markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ jobs:
echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json"
files_to_lint="${{ env.DIFF_DOCUMENTS }}"
yarn markdownlint-cli2 ${files_to_lint}
echo "Linting front-matter"
node scripts/front-matter_linter.js ${files_to_lint}
8 changes: 6 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"*": "prettier --ignore-unknown --write",
"*.md": "markdownlint-cli2-fix",
"!*.md": "prettier --ignore-unknown --write",
"*.md": [
"markdownlint-cli2-fix",
"node scripts/front-matter_linter.js --fix true"
],
"tests/**/*.*": "yarn test:front-matter-linter",
"*.{svg,png,jpeg,jpg,gif}": "yarn filecheck"
}
2 changes: 1 addition & 1 deletion .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
}
},
"customRules": ["markdownlint-rule-search-replace"],
"ignores": ["node_modules", ".github"]
"ignores": ["node_modules", ".github", "tests"]
}
2 changes: 1 addition & 1 deletion files/en-us/glossary/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "MDN Web Docs Glossary: Definitions of Web-related terms"
slug: Glossary
page-type: glossary-definition
page-type: landing-page
---

Web technologies contain long lists of jargon and abbreviations that are used in documentation and coding. This glossary provides definitions of words and abbreviations you need to know to successfully understand and build for the web.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ short-title: webkitConvertPointFromPageToNode()
slug: Web/API/Window/webkitConvertPointFromPageToNode
page-type: web-api-instance-method
status:
- non-standard
- deprecated
- non-standard
browser-compat: api.Window.webkitConvertPointFromPageToNode
---

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/css/css_scrollbars/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
title: CSS scrollbars styling
slug: Web/CSS/CSS_Scrollbars
page-type: css-module
spec-urls: https://w3c.github.io/csswg-drafts/css-scrollbars/
browser-compat:
- css.properties.scrollbar-color
- css.properties.scrollbar-width
spec-urls: https://w3c.github.io/csswg-drafts/css-scrollbars/
---

{{CSSRef}}{{SeeCompatTable}}
Expand Down
Loading

0 comments on commit 307cd1c

Please sign in to comment.