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:
@@ -1051,6 +1051,7 @@ async function main() {
|
||||
console.error(`Unknown settings subcommand: ${subcommand}`);
|
||||
console.error("Try: fn settings | fn settings set <key> <value> | fn settings export | fn settings import <file>");
|
||||
process.exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
case "git": {
|
||||
|
||||
@@ -44,7 +44,7 @@ function slugifyPathSegment(input: string): string {
|
||||
if (!input || typeof input !== "string") {
|
||||
return "unnamed";
|
||||
}
|
||||
let slug = input
|
||||
const slug = input
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, "-")
|
||||
.replace(/[^a-z0-9\-_]/g, "")
|
||||
|
||||
@@ -366,8 +366,12 @@ export async function runDashboard(port: number, opts: { paused?: boolean; dev?:
|
||||
const dashboardStartedAt = Date.now();
|
||||
|
||||
// Declare store and agentStore early so callbacks can safely reference them
|
||||
// (they're assigned after initialization, but the variables exist from the start)
|
||||
// (they're assigned after initialization, but the variables exist from the start).
|
||||
// prefer-const disabled: callbacks close over these identifiers before the
|
||||
// single assignment below, which requires `let` even though no reassignment occurs.
|
||||
// eslint-disable-next-line prefer-const
|
||||
let store: TaskStore | undefined;
|
||||
// eslint-disable-next-line prefer-const
|
||||
let agentStore: AgentStore | undefined;
|
||||
|
||||
if (isTTY) {
|
||||
|
||||
@@ -912,7 +912,7 @@ export async function runTaskImportFromGitHub(
|
||||
const importedUrls = new Map<string, string>();
|
||||
for (const task of existingTasks) {
|
||||
// Match Source URL anywhere in description (more robust than end-of-string anchor)
|
||||
const sourceMatch = task.description.match(/Source: (https:\/\/github\.com\/[^\/]+\/[^\/]+\/issues\/\d+)/);
|
||||
const sourceMatch = task.description.match(/Source: (https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+)/);
|
||||
if (sourceMatch) {
|
||||
importedUrls.set(sourceMatch[1], task.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user