style: Add new ESLint rule no-lonely-if and unicorn/no-lonely-if (#10176)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
1 parent
f32daf742f
commit
4ed2d3c4bc
8 files changed
+49
-53
No files matched your search
@@ -160,13 +160,13 @@ function addTypePrefix(node, prefix, skipPrefix) {
|
||||
delete node.parent;
|
||||
for (const key in node) {
|
||||
addTypePrefix(node[key], prefix, skipPrefix);
|
||||
if (key === "type" && typeof node[key] === "string") {
|
||||
if (
|
||||
!node[key].startsWith(prefix) &&
|
||||
(!skipPrefix || !skipPrefix.test(node[key]))
|
||||
) {
|
||||
node[key] = prefix + node[key];
|
||||
}
|
||||
if (
|
||||
key === "type" &&
|
||||
typeof node[key] === "string" &&
|
||||
!node[key].startsWith(prefix) &&
|
||||
(!skipPrefix || !skipPrefix.test(node[key]))
|
||||
) {
|
||||
node[key] = prefix + node[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user