Disallow and suppress unsafe assignment (#19736)

This commit is contained in:
Christian Gunderman
2026-02-20 22:28:55 +00:00
committed by GitHub
parent b746524a1b
commit 58d637f919
71 changed files with 149 additions and 22 deletions
@@ -115,6 +115,7 @@ export function SettingsDialog({
}
const doSearch = async () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const results = await fzfInstance.find(searchQuery);
if (!active) return;
@@ -451,6 +451,7 @@ Return a JSON object with:
'--limit',
String(limit),
]);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const issues: Issue[] = JSON.parse(stdout);
if (issues.length === 0) {
setState((s) => ({
@@ -137,6 +137,7 @@ export const TriageIssues = ({
'--limit',
String(limit),
]);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const issues: Issue[] = JSON.parse(stdout);
if (issues.length === 0) {
setState((s) => ({
@@ -166,6 +166,7 @@ async function searchResourceCandidates(
const fzf = new AsyncFzf(candidates, {
selector: (candidate: ResourceSuggestionCandidate) => candidate.searchKey,
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const results = await fzf.find(normalizedPattern, {
limit: MAX_SUGGESTIONS_TO_SHOW * 3,
});
@@ -188,6 +189,7 @@ async function searchAgentCandidates(
const fzf = new AsyncFzf(candidates, {
selector: (s: Suggestion) => s.label,
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const results = await fzf.find(normalizedPattern, {
limit: MAX_SUGGESTIONS_TO_SHOW,
});
@@ -57,6 +57,7 @@ export const useSessionBrowser = (
const originalFilePath = path.join(chatsDir, fileName);
// Load up the conversation.
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const conversation: ConversationRecord = JSON.parse(
await fs.readFile(originalFilePath, 'utf8'),
);
@@ -271,6 +271,7 @@ function useCommandSuggestions(
const fzfInstance = getFzfForCommands(commandsToSearch);
if (fzfInstance) {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const fzfResults = await fzfInstance.fzf.find(partial);
if (signal.aborted) return;
const uniqueCommands = new Set<SlashCommand>();
@@ -22,6 +22,7 @@ export const useStateAndRef = <
(newStateOrCallback) => {
let newValue: T;
if (typeof newStateOrCallback === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
newValue = newStateOrCallback(ref.current);
} else {
newValue = newStateOrCallback;
@@ -243,6 +243,7 @@ export const TableRenderer: React.FC<TableRendererProps> = ({
isHeader = false,
): React.ReactNode => {
const renderedCells = cells.map((cell, index) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const width = adjustedWidths[index] || 0;
return renderCell(cell, width, isHeader);
});
@@ -179,6 +179,7 @@ async function configureVSCodeStyle(
await backupFile(keybindingsFile);
try {
const cleanContent = stripJsonComments(content);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const parsedContent = JSON.parse(cleanContent);
if (!Array.isArray(parsedContent)) {
return {
+2
View File
@@ -233,7 +233,9 @@ export function escapeAnsiCtrlCodes<T>(obj: T): T {
let newArr: unknown[] | null = null;
for (let i = 0; i < obj.length; i++) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const value = obj[i];
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const escapedValue = escapeAnsiCtrlCodes(value);
if (escapedValue !== value) {
if (newArr === null) {