Skip to content

Commit

Permalink
chore: Opt-in cleaned folders and CI for Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Nov 11, 2022
1 parent d6321f2 commit cbc8707
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ on:
branches:
- main
paths:
- .github/workflows/markdown-lint.yml
- .github/workflows/markdownlint-problem-matcher.json
- .markdownlint-cli2.jsonc
- .prettierignore
- .prettierrc.json
- package.json
- yarn.lock
- .github/workflows/markdown-lint.yml
- .github/workflows/markdownlint-problem-matcher.json

jobs:
docs:
lint:
runs-on: ubuntu-latest

steps:
Expand All @@ -25,8 +27,7 @@ jobs:
cache: yarn

- name: Install all yarn packages
run: |
yarn --frozen-lockfile
run: yarn --frozen-lockfile

- name: Lint markdown files
run: |
Expand Down
34 changes: 29 additions & 5 deletions .github/workflows/pr-check_markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "**/*.md"

jobs:
docs:
cli2:
runs-on: ubuntu-latest

steps:
Expand All @@ -18,8 +18,7 @@ jobs:
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
**/*.md
files: "**/*.md"

- name: Setup Node.js environment
uses: actions/setup-node@v3
Expand All @@ -28,11 +27,36 @@ jobs:
cache: yarn

- name: Install all yarn packages
run: |
yarn --frozen-lockfile
run: yarn --frozen-lockfile

- name: Lint markdown files
run: |
echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json"
files_to_lint="${{ steps.changed-files.outputs.all_changed_files }}"
yarn markdownlint-cli2 ${files_to_lint}
prettier:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: "**/*.md"

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
cache: yarn

- name: Install all yarn packages
run: yarn --frozen-lockfile

- name: Prettier markdown files
run: |
files_to_lint="${{ steps.changed-files.outputs.all_changed_files }}"
yarn prettier -c ${files_to_lint}
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@ build/

# Ignore markdown files till full pass is made on each folder
*.md

# Opt-in folders that have prettier run on them
!/*.md
!/files/en-us/games/**/*.md
!/files/en-us/glossary/**/*.md
!/files/en-us/related/**/*.md
!/files/en-us/webassembly/**/*.md

# Folders that have not fully run prettier for their code fences
# !/files/en-us/learn/**/*.md
# !/files/en-us/mdn/**/*.md
# !/files/en-us/mozilla/**/*.md
# !/files/en-us/web/**/*.md
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"filecheck": "env-cmd --silent cross-env CONTENT_ROOT=files yari-filecheck --cwd=.",
"fix:js": "prettier -w \"**/*.(m)?js\"",
"fix:json": "prettier -w \"**/*.json(c)?\"",
"fix:md": "markdownlint-cli2-fix \"**/*.md\"",
"fix:md": "markdownlint-cli2-fix \"**/*.md\" && prettier -w \"**/*.md\"",
"fix:yml": "prettier -w \"**/*.yml\"",
"lint:js": "prettier -c \"**/*.(m)?js\"",
"lint:json": "prettier -c \"**/*.json(c)?\"",
"lint:md": "markdownlint-cli2 \"**/*.md\"",
"lint:md": "markdownlint-cli2 \"**/*.md\" && prettier -c \"**/*.md\"",
"lint:yml": "prettier -c \"**/*.yml\"",
"prepare": "husky install",
"start": "yarn up-to-date-check && env-cmd --silent cross-env CONTENT_ROOT=files REACT_APP_DISABLE_AUTH=true BUILD_OUT_ROOT=build yari-server",
Expand Down

0 comments on commit cbc8707

Please sign in to comment.