1
1
#!/usr/src/app/bin/node_gc
2
2
3
- process . chdir ( '/code' ) ;
3
+ var CODE_DIR = "/code" ;
4
+ process . chdir ( CODE_DIR ) ;
4
5
5
6
// Redirect `console.log` so that we are the only ones
6
7
// writing to STDOUT
@@ -79,10 +80,9 @@ function isFileWithMatchingExtension(file, extensions) {
79
80
}
80
81
81
82
function isFileIgnoredByLibrary ( file ) {
82
- var path = file . replace ( / ^ \/ c o d e \/ / , "" ) ;
83
- var ignored = cli . isPathIgnored ( path ) ;
83
+ var ignored = cli . isPathIgnored ( file ) ;
84
84
if ( ignored ) {
85
- var output = "File `" + path + "` ignored because of your .eslintignore file." + "\n" ;
85
+ var output = "File `" + file + "` ignored because of your .eslintignore file." + "\n" ;
86
86
process . stderr . write ( output ) ;
87
87
}
88
88
return ignored ;
@@ -115,18 +115,16 @@ function inclusionBasedFileListBuilder(includePaths) {
115
115
if ( ( / \/ $ / ) . test ( fileOrDirectory ) ) {
116
116
// if it ends in a slash, expand and push
117
117
var filesInThisDirectory = glob . sync (
118
- "/code/" + fileOrDirectory + "/**/**"
118
+ fileOrDirectory + "/**/**"
119
119
) ;
120
120
prunePathsWithinSymlinks ( filesInThisDirectory ) . forEach ( function ( file , j ) {
121
121
if ( ! isFileIgnoredByLibrary ( file ) && isFileWithMatchingExtension ( file , extensions ) ) {
122
122
analysisFiles . push ( file ) ;
123
123
}
124
124
} ) ;
125
125
} else {
126
- // if not, check for ending in *.js
127
- var fullPath = "/code/" + fileOrDirectory ;
128
- if ( ! isFileIgnoredByLibrary ( fullPath ) && isFileWithMatchingExtension ( fullPath , extensions ) ) {
129
- analysisFiles . push ( fullPath ) ;
126
+ if ( ! isFileIgnoredByLibrary ( fileOrDirectory ) && isFileWithMatchingExtension ( fileOrDirectory , extensions ) ) {
127
+ analysisFiles . push ( fileOrDirectory ) ;
130
128
}
131
129
}
132
130
} ) ;
@@ -151,7 +149,7 @@ runWithTiming("engineConfig", function () {
151
149
152
150
var userConfig = engineConfig . config || { } ;
153
151
if ( userConfig . config ) {
154
- options . configFile = "/code /" + userConfig . config ;
152
+ options . configFile = CODE_DIR + " /" + userConfig . config ;
155
153
}
156
154
157
155
if ( userConfig . extensions ) {
0 commit comments