diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000000..21b9d30ceb --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,21 @@ +name: Format + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - run: npm ci + - name: Format + run: | + npm run format diff --git a/package.json b/package.json index 09705c8907..9d26fd4a51 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "test:ci:changed": "nx affected -t test --base=origin/main --head=HEAD", "test-all-versions": "nx run-many -t test-all-versions", "changelog": "lerna-changelog", + "format": "prettier --check $(git ls-files '*.ts')", + "format:fix": "prettier --write $(git ls-files '*.ts')", "lint": "nx run-many -t lint && npm run lint:readme && npm run lint:markdown", "lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix", "lint:deps": "npx --yes knip@5.33.3 --dependencies --production --tags=-knipignore",