FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

no lint deleted files on commit · devhttps/frontend@7f8b830 · GitHub

Commit 7f8b830

Browse files
committed
no lint deleted files on commit
1 parent e8efc30 commit 7f8b830

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎git-hooks/pre-commit‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* eslint-disable no-console */
33

44
const path = require('path');
5-
5+
const fs = require('fs');
66
const execa = require('execa');
77
const chalk = require('chalk');
88

@@ -11,7 +11,9 @@ execa
1111
.then(staged => staged.split('\n'))
1212
// lint and commit any lint fixes
1313
.then(staged => {
14-
const jsFiles = staged.filter(file => file.endsWith('.js'));
14+
const jsFiles = staged
15+
.filter(file => file.endsWith('.js'))
16+
.filter(file => fs.existsSync(file));
1517
if (jsFiles.length) {
1618
return execa('eslint', ['--fix', ...jsFiles], {
1719
stdio: 'inherit',

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL