Skip to content

Commit

Permalink
fix(CRATemplate): Fix lint command
Browse files Browse the repository at this point in the history
ESLint was broken in the CRA template for two reasons:

- ESLint was unable not import `eslint-config-prettier` (dependency of `@defencedigital/eslint-config-react`) – could be to do with package hoisting not too clear why just this one specifically (is mentioned here though: prettier/eslint-plugin-prettier#396)
- it was trying to lint `src/*` which would be expanded by the shell and fail if the `src/components` directory was empty (except for `.gitkeep`)

This fixes both of those problems, and adds a step to the smoke test workflow to explicitly test the lint command.
  • Loading branch information
jpveooys committed Dec 14, 2021
1 parent 1b17420 commit d91edc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/npmsmoketest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ jobs:
cd $RUNNER_TEMP/my-app
grep version node_modules/@defencedigital/**/package.json
yarn build
- name: Lint boilerlate app
run: |
cd $RUNNER_TEMP/my-app
yarn lint
3 changes: 2 additions & 1 deletion packages/cra-template-defencedigital/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Defence Digital",
"scripts": {
"codegen": "gql-gen --config codegen.yml",
"lint": "eslint src/* --ext .ts --ext .tsx"
"lint": "eslint src --ext .ts --ext .tsx"
},
"dependencies": {
"styled-components": "^5.2.1",
Expand All @@ -20,6 +20,7 @@
"@testing-library/jest-dom": "^5.5.0",
"@testing-library/react": "^10.0.4",
"@testing-library/user-event": "^10.1.0",
"eslint-plugin-prettier": "^4.0.0",
"formik": "^2.2.9",
"jest-canvas-mock": "^2.3.0",
"typescript": "^3.8.0",
Expand Down

0 comments on commit d91edc5

Please sign in to comment.