Skip to content

Commit ba4efc9

Browse files
committedMar 8, 2020
Enable the unicorn/prevent-abbreviations rule
1 parent 0d63c64 commit ba4efc9

File tree

2 files changed

+92
-27
lines changed

2 files changed

+92
-27
lines changed
 

Diff for: ‎config/plugins.js

+87-22
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,99 @@ module.exports = {
3232
rules: {
3333
'no-use-extend-native/no-use-extend-native': 'error',
3434

35-
// TODO: Enable this again in the next XO release.
36-
// Start with just a manual list of some non-contreversial abbreviations.
37-
//
3835
// TODO: Remove this override at some point.
3936
// It's just here to ease users into readable variable names.
40-
// 'unicorn/prevent-abbreviations': [
41-
// 'error',
42-
// {
43-
// checkFilenames: false,
44-
// replacements: {
45-
// args: false,
46-
// application: {
47-
// app: true
48-
// },
49-
// applications: {
50-
// apps: true
51-
// }
52-
// }
53-
// }
54-
// ],
55-
'unicorn/prevent-abbreviations': 'off',
37+
'unicorn/prevent-abbreviations': [
38+
'error',
39+
{
40+
checkFilenames: false,
41+
checkDefaultAndNamespaceImports: false,
42+
checkShorthandImports: false,
43+
extendDefaultReplacements: false,
44+
replacements: {
45+
// Not part of `eslint-plugin-unicorn`
46+
application: {
47+
app: true
48+
},
49+
applications: {
50+
apps: true
51+
},
52+
53+
// Part of `eslint-plugin-unicorn`
54+
arr: {
55+
array: true
56+
},
57+
e: {
58+
error: true,
59+
event: true
60+
},
61+
el: {
62+
element: true
63+
},
64+
elem: {
65+
element: true
66+
},
67+
len: {
68+
length: true
69+
},
70+
msg: {
71+
message: true
72+
},
73+
num: {
74+
number: true
75+
},
76+
obj: {
77+
object: true
78+
},
79+
opts: {
80+
options: true
81+
},
82+
param: {
83+
parameter: true
84+
},
85+
params: {
86+
parameters: true
87+
},
88+
prev: {
89+
previous: true
90+
},
91+
req: {
92+
request: true
93+
},
94+
res: {
95+
response: true,
96+
result: true
97+
},
98+
ret: {
99+
returnValue: true
100+
},
101+
str: {
102+
string: true
103+
},
104+
temp: {
105+
temporary: true
106+
},
107+
tmp: {
108+
temporary: true
109+
},
110+
val: {
111+
value: true
112+
}
113+
}
114+
}
115+
],
116+
117+
// The character class sorting is a bit buggy at the moment.
118+
'unicorn/better-regex': [
119+
'error',
120+
{
121+
sortCharacterClasses: false
122+
}
123+
],
56124

57125
// TODO: Remove this override when the rule is more stable.
58126
'unicorn/consistent-function-scoping': 'off',
59127

60-
// TODO: Enable it again when the bugs are fixed.
61-
'unicorn/regex-shorthand': 'off',
62-
63128
// TODO: Temporarily disabled as the rule is buggy.
64129
'function-call-argument-newline': 'off',
65130

Diff for: ‎package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"typescript"
5252
],
5353
"dependencies": {
54-
"@typescript-eslint/eslint-plugin": "^2.21.0",
55-
"@typescript-eslint/parser": "^2.21.0",
54+
"@typescript-eslint/eslint-plugin": "^2.22.0",
55+
"@typescript-eslint/parser": "^2.22.0",
5656
"arrify": "^2.0.1",
5757
"cosmiconfig": "^6.0.0",
5858
"debug": "^4.1.0",
@@ -68,7 +68,7 @@
6868
"eslint-plugin-node": "^11.0.0",
6969
"eslint-plugin-prettier": "^3.1.2",
7070
"eslint-plugin-promise": "^4.2.1",
71-
"eslint-plugin-unicorn": "^16.1.1",
71+
"eslint-plugin-unicorn": "^17.0.1",
7272
"find-cache-dir": "^3.0.0",
7373
"fs-extra": "^8.1.0",
7474
"get-stdin": "^7.0.0",
@@ -97,8 +97,8 @@
9797
"ava": "^1.1.0",
9898
"coveralls": "^3.0.6",
9999
"eslint-config-xo-react": "^0.23.0",
100-
"eslint-plugin-react": "^7.14.3",
101-
"eslint-plugin-react-hooks": "^2.0.1",
100+
"eslint-plugin-react": "^7.19.0",
101+
"eslint-plugin-react-hooks": "^2.5.0",
102102
"execa": "^4.0.0",
103103
"nyc": "^15.0.0",
104104
"pify": "^4.0.0",

0 commit comments

Comments
 (0)
Please sign in to comment.