chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -6,8 +6,12 @@ export type NormalizedAllowFrom = {
function normalizeAllowEntry(value: string | number): string {
const trimmed = String(value).trim();
if (!trimmed) return "";
if (trimmed === "*") return "*";
if (!trimmed) {
return "";
}
if (trimmed === "*") {
return "*";
}
return trimmed.replace(/^line:(?:user:)?/i, "");
}
@@ -31,7 +35,9 @@ export const normalizeAllowFromWithStore = (params: {
export const firstDefined = <T>(...values: Array<T | undefined>) => {
for (const value of values) {
if (typeof value !== "undefined") return value;
if (typeof value !== "undefined") {
return value;
}
}
return undefined;
};
@@ -41,8 +47,14 @@ export const isSenderAllowed = (params: {
senderId?: string;
}): boolean => {
const { allow, senderId } = params;
if (!allow.hasEntries) return false;
if (allow.hasWildcard) return true;
if (!senderId) return false;
if (!allow.hasEntries) {
return false;
}
if (allow.hasWildcard) {
return true;
}
if (!senderId) {
return false;
}
return allow.entries.includes(senderId);
};