diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 9fe0eba..daa04ae 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -31,26 +31,17 @@ jobs: - run: npm run eslint - run: npm run tseslint - # Checks code formatting, fails if there are changes after applying prettier. - # Based on this example here: - # https://github.com/creyD/prettier_action?tab=readme-ov-file#example-4-dry-run + # Checks code formatting using the version pinned in package-lock.json. prettier: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 + - name: Use Node.js 24.x + uses: actions/setup-node@v6 with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config - persist-credentials: false - - - name: Prettify code - uses: creyD/prettier_action@v4.6 - with: - # "dry" causes that if any file is modified, the job fails - dry: True - # "write" performs changes in place - prettier_options: --write lib/*.ts test/*.js example/*.js - github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + node-version: 24.x + cache: 'npm' + - run: npm ci + - run: npm run prettier:check diff --git a/package.json b/package.json index 27c688c..d7fc80e 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,14 @@ "types": "build/raygun.aws.d.ts", "scripts": { "//eslint": "performs static analysis over JS files and examples", - "eslint": "eslint --config eslint.config.mjs --fix test/*.js example/*.js", + "eslint": "eslint --config eslint.config.mjs test/*.js example/*.js", + "eslint:fix": "eslint --config eslint.config.mjs --fix test/*.js example/*.js", "//tseslint": "performs static analysis over TS files and examples", - "tseslint": "eslint --config tseslint.config.mjs --fix lib/*.ts", - "//prettier": "performs code formatting over project files", - "prettier": "prettier --write lib/*.ts test/*.js", + "tseslint": "eslint --config tseslint.config.mjs lib/*.ts", + "tseslint:fix": "eslint --config tseslint.config.mjs --fix lib/*.ts", + "//prettier": "performs code formatting over project files and examples", + "prettier": "prettier --write lib/*.ts test/*.js example/*.js", + "prettier:check": "prettier --check lib/*.ts test/*.js example/*.js", "//prepare": "prepare project for distribution", "prepare": "tsc", "//test": "runs tests on main project",