Skip to content

Commit 39f0ae7

Browse files
authored
Merge pull request #3885 from tarlepp/chore(ops)/markdown-linter
Chore(ops) - Markdown linter improvements
2 parents 4754b09 + ad55b9e commit 39f0ae7

5 files changed

Lines changed: 49 additions & 17 deletions

File tree

.github/workflows/main.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,11 @@ jobs:
5353
steps:
5454
- *checkout_step
5555

56-
- name: Lint all markdown documentation files
57-
uses: DavidAnson/markdownlint-cli2-action@ded1f9488f68a970bc66ea5619e13e9b52e601cd # v23.2.0
58-
with:
59-
globs: |
60-
README.md
61-
CLAUDE.md
62-
doc/*.md
63-
.github/*.md
56+
- name: Setup Node + Corepack + Yarn deps
57+
uses: ./.github/actions/setup-yarn
58+
59+
- name: Run `yarn lint:md`
60+
run: yarn lint:md
6461

6562
check-translations:
6663
name: Check that translations are up-to-date

Makefile

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ else
105105
$(WARNING_DOCKER)
106106
endif
107107

108-
lint: ## Lint TypeScript and SCSS files
108+
lint: ## Lint TypeScript, SCSS, and Markdown files
109109
ifeq ($(INSIDE_DOCKER), 1)
110110
@make lint-ts
111111
@make lint-scss
112+
@make lint-md
112113
else ifeq ($(strip $(IS_RUNNING)),)
113114
$(WARNING_DOCKER)
114115
else
@@ -138,10 +139,22 @@ else
138139
@HOST_UID=$(HOST_UID) HOST_GID=$(HOST_GID) docker compose exec node make lint-scss
139140
endif
140141

141-
fix: ## Fix TypeScript and SCSS files
142+
lint-md: ## Lint Markdown files
143+
ifeq ($(INSIDE_DOCKER), 1)
144+
@echo "\033[32mLinting Markdown files\033[39m"
145+
@yarn run lint:md
146+
else ifeq ($(strip $(IS_RUNNING)),)
147+
$(WARNING_DOCKER)
148+
else
149+
$(NOTICE_HOST)
150+
@HOST_UID=$(HOST_UID) HOST_GID=$(HOST_GID) docker compose exec node make lint-md
151+
endif
152+
153+
fix: ## Fix TypeScript, SCSS, and Markdown files
142154
ifeq ($(INSIDE_DOCKER), 1)
143155
@make fix-ts
144156
@make fix-scss
157+
@make fix-md
145158
else ifeq ($(strip $(IS_RUNNING)),)
146159
$(WARNING_DOCKER)
147160
else
@@ -171,6 +184,17 @@ else
171184
@HOST_UID=$(HOST_UID) HOST_GID=$(HOST_GID) docker compose exec node make fix-scss
172185
endif
173186

187+
fix-md: ## Fix Markdown files
188+
ifeq ($(INSIDE_DOCKER), 1)
189+
@echo "\033[32mFixing Markdown files\033[39m"
190+
@yarn run fix:md
191+
else ifeq ($(strip $(IS_RUNNING)),)
192+
$(WARNING_DOCKER)
193+
else
194+
$(NOTICE_HOST)
195+
@HOST_UID=$(HOST_UID) HOST_GID=$(HOST_GID) docker compose exec node make fix-md
196+
endif
197+
174198
extract-translations: ## Extract translations from TypeScript and HTML template files
175199
ifeq ($(INSIDE_DOCKER), 1)
176200
@echo "\033[32mExtracting translations\033[39m"

doc/COMMANDS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ make start # Start application in development mode
4646
make start-immutable # Start development mode with `yarn install --immutable` in container entrypoint
4747
make start-build # Start application in development mode and rebuild container
4848
make start-production # Start application with the local production Angular configuration
49+
make start-yarn # Run `yarn start` inside the running container
50+
make start-yarn-prod # Run `yarn start-prod` inside the running container
4951
make stop # Stop application containers
5052
```
5153

@@ -59,12 +61,14 @@ make fish # Open a fish shell inside the node container
5961
### Linting and fixing
6062

6163
```bash
62-
make lint # Run TypeScript and SCSS linting
64+
make lint # Run TypeScript, SCSS, and Markdown linting
6365
make lint-ts # Run Angular/TypeScript linting
6466
make lint-scss # Run SCSS linting with stylelint
65-
make fix # Run TypeScript and SCSS auto-fixes
67+
make lint-md # Run markdownlint for all tracked Markdown files
68+
make fix # Run TypeScript, SCSS, and Markdown auto-fixes
6669
make fix-ts # Run Angular/TypeScript lint fixes
6770
make fix-scss # Run SCSS auto-fixes with stylelint
71+
make fix-md # Run markdownlint auto fixes for tracked Markdown files
6872
```
6973

7074
### Translations
@@ -114,8 +118,10 @@ yarn build-prod # Create a production build
114118
yarn test # Run unit tests
115119
yarn lint:ts # Run Angular/TypeScript linting
116120
yarn lint:scss # Run stylelint for SCSS files
121+
yarn lint:md # Run markdownlint for all tracked Markdown files
117122
yarn fix:ts # Auto-fix Angular/TypeScript lint issues
118123
yarn fix:scss # Auto-fix SCSS lint issues
124+
yarn fix:md # Auto-fix markdownlint issues in tracked Markdown files
119125
yarn extract-translations # Extract translation keys
120126
yarn check-translations # Validate translation files
121127
yarn i18n:extract # Run Transloco key extraction

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
"test": "ng test",
2424
"lint:ts": "ng lint",
2525
"lint:scss": "npx stylelint '**/*.scss'",
26+
"lint:md": "git ls-files '*.[mM][dD]' | xargs -r npx markdownlint-cli2",
2627
"fix:ts": "ng lint --fix",
2728
"fix:scss": "npx stylelint --fix '**/*.scss'",
29+
"fix:md": "git ls-files '*.[mM][dD]' | xargs -r npx markdownlint-cli2 --fix",
2830
"e2e": "ng e2e",
2931
"extract-translations": "transloco-keys-manager extract --sort --unflat --remove-extra-keys --emit-error-on-extra-keys --default-value=null && node -e \"const fs=require('fs');for(const file of fs.readdirSync('src/assets/i18n').filter((name)=>name.endsWith('.json'))){fs.appendFileSync('src/assets/i18n/'+file,'\\n');}\"",
3032
"check-translations": "sed -i 's/_/__/g; s/: null/x_x/g; s/: \"--- MISSING TRANSLATION ---\"/: null/g; s/x_x/: \"--- MISSING TRANSLATION ---\"/g; s/__/_/g' ./src/assets/i18n/*.json && git diff --exit-code ./src/assets/i18n/*.json",

scripts/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ File: `scripts/project-stats.sh`
2727
make project-stats
2828
```
2929

30-
If you are already inside the container, you can still run `bash scripts/project-stats.sh` directly.
30+
If you are already inside the container, you can still run
31+
`bash scripts/project-stats.sh` directly.
3132

3233
### GitHub Actions update checker
3334

@@ -37,7 +38,8 @@ File: `scripts/check-action-updates.sh`
3738
make check-action-updates
3839
```
3940

40-
If you are already inside the container, you can still run `bash scripts/check-action-updates.sh` directly.
41+
If you are already inside the container, you can still run
42+
`bash scripts/check-action-updates.sh` directly.
4143

4244
Print current pins as markdown:
4345

@@ -46,9 +48,10 @@ bash scripts/check-action-updates.sh --current-pins-md
4648
```
4749

4850
Exit codes:
49-
- `0` = no discovery issues and no updates found
50-
- `1` = updates available
51-
- `2` = discovery issues found (for example unpinned refs or conflicting versions)
51+
52+
* `0` = no discovery issues and no updates found
53+
* `1` = updates available
54+
* `2` = discovery issues found (for example unpinned refs or conflicting versions)
5255

5356
---
5457

0 commit comments

Comments
 (0)