diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4e45488126dad..053bfad342f18 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -26,7 +26,7 @@ You can check the items by adding an `x` between the brackets, like this: `[x]` --> - [ ] I have read the [Contributing Guidelines](https://github.com/nodejs/nodejs.org/blob/main/CONTRIBUTING.md) and made commit messages that follow the guideline. -- [ ] I have run `npx turbo format` to ensure the code follows the style guide. -- [ ] I have run `npx turbo test` to check if all tests are passing. +- [ ] I have run `npm run format` to ensure the code follows the style guide. +- [ ] I have run `npm run test` to check if all tests are passing. - [ ] I have run `npx turbo build` to check if the website builds without errors. - [ ] I've covered new added functionality with unit tests if necessary. diff --git a/.github/workflows/lint-and-tests.yml b/.github/workflows/lint-and-tests.yml index dfcb1183b5f47..cb732bdba38e1 100644 --- a/.github/workflows/lint-and-tests.yml +++ b/.github/workflows/lint-and-tests.yml @@ -60,7 +60,7 @@ jobs: (github.event_name == 'pull_request_target' && github.event.label.name == 'github_actions:pull-request') - name: Lint + name: Quality checks runs-on: ubuntu-latest needs: [base] @@ -116,8 +116,7 @@ jobs: # We also use `npm i` instead of `npm ci` so that the node_modules/.cache folder doesn't get deleted run: npm i --no-audit --no-fund --ignore-scripts --userconfig=/dev/null - - name: Run `turbo lint` - id: eslint-step + - name: Run quality checks with `turbo` # We run the ESLint and Prettier commands on all Workflow triggers of the `Lint` job, besides if # the Pull Request comes from a Crowdin Branch, as we don't want to run ESLint and Prettier on Crowdin PRs # Note: Linting and Prettifying of files on Crowdin PRs is handled by the `translations-pr.yml` Workflow @@ -127,13 +126,7 @@ jobs: github.event.pull_request.head.ref != 'chore/crowdin') # We want to enforce that the actual `turbo@latest` package is used instead of a possible hijack from the user # the `${{ needs.base.outputs.turbo_args }}` is a string substitution happening from the base job - run: npx --package=turbo@latest -- turbo lint ${{ needs.base.outputs.turbo_args }} - - - name: Run `turbo prettier` - if: steps.eslint-step.outcome == 'success' - # We want to enforce that the actual `turbo@latest` package is used instead of a possible hijack from the user - # the `${{ needs.base.outputs.turbo_args }}` is a string substitution happening from the base job - run: npx --package=turbo@latest -- turbo prettier ${{ needs.base.outputs.turbo_args }} + run: npx --package=turbo@latest -- turbo lint:js lint:md lint:css prettier ${{ needs.base.outputs.turbo_args }} - name: Run `tsc build` # We want to ensure that the whole codebase is passing and successfully compiles with TypeScript diff --git a/package.json b/package.json index 56f4d2ea8c83e..cb2321bb933c0 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "lint:js": "eslint \"**/*.{js,mjs,ts,tsx}\" --cache --cache-strategy=content --cache-location=.eslintjscache", "lint:md": "eslint \"**/*.md?(x)\" --cache --cache-strategy=content --cache-location=.eslintmdcache", "lint:css": "stylelint \"**/*.css\" --allow-empty-input --cache --cache-strategy=content --cache-location=.stylelintcache", - "lint": "npm run lint:js && npm run lint:md && npm run lint:css", - "lint:fix": "npm run lint:js -- --fix && npm run lint:md -- --fix && npm run lint:css -- --fix", + "lint": "turbo run lint:md lint:js lint:css", + "lint:fix": "turbo run lint:md lint:js lint:css --no-cache -- --fix", "prettier": "prettier \"**/*.{js,mjs,ts,tsx,md,mdx,json,yml,css}\" --check --cache --cache-strategy=content --cache-location=.prettiercache", "prettier:fix": "npm run prettier -- --write", "format": "npm run lint:fix && npm run prettier:fix", @@ -33,7 +33,7 @@ "storybook:build": "cross-env NODE_NO_WARNINGS=1 storybook build --quiet --webpack-stats-json", "test:unit": "cross-env NODE_NO_WARNINGS=1 jest", "test:unit:watch": "npm run test:unit -- --watch", - "test": "npm run test:unit", + "test": "turbo test:unit", "prepare": "husky" }, "dependencies": { diff --git a/turbo.json b/turbo.json index 84c680a424398..e74b6ebf61c0a 100644 --- a/turbo.json +++ b/turbo.json @@ -83,41 +83,33 @@ ] }, "lint:js": { - "cache": false, + "inputs": [ + "{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx,mjs}", + "{next-data,scripts,i18n}/**/*.{mjs,json}", + "{.storybook,public}/**/*.{ts,js,json}", + "*.{json,ts,tsx}" + ], "outputs": [".eslintjscache"] }, "lint:md": { - "cache": false, + "inputs": ["{app,pages}/**/*.{md,mdx}", "*.{md,mdx}"], "outputs": [".eslintmdcache"] }, "lint:css": { - "cache": false, + "inputs": ["{app,components,layouts,pages,styles}/**/*.css"], "outputs": [".stylelintcache"] }, - "lint": { - "cache": false, - "outputs": [".eslintjscache", ".eslintmdcache", ".stylelintcache"] - }, "lint:fix": { - "cache": false, - "outputs": [".eslintjscache", ".eslintmdcache", ".stylelintcache"] + "cache": false }, "prettier": { - "cache": false, "outputs": [".prettiercache"] }, "prettier:fix": { - "cache": false, - "outputs": [".prettiercache"] + "cache": false }, "format": { - "cache": false, - "outputs": [ - ".eslintjscache", - ".eslintmdcache", - ".stylelintcache", - ".prettiercache" - ] + "cache": false }, "storybook": { "cache": false, @@ -143,16 +135,6 @@ "*.{md,mdx,json,ts,tsx,mjs,yml}" ], "outputs": ["coverage/**", "junit.xml"] - }, - "test": { - "inputs": [ - "{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx,mjs}", - "{app,components,layouts,pages,styles}/**/*.css", - "{next-data,scripts,i18n}/**/*.{mjs,json}", - "{app,pages}/**/*.{mdx,md}", - "*.{md,mdx,json,ts,tsx,mjs,yml}" - ], - "outputs": ["coverage/**", "junit.xml"] } } }