enable eslint no-else-return allowElseIf: false option

This commit is contained in:
Denis Pushkarev
2024-07-02 20:04:52 +07:00
parent f504ca8730
commit 4b6e5f649b
4 changed files with 14 additions and 10 deletions
+2 -1
View File
@@ -19,7 +19,8 @@ function getModules(filter) {
if (typeof filter == 'string') {
if (has(entries, filter)) return entries[filter];
return atLeastSomeModules(allModules.filter(it => it.startsWith(filter)), filter);
} else if (filter instanceof RegExp) return atLeastSomeModules(allModules.filter(it => filter.test(it)), filter);
}
if (filter instanceof RegExp) return atLeastSomeModules(allModules.filter(it => filter.test(it)), filter);
throwInvalidFilter(filter);
}
@@ -35,11 +35,8 @@ $({ target: 'String', proto: true }, {
if (!~indexOf(flags, 'g')) throw new $TypeError('`.replaceAll` does not allow non-global regexes');
}
replacer = getMethod(searchValue, REPLACE);
if (replacer) {
return call(replacer, searchValue, O, replaceValue);
} else if (IS_PURE && IS_REG_EXP) {
return replace(toString(O), searchValue, replaceValue);
}
if (replacer) return call(replacer, searchValue, O, replaceValue);
if (IS_PURE && IS_REG_EXP) return replace(toString(O), searchValue, replaceValue);
}
string = toString(O);
searchString = toString(searchValue);
@@ -209,15 +209,19 @@ var findLongestZeroSequence = function (ipv6) {
// https://url.spec.whatwg.org/#host-serializing
var serializeHost = function (host) {
var result, index, compress, ignore0;
// ipv4
if (typeof host == 'number') {
result = [];
for (index = 0; index < 4; index++) {
unshift(result, host % 256);
host = floor(host / 256);
} return join(result, '.');
}
return join(result, '.');
}
// ipv6
} else if (typeof host == 'object') {
if (typeof host == 'object') {
result = '';
compress = findLongestZeroSequence(host);
for (index = 0; index < 8; index++) {
@@ -232,7 +236,9 @@ var serializeHost = function (host) {
}
}
return '[' + result + ']';
} return host;
}
return host;
};
var C0ControlPercentEncodeSet = {};
+1 -1
View File
@@ -172,7 +172,7 @@ const base = {
// disallow deletion of variables
'no-delete-var': ERROR,
// disallow else after a return in an if
'no-else-return': ERROR,
'no-else-return': [ERROR, { allowElseIf: false }],
// disallow empty statements
'no-empty': ERROR,
// disallow empty functions, except for standalone funcs/arrows