Skip to content

Commit

Permalink
build: separate formatting from linting
Browse files Browse the repository at this point in the history
This change separates Prettier from ESLint, which allows it to run correctly on all files.

Many files aren't currently formatted correctly, so I've added an optional step to the CI workflow.

Refs #395
  • Loading branch information
thewilkybarkid committed Oct 27, 2021
1 parent ade9e85 commit abc501b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 49 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -47,8 +47,8 @@
},
"extends": [
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier"
]
}
],
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Ignore directories
/.parcel-cache/
dist
node_modules
coverage
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
47 changes: 7 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -173,20 +174,18 @@
"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",
"jest": "^27.2.4",
"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",
Expand Down

0 comments on commit abc501b

Please sign in to comment.