@@ -108,12 +108,21 @@ const convertBiomeResult = (
108
108
} ;
109
109
} ;
110
110
111
- const biomeLintFile = async ( biome : Biome , filePath : string , fix = true ) => {
111
+ const biomeLintFile = async (
112
+ biome : Biome ,
113
+ filePath : string ,
114
+ fix = true ,
115
+ unsafe = false ,
116
+ ) => {
112
117
const initialContent = await readFile ( filePath , "utf8" ) ;
113
118
114
119
const result = biome . lintContent ( initialContent , {
115
120
filePath,
116
- fixFileMode : fix ? "SafeFixes" : undefined ,
121
+ fixFileMode : fix
122
+ ? unsafe
123
+ ? "SafeAndUnsafeFixes"
124
+ : "SafeFixes"
125
+ : undefined ,
117
126
} ) ;
118
127
119
128
if ( fix ) {
@@ -132,13 +141,14 @@ const biomeLintFile = async (biome: Biome, filePath: string, fix = true) => {
132
141
const biomeLintFiles = async (
133
142
biome : Biome ,
134
143
files : string [ ] ,
135
- fix = true ,
136
144
concurrency : number = os . cpus ( ) . length ,
145
+ fix = true ,
146
+ unsafe = false ,
137
147
) => {
138
148
const limit = pLimit ( concurrency ) ;
139
149
const results = await Promise . all (
140
150
files . map ( ( file ) =>
141
- limit ( async ( ) => await biomeLintFile ( biome , file , fix ) ) ,
151
+ limit ( async ( ) => await biomeLintFile ( biome , file , fix , unsafe ) ) ,
142
152
) ,
143
153
) ;
144
154
@@ -229,6 +239,7 @@ export const lintWithBiome = async (
229
239
concurrency : number = os . cpus ( ) . length ,
230
240
fix = true ,
231
241
debug = false ,
242
+ unsafe = false ,
232
243
) => {
233
244
if ( debug ) {
234
245
performance . mark ( "biome-start" ) ;
@@ -240,7 +251,13 @@ export const lintWithBiome = async (
240
251
241
252
biome . applyConfiguration ( getBiomeConfig ( ) ) ;
242
253
243
- const biomeResults = await biomeLintFiles ( biome , files , fix , concurrency ) ;
254
+ const biomeResults = await biomeLintFiles (
255
+ biome ,
256
+ files ,
257
+ concurrency ,
258
+ fix ,
259
+ unsafe ,
260
+ ) ;
244
261
245
262
if ( debug ) {
246
263
performance . mark ( "biome-end" ) ;
0 commit comments