diff --git a/.eslintrc.json b/.eslintrc.json index 28bcfc67..399d95f7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -29,9 +29,9 @@ "plugin:import/warnings", "plugin:jest/recommended", "plugin:node/recommended-module", - "plugin:prettier/recommended", "plugin:promise/recommended", - "plugin:react/recommended" + "plugin:react/recommended", + "prettier" ] }, { @@ -47,8 +47,8 @@ }, "extends": [ "plugin:react/recommended", - "plugin:prettier/recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "prettier" ] } ], diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index c2c677dc..6916dbac 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -32,6 +32,10 @@ jobs: - name: 'Test' run: make test + - name: 'Format' + run: make format + continue-on-error: true + - name: 'Build image' run: make build env: diff --git a/.prettierignore b/.prettierignore index cc27166c..19c32f3b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ # Ignore directories +/.parcel-cache/ dist node_modules coverage diff --git a/Makefile b/Makefile index 04b5a844..0357bf4c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .DEFAULT_GOAL: help -.PHONY: help build run dev prod start logs stop wait-healthy lint test integration-test smoke-test +.PHONY: help build run dev prod start logs stop wait-healthy lint format test integration-test smoke-test ifeq (${TARGET},) TARGET := dev @@ -50,6 +50,10 @@ lint: export TARGET = dev lint: build ## Run the linter @${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview lint +format: export TARGET = dev +format: build ## Run the formatter + @${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview format + test: export TARGET = dev test: build ## Run the tests @${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview test diff --git a/package-lock.json b/package-lock.json index 079c6d91..2ea4ec6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11203,13 +11203,10 @@ } }, "eslint-config-prettier": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-4.3.0.tgz", - "integrity": "sha512-sZwhSTHVVz78+kYD3t5pCWSYEdVSBR0PXnwjDRsUs8ytIrK8PLXw+6FKp8r3Z7rx4ZszdetWlXYKOHoUrrwPlA==", - "dev": true, - "requires": { - "get-stdin": "^6.0.0" - } + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", + "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", + "dev": true }, "eslint-import-resolver-node": { "version": "0.3.4", @@ -11437,12 +11434,6 @@ "integrity": "sha512-c3WjZR/HBoi4GedJRwo2OGHa8Pzo1EbSVwQ2HFzJ+4t2OoYM7Alx646EH/aaxZ+9eGcPiq0FT0UGkRuFFx2FHg==", "dev": true }, - "eslint-plugin-jest-formatting": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest-formatting/-/eslint-plugin-jest-formatting-2.0.1.tgz", - "integrity": "sha512-t6oc6GcXqzQ4lwatnVoKxGTLqo8kFIdA5kpaS3mrkwnTNxhsgFo9reMFdrtNtllx72ohNUsXsay7RJR/LLLk3Q==", - "dev": true - }, "eslint-plugin-node": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-9.0.1.tgz", @@ -11480,15 +11471,6 @@ } } }, - "eslint-plugin-prettier": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz", - "integrity": "sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA==", - "dev": true, - "requires": { - "prettier-linter-helpers": "^1.0.0" - } - }, "eslint-plugin-promise": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.1.1.tgz", @@ -12438,12 +12420,6 @@ "integrity": "sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw==", "dev": true }, - "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", - "dev": true - }, "get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", @@ -20598,20 +20574,11 @@ } }, "prettier": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.17.1.tgz", - "integrity": "sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", + "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==", "dev": true }, - "prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "requires": { - "fast-diff": "^1.1.2" - } - }, "pretty-format": { "version": "27.2.5", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.2.5.tgz", diff --git a/package.json b/package.json index a5b49354..d05ec0cf 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ } }, "scripts": { + "format": "prettier --ignore-unknown --check '**'", "lint": "eslint --ignore-path .gitignore ./src/backend", "test": "jest", "build": "rimraf dist && npm run build:scripts && npm run build:backend && npm run build:hooks && npm run build:frontend", @@ -173,12 +174,10 @@ "concurrently": "^5.3.0", "copyfiles": "^2.4.1", "eslint": "^6.8.0", - "eslint-config-prettier": "4.3.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.20.0", "eslint-plugin-jest": "22.5.1", - "eslint-plugin-jest-formatting": "^2.0.0", "eslint-plugin-node": "9.0.1", - "eslint-plugin-prettier": "3.1.0", "eslint-plugin-promise": "4.1.1", "eslint-plugin-react": "^7.18.0", "http-status-codes": "^2.1.4", @@ -186,7 +185,7 @@ "nodemon": "^2.0.6", "npm-watch": "^0.9.0", "parcel": "2.0.0-beta.2", - "prettier": "1.17.1", + "prettier": "^2.4.1", "rimraf": "^3.0.2", "supertest": "^6.1.6", "ts-node": "^9.0.0",