@@ -277,10 +277,59 @@ module.exports = {
277
277
// which is extremely common and necessary to maintain type safety.
278
278
'a' ,
279
279
'b' ,
280
+ // caught by prevent-abbreviations below, avoid double-flagging
281
+ 'e' ,
282
+ 'i' ,
283
+ 'ch' ,
280
284
] ,
281
285
} ,
282
286
] ,
283
- 'unicorn/prevent-abbreviations' : 'off' ,
287
+ 'unicorn/prevent-abbreviations' : [
288
+ 'error' ,
289
+ {
290
+ checkShorthandImports : false ,
291
+ replacements : {
292
+ e : {
293
+ event : true ,
294
+ error : true ,
295
+ end : true , // as in e2e
296
+ } ,
297
+ i : { index : true } ,
298
+ idx : { index : true } ,
299
+ ch : { character : true } ,
300
+ j2d : { goToDefinition : true } ,
301
+ pos : { position : true } ,
302
+ opt : { options : true , option : true } ,
303
+ cmd : { command : true } ,
304
+ cmds : { commands : true } ,
305
+ loc : { location : true } ,
306
+ ext : { extension : true } ,
307
+ expr : { expression : true } ,
308
+ sub : { subscription : true } ,
309
+ subs : { subscriptions : true } ,
310
+ rect : { rectangle : true } ,
311
+ obs : { observable : true , observer : true } ,
312
+ resp : { response : true } ,
313
+ // When saving a document in a variable, we usually don't mean the the global document,
314
+ // but an extension API text document. Avoid shadowing suffixes.
315
+ doc : { document : false , textDocument : true } ,
316
+ // Never needed in our codebase, better to have an autofix for directory
317
+ dir : { direction : false } ,
318
+ // The meaning of rev vs ref is a common source of confusion.
319
+ // Spelling it out makes it clear.
320
+ rev : { revision : true } ,
321
+ // Allow since it's a React term
322
+ props : false ,
323
+ func : false ,
324
+ ref : false ,
325
+ } ,
326
+ allowList : {
327
+ args : true , // arguments is special
328
+ fs : true , // NodeJS standard library
329
+ } ,
330
+ } ,
331
+ ] ,
332
+
284
333
'unused-imports/no-unused-imports' : 'error' ,
285
334
'unused-imports/no-unused-vars' : 'off' ,
286
335
// New rules added to unicorn
@@ -474,6 +523,7 @@ module.exports = {
474
523
rules : {
475
524
'no-var' : 'off' ,
476
525
'@typescript-eslint/explicit-member-accessibility' : 'off' ,
526
+ 'unicorn/prevent-abbreviations' : 'off' ,
477
527
'id-length' : 'off' ,
478
528
'import/no-default-export' : 'off' ,
479
529
} ,
0 commit comments