@@ -149,18 +149,6 @@ function* itrListupInput(rootDir: string): IterableIterator<string> {
149149 }
150150}
151151
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-
164152function writeFixtures (
165153 ruleName : string ,
166154 inputFile : string ,
@@ -190,7 +178,7 @@ function writeFixtures(
190178 } ,
191179 config . filename ,
192180 )
193- if ( force || ! exists ( errorFile ) ) {
181+ if ( force || ! fs . existsSync ( errorFile ) ) {
194182 fs . writeFileSync (
195183 errorFile ,
196184 `${ JSON . stringify (
@@ -206,7 +194,7 @@ function writeFixtures(
206194 )
207195 }
208196
209- if ( force || ! exists ( outputFile ) ) {
197+ if ( force || ! fs . existsSync ( outputFile ) ) {
210198 const output = applyFixes ( config . code , result ) . output
211199
212200 if ( plugin . rules [ ruleName ] . meta . fixable != null ) {
@@ -229,10 +217,10 @@ function getConfig(ruleName: string, inputFile: string) {
229217 const code = fs . readFileSync ( inputFile , "utf8" )
230218 let config
231219 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 ) ) {
233221 configFile = path . join ( path . dirname ( inputFile ) , "_config.json" )
234222 }
235- if ( exists ( configFile ) ) {
223+ if ( fs . existsSync ( configFile ) ) {
236224 config = JSON . parse ( fs . readFileSync ( configFile , "utf8" ) )
237225 }
238226 if ( config && typeof config === "object" ) {
0 commit comments