Skip to content

Commit 1863da2

Browse files
Revert "chore: Disabled unicorn/prevent-abbreviations rule (#260)" (#261)
This reverts commit 7884c89.
1 parent 7884c89 commit 1863da2

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

.eslintrc.js

+51-1
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,59 @@ module.exports = {
277277
// which is extremely common and necessary to maintain type safety.
278278
'a',
279279
'b',
280+
// caught by prevent-abbreviations below, avoid double-flagging
281+
'e',
282+
'i',
283+
'ch',
280284
],
281285
},
282286
],
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+
284333
'unused-imports/no-unused-imports': 'error',
285334
'unused-imports/no-unused-vars': 'off',
286335
// New rules added to unicorn
@@ -474,6 +523,7 @@ module.exports = {
474523
rules: {
475524
'no-var': 'off',
476525
'@typescript-eslint/explicit-member-accessibility': 'off',
526+
'unicorn/prevent-abbreviations': 'off',
477527
'id-length': 'off',
478528
'import/no-default-export': 'off',
479529
},

0 commit comments

Comments
 (0)