Ban the null literal via ESLint and replace existing usages with undefined or truthiness checks (#4401)

This commit is contained in:
Keavon Chambers
2026-08-03 23:47:29 -07:00
committed by GitHub
parent 79136c95be
commit 049b9dbc4d
4 changed files with 17 additions and 11 deletions
@@ -147,7 +147,7 @@ async function migrateToNewFormat() {
if (oldDocuments) {
Object.values(oldDocuments).forEach((value) => {
const oldEntry: unknown = value;
if (typeof oldEntry !== "object" || oldEntry === null) return;
if (!oldEntry || typeof oldEntry !== "object") return;
if (!("documentId" in oldEntry) || !("document" in oldEntry) || !("details" in oldEntry)) return;
// Extract the document ID, handling bigint, number, and string formats
@@ -168,7 +168,7 @@ async function migrateToNewFormat() {
// Extract document details, handling camelCase from the old shipped format
const details: unknown = oldEntry.details;
if (typeof details !== "object" || details === null) return;
if (!details || typeof details !== "object") return;
let name = "";
if ("name" in details && typeof details.name === "string") name = details.name;
@@ -193,7 +193,7 @@ async function migrateToNewFormat() {
// TODO: Eventually remove this document upgrade code
function extractIsSavedFromUnknown(details: unknown): boolean {
if (typeof details !== "object" || details === null) return false;
if (!details || typeof details !== "object") return false;
// Old camelCase format
if ("isSaved" in details) return Boolean(details.isSaved);