FAQ | This is a LIVE service | Changelog

Skip to content

Ensure prettier is performed by eslint pre-commit

Robin Goodall requested to merge fix-pre-commit-prettier into main

Basically a number of issues were happening conflating what was happening:

  • README.md saying to only install the commit-msg hook when we need the pre-commit one too
  • The commit-msg hook was passing the commit message filename to the prettier pre-commit tasks (
    • this task is intended for file that aren't typescript, json, yaml, etc (probably little left)
    • so this is now told to use the pre-commit stage
  • The commit-msg hook was passing the commit message filename to the eslint tasks which ignored it as not a matching file
    • so again this hook is now told to use the pre-commit stage
  • The eslint hook was only linting files in ./src so missing cypress files
    • but adding in cypress causes a load of failures so ignoring that for this MR
  • The eslint hook wasn't actually running prettier
    • so added the prettier plugin

So everyone that has only installed the commit-msg hook should add the pre-commit one too.

It probably needs another commit with some changes to double-check this is all working. But I've tested some bad formatting of TSX and the pre-commit prevents me commit it.

Edited by Robin Goodall

Merge request reports

Loading