From 0a8c471a6c286431358cdc5f5d69ff731bb5828f Mon Sep 17 00:00:00 2001 From: Nathan Muir Date: Tue, 19 Aug 2025 12:27:18 +1200 Subject: [PATCH] ci: check pull requests keep `prettier` formatting --- .github/workflows/prettier.yml | 13 +++++++++++++ package.json | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/prettier.yml diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 00000000..738b747c --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,13 @@ +name: check formatting +on: + pull_request: +jobs: + fmt-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version: 'latest' + - run: npm install + - run: npm run fmt:check diff --git a/package.json b/package.json index 852f876d..e267861d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,8 @@ "start": "npm run test:watch", "compile": "npm run clean && npm run tsc && cp ./src/index-types.d.ts ./lib/index-types.d.ts && npm run rollup", "build": "npm run compile && cp ./src/index-types.d.ts ./lib && gulp build && node ./rename-imports.mjs", + "fmt": "prettier --write .", + "fmt:check": "prettier --check .", "test:import": "npm run build && node ./test/import-test.cjs && node ./test/import-test.mjs", "test": "npm run test:browser && npm run test:node && npm run test:import", "test:build": "PARCEL_WORKER_BACKEND=process parcel build ./test/unit-tests.html --dist-dir ./test-build --target none --public-url ./ --no-source-maps", @@ -100,6 +102,7 @@ "mocha": "10.2.0", "mocha-headless-chrome": "^4.0.0", "parcel": "2.13.3", + "prettier": "^3.6.2", "process": "^0.11.10", "rollup": "^4.46.2", "rollup-plugin-typescript2": "^0.36.0", @@ -116,7 +119,8 @@ "html5" ], "prettier": { - "singleQuote": true + "singleQuote": true, + "trailingComma": "es5" }, "bugs": { "url": "https://github.com/konvajs/konva/issues"