diff --git a/.github/workflows/frontend_checks.yml b/.github/workflows/frontend_checks.yml index ea50803c54..6e07a40580 100644 --- a/.github/workflows/frontend_checks.yml +++ b/.github/workflows/frontend_checks.yml @@ -73,14 +73,8 @@ jobs: exit 1 fi - - name: Typecheck - run: npm run typecheck - - - name: Lint - run: npm run lint - - - name: Format - run: npm run format:ci + - name: Check (lint, format, typecheck) + run: npm run check:ci - name: Unit tests run: npm run test diff --git a/.pre-commit-config-with-static-check.yml b/.pre-commit-config-with-static-check.yml index a9f5d1f78a..6f8dbb97a5 100644 --- a/.pre-commit-config-with-static-check.yml +++ b/.pre-commit-config-with-static-check.yml @@ -52,14 +52,14 @@ repos: - id: npm-run-format name: npm-run-format - description: Check for frontend linting errors + description: Format frontend code entry: sh -c 'cd clients; npm run format' language: system types: [javascript, jsx, ts, tsx] - id: npm-run-lint name: npm-run-lint - description: Check for frontend linting errors - entry: sh -c 'cd clients; npm run lint:fix' + description: Lint and fix frontend code + entry: sh -c 'cd clients; npm run lint' language: system types: [javascript, jsx, ts, tsx] diff --git a/changelog/7755-add-check-scripts.yaml b/changelog/7755-add-check-scripts.yaml new file mode 100644 index 0000000000..9f1c71f6e5 --- /dev/null +++ b/changelog/7755-add-check-scripts.yaml @@ -0,0 +1,4 @@ +type: Developer Experience +description: Added combined check and check:ci scripts for lint, format, and typecheck +pr: 7755 +labels: [] diff --git a/clients/admin-ui/package.json b/clients/admin-ui/package.json index 79679c86cc..6026dbf67a 100644 --- a/clients/admin-ui/package.json +++ b/clients/admin-ui/package.json @@ -21,8 +21,10 @@ "prod-export": "npm run export && npm run copy-export", "format": "prettier --write .", "format:ci": "prettier --check .", - "lint": "next lint && eslint ./cypress/e2e/**/*.ts ./cypress/support/**/*.ts", - "lint:fix": "eslint --fix . && eslint --fix ./cypress/e2e/**/*.ts ./cypress/support/**/*.ts", + "check": "npm run lint && npm run format && npm run typecheck", + "check:ci": "npm run lint:ci && npm run format:ci && npm run typecheck", + "lint": "eslint --fix .", + "lint:ci": "eslint .", "lint-staged:fix": "lint-staged --diff=main", "openapi:generate": "openapi --input http://localhost:8080/openapi.json --output ./src/types/api --exportCore false --exportServices false --indent 2 && prettier --write .", "openapi:generate-dictionary": "openapi --input http://localhost:8081/openapi.json --output ./src/types/dictionary-api --exportCore false --exportServices false --indent 2", diff --git a/clients/fides-js/package.json b/clients/fides-js/package.json index 4559fa3589..8d7b3bda3a 100644 --- a/clients/fides-js/package.json +++ b/clients/fides-js/package.json @@ -39,8 +39,10 @@ "docs:generate": "typedoc --tsconfig ./tsconfig.json --out docs src/docs/ ", "format": "prettier --write .", "format:ci": "prettier --check .", - "lint": "eslint .", - "lint:fix": "eslint --fix .", + "check": "npm run lint && npm run format && npm run typecheck", + "check:ci": "npm run lint:ci && npm run format:ci && npm run typecheck", + "lint": "eslint --fix .", + "lint:ci": "eslint .", "test": "jest", "test:watch": "jest --watchAll", "typecheck": "tsc --noEmit" diff --git a/clients/fidesui/package.json b/clients/fidesui/package.json index 31a47b7b00..4e77c7c882 100644 --- a/clients/fidesui/package.json +++ b/clients/fidesui/package.json @@ -5,8 +5,10 @@ "types": "src/index.ts", "type": "module", "scripts": { - "lint": "eslint .", - "lint:fix": "eslint --fix .", + "check": "npm run lint && npm run format && npm run typecheck", + "check:ci": "npm run lint:ci && npm run format:ci && npm run typecheck", + "lint": "eslint --fix .", + "lint:ci": "eslint .", "format": "prettier --write .", "format:ci": "prettier --check .", "typecheck": "tsc --noEmit", diff --git a/clients/package.json b/clients/package.json index 81a07c556e..38ab3cc249 100644 --- a/clients/package.json +++ b/clients/package.json @@ -16,8 +16,10 @@ "dev-admin-ui": "turbo run dev --filter=admin-ui", "dev-pc": "turbo run dev --filter=privacy-center", "start": "turbo run start", + "check": "turbo run check", + "check:ci": "turbo run check:ci", "lint": "turbo run lint --force", - "lint:fix": "turbo run lint:fix --force", + "lint:ci": "turbo run lint:ci --force", "format": "turbo run format", "format:ci": "turbo run format:ci", "test": "turbo run test", diff --git a/clients/privacy-center/package.json b/clients/privacy-center/package.json index 78a544d469..6a95b02ad0 100644 --- a/clients/privacy-center/package.json +++ b/clients/privacy-center/package.json @@ -9,8 +9,10 @@ "build:test": "NODE_ENV=test FIDES_PRIVACY_CENTER__IS_OVERLAY_ENABLED=true next build", "start": "next start", "start:test": "FIDES_PRIVACY_CENTER__ENABLE_EXTERNAL_TASK_PORTAL=true next start -p 3001", - "lint": "next lint && eslint ./cypress/**/*.ts", - "lint:fix": "eslint --fix . && eslint --fix ./cypress/**/*.ts", + "check": "npm run lint && npm run format && npm run typecheck", + "check:ci": "npm run lint:ci && npm run format:ci && npm run typecheck", + "lint": "eslint --fix .", + "lint:ci": "eslint .", "lint-staged:fix": "lint-staged --diff=main", "format": "prettier --write .", "format:ci": "prettier --check .", diff --git a/clients/turbo.json b/clients/turbo.json index cb1cbd4469..8fce9e5c38 100644 --- a/clients/turbo.json +++ b/clients/turbo.json @@ -29,16 +29,24 @@ "dependsOn": ["build"], "outputs": [".next/*", "!.next/cache/*"] }, - "lint": { - "dependsOn": [] + "check": { + "dependsOn": ["^build"], + "cache": false + }, + "check:ci": { + "dependsOn": ["^build"] }, - "lint:fix": { + "lint": { "dependsOn": [], "cache": false }, - "format": { + "lint:ci": { "dependsOn": [] }, + "format": { + "dependsOn": [], + "cache": false + }, "format:ci": { "dependsOn": [] },