Skip to content

Commit

Permalink
build: use same pattern for format / lint run scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 committed Nov 12, 2024
1 parent f1f9420 commit 38ead29
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 20 deletions.
3 changes: 0 additions & 3 deletions .ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ unit-test-libs:
unit-test-schematics:
cd .. && pnpm run test:unit:schematics:coverage

format-check:
cd .. && pnpm run format-check-all

release:
cd .. && pnpm semantic-release

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- name: Setup
uses: ./.github/actions/setup
- name: Format check
run: cd .ci && make format-check
run: pnpm run format:check

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"!(*.{json,ts})": ["pnpm run format"],
"*.{json,ts}": ["pnpm run lint:code:raw --fix", "pnpm run format"],
"!(*.{json,ts})": ["pnpm run format:files"],
"*.{json,ts}": ["pnpm run lint:code:files --fix", "pnpm run format:files"],
".github/**/*.{yml,yaml}": ["pnpm run lint:gh-actions"]
}
8 changes: 3 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,15 @@ The global coverage report will be in `lcov`(`.info`) and HTML format.
You can run

```sh
pnpm run format-check-all
pnpm run format
```

To look for formatting errors. And
To format all files in the repository. Or if just wanting to check if files are properly formatted, run:

```sh
pnpm run format-all
pnpm run format:check
```

To fix them all

[Git hooks] are provided to automatically ensure code is formatted before committing it.

### Lint
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
"commitlint-last": "commitlint --last --verbose",
"coverage:move-to-nyc-output": "rm -rf .nyc_output && mkdir .nyc_output && cp -f $(find coverage -type f -name '*.json') .nyc_output",
"coverage:report:all": "pnpm run coverage:move-to-nyc-output && nyc report --reporter lcov --report-dir coverage",
"format": "prettier --ignore-unknown --write",
"format-all": "npm run format -- .",
"format-check": "prettier --check",
"format-check-all": "npm run format-check -- .",
"format": "pnpm run format:files .",
"format:check": "pnpm run format:check:files .",
"format:check:files": "prettier --check",
"format:files": "prettier --ignore-unknown --write",
"instrument-for-coverage": "./instrument-for-coverage.sh",
"lint": "pnpm run '/^lint:[\\w-]+$/'",
"lint:code": "pnpm run lint:code:raw .",
"lint:code:raw": "eslint --max-warnings 0",
"lint:code": "pnpm run lint:code:files .",
"lint:code:files": "eslint --max-warnings 0",
"lint:code:files//": "☝️ lint-staged can't/shouldn't use 'ng lint'",
"lint:commit-message": "pnpm run commitlint-edit-msg",
"lint:gh-actions": "./actionlint.sh",
"ngx-meta:api-documenter": "api-documenter markdown -i ./projects/ngx-meta/api-extractor -o ./projects/ngx-meta/docs/content/api",
Expand Down

0 comments on commit 38ead29

Please sign in to comment.