koh1project / apprenticeship_to_master

Apache License 2.0
0 stars 0 forks source link

Set auto formatting on commit with husky #45

Closed koh1project closed 2 years ago

koh1project commented 2 years ago

Related: https://github.com/koh1project/apprenticeship_to_master/pull/44#pullrequestreview-1145031352 https://github.com/koh1project/apprenticeship_to_master/pull/44#discussion_r997675551

Lada496 commented 2 years ago

Hey Kohichi-san let me poke my nose, I think https://eslint.org/docs/latest/rules/padding-line-between-statements can be one solution. Set rules as explained and run eslint --fix (assuming you need other options as well) during pre-commit process. Just like you explained to me, we can add any Unix commands in a .husky file, which means this also should work!

koh1project commented 2 years ago

@Lada496 Hi Yuko, thank you for sharing the nice idea! For this time, I have already applied one library, eslint-plugin-import, and worked it on this commit, but your suggestion seems to me a configurable idea and will try to use future requirements! 👍

koh1project commented 2 years ago

@Lada496 BTW, this commit shows another way to set pre-commit hooks! We literary write script in the file, so we can use variables!