Skip to content

Commit 0f246b2

Browse files
committed
enable no-confusing-arrow
1 parent bf567b1 commit 0f246b2

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

camel-case.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

33
function camelCase(str) {
4-
return str.replace(/[\w-]+/g, (s) =>
5-
/^-?[a-z]+(?:-[a-z]+)+$/.test(s)
4+
return str.replace(/[\w-]+/g, (s) => {
5+
return /^-?[a-z]+(?:-[a-z]+)+$/.test(s)
66
? s
77
.replace(/^-(ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i, '$1')
88
.replace(/-\w/g, (uncasedStr) => uncasedStr[1].toUpperCase())
9-
: s,
10-
);
9+
: s;
10+
});
1111
}
1212

1313
module.exports = camelCase;

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
],
5555
"rules": {
5656
"array-callback-return": "off",
57-
"no-confusing-arrow": "off",
5857
"prefer-object-spread": "off",
5958
"prefer-rest-params": "off",
6059
"prefer-spread": "off",

un-camel-case.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

33
function unCamelCase(str) {
4-
return str.replace(/[\w-]+/g, (s) =>
5-
/^[A-Z]?[a-z]*(?:[A-Z][a-z]*)+$/.test(s)
4+
return str.replace(/[\w-]+/g, (s) => {
5+
return /^[A-Z]?[a-z]*(?:[A-Z][a-z]*)+$/.test(s)
66
? s
77
.replace(/[A-Z]/g, (casedStr) => `-${casedStr.toLowerCase()}`)
88
.replace(/^(o|ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i, '-$1')
9-
: s,
10-
);
9+
: s;
10+
});
1111
}
1212

1313
module.exports = unCamelCase;

0 commit comments

Comments
 (0)