Skip to content

Commit d67571e

Browse files
committed
separate lint & lint:fix
1 parent 101046d commit d67571e

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/doctoc.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,4 @@ jobs:
2828
- name: Install dependencies
2929
run: npm ci
3030
- name: Run doctoc
31-
run: npx doctoc --update-only .
32-
- name: Check for changes
33-
run: git diff --exit-code
31+
run: npm run format:toc:check

.github/workflows/prettier.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: Install dependencies
2020
run: npm ci
2121
- name: Run Prettier
22-
run: npx prettier --check .
22+
run: npm run format:prettier:check

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,25 @@ Make changes in your branch and then submit your contribution as a [pull request
7575

7676
## Linting
7777

78-
After making changes, execute the following to check for correct formatting. This runs the linting scripts `format:toc` and `format:prettier`. Check the output to see if there are any formatting issues that need manual correction:
78+
After making changes, execute the following to check for correct formatting.
79+
This runs the linting scripts `format:toc:check` and `format:prettier:check`.
7980

8081
```shell
8182
npm run lint
8283
```
8384

85+
To fix any linting issues that are automatically fixable, execute:
86+
87+
```shell
88+
npm run lint:fix
89+
```
90+
8491
Alternatively use any of the following commands to call one of the underlying linting utilities:
8592

8693
| Command | Purpose |
8794
| ------------------------------- | --------------------------------------- |
8895
| `npm run format:toc` | Reformats any Table of Contents |
96+
| `npm run format:toc:check` | Read-only Table of Contents check |
8997
| `npm run format:prettier` | Reformats multiple types of source code |
9098
| `npm run format:prettier:check` | Read-only prettier check |
9199

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
"type": "commonjs",
66
"scripts": {
77
"format:toc": "doctoc --update-only .",
8+
"format:toc:check": "doctoc --update-only --dryrun .",
89
"format:prettier": "prettier --write .",
910
"format:prettier:check": "prettier --check .",
10-
"lint": "run-s format:toc format:prettier",
11+
"lint": "run-s format:toc:check format:prettier:check",
12+
"lint:fix": "run-s format:toc format:prettier",
1113
"check:markdown-links": "find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check -c markdown_link_check_config.json"
1214
},
1315
"devDependencies": {

0 commit comments

Comments
 (0)