Pre Commit Hook for JSLint in Mercurial and Git

前端 未结 3 1120
予麋鹿
予麋鹿 2021-02-05 10:09

I want to run JSLint before a commit into either a Mercurial or Git repo is done.

I want this as an automatic step that is set up instead of relying on the developer (ma

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-05 10:41

    For git, there are examples in the .git/hooks directory. If you just need the file names for JSLint, you could use git diff --name-only, which in my example will list the names of the files that differ from the current HEAD.

提交回复
热议问题