Skip to content

Commit a1f2921

Browse files
authored
[*] Technical - Fix linted deleted files issue (#271)
1 parent 6a0105b commit a1f2921

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.eslint-bin/pre-commit-hook.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ const simpleGit = require('simple-git')(`${__dirname}/..`);
33

44
let listFilesModified = [];
55

6+
function excludeNonCommitedFiles(file) {
7+
return file.index !== 'D' // NOTICE: Deleted files
8+
&& file.index !== ' ' // NOTICE: Files not staged for commit
9+
&& file.index !== '?'; // NOTICE: Untracked files
10+
}
11+
612
function getFilesModified(callback) {
713
simpleGit.status((error, status) => {
814
if (error) {
@@ -12,6 +18,7 @@ function getFilesModified(callback) {
1218
}
1319

1420
listFilesModified = status.files
21+
.filter(excludeNonCommitedFiles)
1522
.map((file) => file.path)
1623
.filter((file) => file.endsWith('.js'));
1724

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Change Log
22

33
## [Unreleased]
4+
### Fixed
5+
- Technical - Exclude from pre-commit-hook linter files that are not committed.
46

57
## RELEASE 5.4.1 - 2019-12-11
68
### Changed

0 commit comments

Comments
 (0)