File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ const simpleGit = require('simple-git')(`${__dirname}/..`);
3
3
4
4
let listFilesModified = [ ] ;
5
5
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
+
6
12
function getFilesModified ( callback ) {
7
13
simpleGit . status ( ( error , status ) => {
8
14
if ( error ) {
@@ -12,6 +18,7 @@ function getFilesModified(callback) {
12
18
}
13
19
14
20
listFilesModified = status . files
21
+ . filter ( excludeNonCommitedFiles )
15
22
. map ( ( file ) => file . path )
16
23
. filter ( ( file ) => file . endsWith ( '.js' ) ) ;
17
24
Original file line number Diff line number Diff line change 1
1
# Change Log
2
2
3
3
## [ Unreleased]
4
+ ### Fixed
5
+ - Technical - Exclude from pre-commit-hook linter files that are not committed.
4
6
5
7
## RELEASE 5.4.1 - 2019-12-11
6
8
### Changed
You can’t perform that action at this time.
0 commit comments