@@ -28,8 +28,14 @@ if (process.env.CI !== undefined) {
28
28
* This is increasingly useful the more files there are in the repository.
29
29
*/
30
30
const getPreProcessor =
31
- ( untrackedFileList : string [ ] , diffFileList : string [ ] ) =>
31
+ ( diffFileList : string [ ] , staged : boolean ) =>
32
32
( text : string , filename : string ) => {
33
+ let untrackedFileList = getUntrackedFileList ( staged ) ;
34
+ const shouldRefresh =
35
+ ! diffFileList . includes ( filename ) && ! untrackedFileList . includes ( filename ) ;
36
+ if ( shouldRefresh ) {
37
+ untrackedFileList = getUntrackedFileList ( staged , true ) ;
38
+ }
33
39
const shouldBeProcessed =
34
40
process . env . VSCODE_CLI !== undefined ||
35
41
diffFileList . includes ( filename ) ||
@@ -66,7 +72,7 @@ const getUnstagedChangesError = (filename: string): [Linter.LintMessage] => {
66
72
} ;
67
73
68
74
const getPostProcessor =
69
- ( untrackedFileList : string [ ] , staged = false ) =>
75
+ ( staged = false ) =>
70
76
(
71
77
messages : Linter . LintMessage [ ] [ ] ,
72
78
filename : string
@@ -75,7 +81,7 @@ const getPostProcessor =
75
81
// No need to filter, just return
76
82
return [ ] ;
77
83
}
78
-
84
+ const untrackedFileList = getUntrackedFileList ( staged ) ;
79
85
if ( untrackedFileList . includes ( filename ) ) {
80
86
// We don't need to filter the messages of untracked files because they
81
87
// would all be kept anyway, so we return them as-is.
@@ -111,12 +117,11 @@ const getProcessors = (
111
117
processorType : ProcessorType
112
118
) : Required < Linter . Processor > => {
113
119
const staged = processorType === "staged" ;
114
- const untrackedFileList = getUntrackedFileList ( staged ) ;
115
120
const diffFileList = getDiffFileList ( staged ) ;
116
121
117
122
return {
118
- preprocess : getPreProcessor ( untrackedFileList , diffFileList ) ,
119
- postprocess : getPostProcessor ( untrackedFileList , staged ) ,
123
+ preprocess : getPreProcessor ( diffFileList , staged ) ,
124
+ postprocess : getPostProcessor ( staged ) ,
120
125
supportsAutofix : true ,
121
126
} ;
122
127
} ;
0 commit comments