Disallow unsafe type assertions (#18688)

This commit is contained in:
Christian Gunderman
2026-02-10 00:10:15 +00:00
committed by GitHub
parent bce1caefd0
commit fd65416a2f
188 changed files with 592 additions and 47 deletions

View File

@@ -29,6 +29,7 @@ export function updateSettingsFilePreservingFormat(
let parsed: Record<string, unknown>;
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
parsed = parse(originalContent) as Record<string, unknown>;
} catch (error) {
coreEvents.emitFeedback(
@@ -61,7 +62,9 @@ function preserveCommentsOnPropertyDeletion(
const beforeSym = Symbol.for(`before:${propName}`);
const afterSym = Symbol.for(`after:${propName}`);
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const beforeComments = target[beforeSym] as unknown[] | undefined;
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const afterComments = target[afterSym] as unknown[] | undefined;
if (!beforeComments && !afterComments) return;
@@ -137,7 +140,9 @@ function applyKeyDiff(
if (isObj && isBaseObj) {
applyKeyDiff(
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
baseVal as Record<string, unknown>,
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
nextVal as Record<string, unknown>,
);
} else if (isArr && isBaseArr) {