refactor: fix and tighten mechanical lint rules

- no-useless-escape: drop needless backslashes in character classes and
  URL/path regexes (gh-cli, store, task, modelFilter, useFileMention,
  RoutineEditor, ScheduleForm).
- no-case-declarations: wrap case bodies in ProjectOverview and
  SettingsModal with block scopes.
- prefer-const: convert a never-reassigned slug binding in agent-import;
  annotate legitimate forward-declared let bindings in dashboard.ts that
  callbacks close over before assignment.
- no-fallthrough: add missing break after settings-subcommand error.
- no-empty-interface/no-empty-object-type: convert ProjectManifest from
  empty interface extension to a type alias.
- no-unused-expressions: replace `x && x.method()` short-circuits in
  TerminalModal with optional chaining.

Then ratchet these rules from warn → error so regressions are blocked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-23 17:54:18 -07:00
parent ce167b6397
commit 651c5678d2
15 changed files with 35 additions and 35 deletions

View File

@@ -59,7 +59,7 @@ export interface AgentManifest extends AgentCompaniesFrontmatter {
instructionBody?: string;
}
export interface ProjectManifest extends AgentCompaniesFrontmatter {}
export type ProjectManifest = AgentCompaniesFrontmatter;
export interface TaskManifest extends AgentCompaniesFrontmatter {
assignee?: string;

View File

@@ -173,13 +173,13 @@ export function ensureGhAuth(): void {
*/
export function parseRepoFromRemote(remoteUrl: string): { owner: string; repo: string } | null {
// HTTPS: https://github.com/owner/repo.git or https://github.com/owner/repo
const httpsMatch = remoteUrl.match(/github\.com\/([^\/]+)\/([^\/\.]+)(?:\.git)?$/);
const httpsMatch = remoteUrl.match(/github\.com\/([^/]+)\/([^/.]+)(?:\.git)?$/);
if (httpsMatch) {
return { owner: httpsMatch[1], repo: httpsMatch[2] };
}
// SSH: git@github.com:owner/repo.git or git@github.com:owner/repo
const sshMatch = remoteUrl.match(/github\.com:([^\/]+)\/([^\/\.]+)(?:\.git)?$/);
const sshMatch = remoteUrl.match(/github\.com:([^/]+)\/([^/.]+)(?:\.git)?$/);
if (sshMatch) {
return { owner: sshMatch[1], repo: sshMatch[2] };
}

View File

@@ -65,7 +65,7 @@ function assertSafeAbsolutePath(path: string): void {
!isAbsolute ||
path.startsWith("-") ||
// Reject shell metacharacters, quotes, control chars, and NULs.
/["'`$\n\r\t;&|<>()*?\[\]{}\\\0]/.test(
/["'`$\n\r\t;&|<>()*?[\]{}\\\0]/.test(
path.replace(/^[A-Za-z]:/, ""), // ignore the drive-letter colon on Windows
)
) {