Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-24-bookworm",
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "lts"
"version": "10.0"
},
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
},
"ghcr.io/devcontainers-contrib/features/jest:2": {}
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// "postCreateCommand": "pnpm install",

"customizations": {
"vscode": {
Expand All @@ -29,14 +28,11 @@
"bierner.emojisense",
"djlynn03.add-to-git-ignore",
"EditorConfig.EditorConfig",
"dbaeumer.vscode-eslint",
"biomejs.biome",
"mhutchie.git-graph",
"GitHub.copilot",
"GitHub.copilot-chat",
"eamodio.gitlens",
"vespa-dev-works.jestRunIt",
"firsttris.vscode-jest-runner",
"kavod-io.vscode-jest-test-adapter",
"christian-kohler.path-intellisense",
"pflannery.vscode-versionlens",
"rioukkevin.vscode-git-commit",
Expand Down
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

88 changes: 0 additions & 88 deletions .eslintrc.json

This file was deleted.

22 changes: 20 additions & 2 deletions .github/workflows/test-dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup-dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: dotnet-format
id: dotnet-format
uses: ./
Expand All @@ -27,14 +31,23 @@ jobs:
jscpdCheckAsError: true

- name: log-output
run: echo "${{ steps.dotnet-format.outputs.output }}"
env:
HAS_CHANGES: ${{ steps.dotnet-format.outputs.hasChanges }}
HAS_DUPLICATES: ${{ steps.dotnet-format.outputs.hasDuplicates }}
run: |
echo "hasChanges=$HAS_CHANGES"
echo "hasDuplicates=$HAS_DUPLICATES"

dotnet-format-config:
name: "🧪 Test dotnet-format with config"
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup-dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: dotnet-format
id: dotnet-format
uses: ./
Expand All @@ -46,4 +59,9 @@ jobs:
jscpdCheckAsError: true

- name: log-output
run: echo "${{ steps.dotnet-format.outputs.output }}"
env:
HAS_CHANGES: ${{ steps.dotnet-format.outputs.hasChanges }}
HAS_DUPLICATES: ${{ steps.dotnet-format.outputs.hasDuplicates }}
run: |
echo "hasChanges=$HAS_CHANGES"
echo "hasDuplicates=$HAS_DUPLICATES"
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

18 changes: 0 additions & 18 deletions .prettierrc.json

This file was deleted.

18 changes: 14 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"typescript.format.semicolons": "insert",
"typescript.inlayHints.enumMemberValues.enabled": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"typescript.implementationsCodeLens.enabled": true,
"javascript.referencesCodeLens.enabled": true,
"javascript.referencesCodeLens.showOnAllFunctions": true,
"typescript.referencesCodeLens.enabled": true,
"typescript.referencesCodeLens.showOnAllFunctions": true
}
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ Yet another dotnet format. It combines dotnet format with jscpd to provide a sin
- (optional) commit changes
- (optional) update existing PR comment

## Requirements

- **Node 24** runtime — the action runs on `node24` (handled automatically by GitHub).
- **.NET SDK** must be available on the runner (e.g. via `actions/setup-dotnet`). The
bundled example/tests target **.NET 10**.
- **jscpd 5** — when `jscpdCheck` is enabled, the action uses a `jscpd`/`cpd` binary found
on `PATH`, otherwise it fetches it on demand with `npx --yes jscpd@5` (a one-time download).
To avoid the download, install jscpd on the runner (`npm i -g jscpd`).

> Note on config keys: the granular `options`/`styleOptions`/`analyzersOptions`/`whitespaceOptions`
> blocks are toggled with `isEnabled`. The historical misspelling `isEabled` is still accepted for
> backward compatibility.

## Demo

- generate report as comment
Expand All @@ -38,7 +51,29 @@ example:
- [example jscpd config](./__tests__/dotnet/ConfigConsoleApp/.jscpd.json)
- [Action input](./action.yml)

## Aknowledgements
## Development

This is a TypeScript GitHub Action bundled with [`ncc`](https://github.com/vercel/ncc) into
`dist/`. The toolchain is modern and dependency-light:

- **Node 24** (ESM, `"type": "module"`)
- **[pnpm](https://pnpm.io/)** as the package manager (`packageManager` field; CI uses `pnpm/action-setup`)
- **[Biome](https://biomejs.dev/)** for linting + formatting (`biome.json`)
- **`node:test`** (Node's built-in runner) for tests — no Jest

```bash
pnpm install
pnpm build # tsc --noEmit typecheck
pnpm lint # biome lint
pnpm test # node --test
pnpm package # ncc build -> dist/index.js
pnpm all # everything CI runs (build, format-check, package, test, finalize dist)
```

The committed `dist/` must stay in sync with the source — run `pnpm all` and commit `dist/`
before pushing. See [WALKTHROUGH.md](./WALKTHROUGH.md) for the design rationale and migration notes.

## Acknowledgements

This project is based on / inspired by lots of other projects, including but not limited to:

Expand Down
Loading
Loading