pre-commit-eslint-vue

pre-commit-eslint-vue 利用 git hook,安装后在项目的 .git 目录下添加一个 pre-commit-hook 对更改的 JS/vue 文件使用 eslint 检查。

Usage no npm install needed!

<script type="module">
  import preCommitEslintVue from 'https://cdn.skypack.dev/pre-commit-eslint-vue';
</script>

README

Pre-commit-ESLint

error screencast

原理

pre-commit-eslint 利用 git hook,安装后在项目的 .git 目录下添加一个 pre-commit-hook 对更改的 JS 文件使用 eslint 检查。

安装

npm install pre-commit-eslint-vue --dev

FAQ

安装后并提交 commit 没有生效

首先在项目根目录执行 cat ./git/hooks/pre-commit 确认 hook 已经存在,不存在的话目前一个常见情况是 yarn 的某些版本并不会在安装后执行 postinstall hook。

解决方案:安装后执行 node ./node_modules/pre-commit-eslint/index.js 即可。

Yarn postinstall issue

License

MIT ©