@@ -149,18 +149,6 @@ function* itrListupInput(rootDir: string): IterableIterator<string> {
149
149
}
150
150
}
151
151
152
- function exists ( f : string ) {
153
- try {
154
- fs . statSync ( f )
155
- return true
156
- } catch ( error ) {
157
- if ( error . code === "ENOENT" ) {
158
- return false
159
- }
160
- throw error
161
- }
162
- }
163
-
164
152
function writeFixtures (
165
153
ruleName : string ,
166
154
inputFile : string ,
@@ -190,7 +178,7 @@ function writeFixtures(
190
178
} ,
191
179
config . filename ,
192
180
)
193
- if ( force || ! exists ( errorFile ) ) {
181
+ if ( force || ! fs . existsSync ( errorFile ) ) {
194
182
fs . writeFileSync (
195
183
errorFile ,
196
184
`${ JSON . stringify (
@@ -206,7 +194,7 @@ function writeFixtures(
206
194
)
207
195
}
208
196
209
- if ( force || ! exists ( outputFile ) ) {
197
+ if ( force || ! fs . existsSync ( outputFile ) ) {
210
198
const output = applyFixes ( config . code , result ) . output
211
199
212
200
if ( plugin . rules [ ruleName ] . meta . fixable != null ) {
@@ -229,10 +217,10 @@ function getConfig(ruleName: string, inputFile: string) {
229
217
const code = fs . readFileSync ( inputFile , "utf8" )
230
218
let config
231
219
let configFile : string = inputFile . replace ( / i n p u t \. s v e l t e $ / u, "config.json" )
232
- if ( ! exists ( configFile ) ) {
220
+ if ( ! fs . existsSync ( configFile ) ) {
233
221
configFile = path . join ( path . dirname ( inputFile ) , "_config.json" )
234
222
}
235
- if ( exists ( configFile ) ) {
223
+ if ( fs . existsSync ( configFile ) ) {
236
224
config = JSON . parse ( fs . readFileSync ( configFile , "utf8" ) )
237
225
}
238
226
if ( config && typeof config === "object" ) {
0 commit comments