Skip to content

Commit 930f6d4

Browse files
committed
Upgrade TypeScript ESLint dependencies and remove unused catch bindings across the editor codebase
├── .github │ └── workflows │ └── deploy-vscode-extension.yml ├── apps │ ├── browser │ │ └── package.json │ ├── editor │ │ ├── .eslintrc.json │ │ └── package.json │ └── web │ └── package.json ├── packages │ ├── shared │ │ └── package.json │ └── ui │ └── package.json └── pnpm-workspace.yaml
1 parent 2bc5ba7 commit 930f6d4

48 files changed

Lines changed: 534 additions & 515 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/editor/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,8 @@
13101310
"@types/vscode": "1.96.0",
13111311
"@types/ws": "^8.18.1",
13121312
"@types/turndown": "^5.0.5",
1313-
"@typescript-eslint/eslint-plugin": "^7.18.0",
1314-
"@typescript-eslint/parser": "^7.18.0",
1313+
"@typescript-eslint/eslint-plugin": "^8.72.1",
1314+
"@typescript-eslint/parser": "^8.72.1",
13151315
"@rsbuild/core": "^1.1.12",
13161316
"@rsbuild/plugin-react": "^1.0.6",
13171317
"@rsbuild/plugin-sass": "^1.1.2",
@@ -1322,7 +1322,7 @@
13221322
"eslint-plugin-react": "^7.37.5",
13231323
"sass-embedded": "^1.89.2",
13241324
"typed-css-modules": "^0.9.1",
1325-
"typescript": "^7.0.0"
1325+
"typescript": "^6.x"
13261326
},
13271327
"dependencies": {
13281328
"@joplin/turndown": "^4.0.81",

‎apps/editor/src/commands/apply-response-command/response-processor/handlers/patch-repair-handler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const handle_patch_repair = async (params: {
5454
if (old_safe_path) {
5555
try {
5656
await vscode.workspace.fs.delete(vscode.Uri.file(old_safe_path))
57-
} catch (e) {}
57+
} catch {}
5858
}
5959
}
6060
}

‎apps/editor/src/commands/apply-response-command/response-processor/handlers/restore-preview-handler.ts‎

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import {
1010
get_workspace_map_and_default,
1111
resolve_workspace_root
1212
} from '../../utils/workspace'
13-
import { remove_directory_if_empty, relocate_file, preserve_trailing_newline, replace_document_content, ensure_directory_exists } from '../../utils/file-operations'
13+
import {
14+
remove_directory_if_empty,
15+
relocate_file,
16+
preserve_trailing_newline,
17+
replace_document_content,
18+
ensure_directory_exists
19+
} from '../../utils/file-operations'
1420

1521
export const handle_restore_preview = async (
1622
files: FileInPreview[]
@@ -42,7 +48,9 @@ export const handle_restore_preview = async (
4248
const rename_sources = new Set<string>()
4349
for (const file of files) {
4450
if (file.renamed_from) {
45-
rename_sources.add(`${file.renamed_from_workspace ?? file.workspace_name ?? ''}:${file.renamed_from}`)
51+
rename_sources.add(
52+
`${file.renamed_from_workspace ?? file.workspace_name ?? ''}:${file.renamed_from}`
53+
)
4654
}
4755
}
4856

@@ -87,12 +95,16 @@ export const handle_restore_preview = async (
8795
workspace_map,
8896
default_workspace
8997
})
90-
const source_safe_path = create_safe_path(source_workspace_root, file.renamed_from)
98+
const source_safe_path = create_safe_path(
99+
source_workspace_root,
100+
file.renamed_from
101+
)
91102
if (source_safe_path && fs.existsSync(source_safe_path)) {
92103
try {
93-
const document = await vscode.workspace.openTextDocument(source_safe_path)
104+
const document =
105+
await vscode.workspace.openTextDocument(source_safe_path)
94106
original_content = document.getText()
95-
} catch (e) {}
107+
} catch {}
96108
}
97109
}
98110

@@ -120,18 +132,21 @@ export const handle_restore_preview = async (
120132
workspace_map,
121133
default_workspace
122134
})
123-
135+
124136
await relocate_file({
125137
old_path: file.renamed_from,
126138
new_path: file.file_path,
127139
old_workspace_root: source_workspace_root,
128140
new_workspace_root: workspace_root
129141
})
130-
142+
131143
if (!file.is_pure_rename && file.content !== undefined) {
132144
const file_uri = vscode.Uri.file(safe_path)
133145
const document = await vscode.workspace.openTextDocument(file_uri)
134-
const final_content = preserve_trailing_newline(original_content, file.content)
146+
const final_content = preserve_trailing_newline(
147+
original_content,
148+
file.content
149+
)
135150
await replace_document_content(document, final_content)
136151
Logger.info({
137152
function_name: 'handle_restore_preview',
@@ -144,7 +159,7 @@ export const handle_restore_preview = async (
144159
if (rename_sources.has(file_key)) {
145160
continue
146161
}
147-
162+
148163
if (file_exists) {
149164
try {
150165
const tabs_to_close: vscode.Tab[] = []
@@ -189,7 +204,10 @@ export const handle_restore_preview = async (
189204
try {
190205
const file_uri = vscode.Uri.file(safe_path)
191206
const document = await vscode.workspace.openTextDocument(file_uri)
192-
const final_content = preserve_trailing_newline(original_content, file.content)
207+
const final_content = preserve_trailing_newline(
208+
original_content,
209+
file.content
210+
)
193211
await replace_document_content(document, final_content)
194212

195213
Logger.info({

‎apps/editor/src/commands/apply-response-command/response-processor/handlers/search-replace-handler.ts‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,18 @@ export const handle_search_replace = async (params: {
117117

118118
let proposed_content = ''
119119
if (!is_pure_rename) {
120-
if (has_markers) {
121-
proposed_content = apply_search_replace_to_content({
122-
original_content,
123-
segments: parse_search_replace_segments(file.content)
124-
})
125-
} else {
126-
proposed_content = file.content
127-
}
128-
await vscode.workspace.fs.writeFile(
129-
vscode.Uri.file(safe_path),
130-
Buffer.from(proposed_content, 'utf8')
131-
)
120+
if (has_markers) {
121+
proposed_content = apply_search_replace_to_content({
122+
original_content,
123+
segments: parse_search_replace_segments(file.content)
124+
})
125+
} else {
126+
proposed_content = file.content
127+
}
128+
await vscode.workspace.fs.writeFile(
129+
vscode.Uri.file(safe_path),
130+
Buffer.from(proposed_content, 'utf8')
131+
)
132132
}
133133

134134
original_states.push({
@@ -142,7 +142,7 @@ export const handle_search_replace = async (params: {
142142
is_pure_rename
143143
})
144144
continue
145-
} catch (error) {
145+
} catch {
146146
failed_files.push(file)
147147
}
148148
} else if (file_exists && has_markers) {
@@ -207,16 +207,19 @@ export const handle_search_replace = async (params: {
207207
workspace_name: file.workspace_name,
208208
proposed_content: content_to_write
209209
})
210-
} catch (error) {
210+
} catch {
211211
failed_files.push(file)
212212
}
213213
} else if (file_exists && !has_markers) {
214214
try {
215215
const document = await vscode.workspace.openTextDocument(safe_path)
216216
const original_content_doc = document.getText()
217217

218-
const final_content = preserve_trailing_newline(original_content_doc, file.content)
219-
218+
const final_content = preserve_trailing_newline(
219+
original_content_doc,
220+
file.content
221+
)
222+
220223
await replace_document_content(document, final_content)
221224

222225
original_states.push({

‎apps/editor/src/commands/apply-response-command/response-processor/handlers/truncated-handler.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as fs from 'fs'
2-
import * as path from 'path'
32
import * as vscode from 'vscode'
43
import { Logger } from '@shared/utils/logger'
54
import { create_safe_path, sanitize_file_name } from '@/utils/path-sanitizer'
@@ -106,7 +105,7 @@ export const handle_truncated_edit = async (params: {
106105
old_workspace_root: rename_source_workspace_root,
107106
new_workspace_root: workspace_root
108107
})
109-
108+
110109
let proposed_content = ''
111110
if (!is_pure_rename) {
112111
proposed_content = process_truncations(file.content, original_content)

‎apps/editor/src/commands/apply-response-command/response-processor/response-processor.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ const create_failed_file_state = (params: {
583583
if (safe_path && fs.existsSync(safe_path)) {
584584
try {
585585
content = fs.readFileSync(safe_path, 'utf8')
586-
} catch (e) {}
586+
} catch {}
587587
}
588588

589589
const result: OriginalFileState = {

‎apps/editor/src/commands/apply-response-command/utils/file-operations/prepare-rename-operation.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const prepare_rename_operation = async (params: {
1818
default_workspace: params.default_workspace
1919
})
2020
const sanitized_rename_path = sanitize_file_name(params.file.renamed_from)
21-
rename_source_path = create_safe_path(rename_source_workspace_root, sanitized_rename_path) ?? undefined
21+
rename_source_path =
22+
create_safe_path(rename_source_workspace_root, sanitized_rename_path) ??
23+
undefined
2224
}
2325

2426
const is_pure_rename = params.file.content === ''
@@ -28,9 +30,7 @@ export const prepare_rename_operation = async (params: {
2830
try {
2931
const doc = await vscode.workspace.openTextDocument(rename_source_path)
3032
original_content = doc.getText()
31-
} catch (e) {
32-
// Ignored: Will be handled if missing
33-
}
33+
} catch {}
3434
}
3535

3636
return {

‎apps/editor/src/commands/apply-response-command/utils/file-operations/read-rename-source-file.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const read_rename_source_file = async (params: {
2020
path: safe_rename_path,
2121
content: document.getText()
2222
}
23-
} catch (e) {
23+
} catch {
2424
Logger.warn({
2525
function_name: 'read_rename_source_file',
2626
message: 'Failed to read rename source file',

‎apps/editor/src/commands/apply-response-command/utils/preview/build-history-files.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const build_history_files = async (params: {
5252
} else if (state.proposed_content !== undefined) {
5353
current_content = state.proposed_content
5454
}
55-
} catch (error) {
55+
} catch {
5656
continue
5757
}
5858

@@ -95,7 +95,9 @@ export const build_history_files = async (params: {
9595
added_in_preview: state.added_in_preview,
9696
is_pure_rename: state.is_pure_rename,
9797
renamed_from: is_rename ? state.file_path_to_restore : undefined,
98-
renamed_from_workspace: is_rename ? state.restore_workspace_name : undefined
98+
renamed_from_workspace: is_rename
99+
? state.restore_workspace_name
100+
: undefined
99101
})
100102

101103
if (state.file_path_to_restore) {

‎apps/editor/src/commands/apply-response-command/utils/preview/file-preparer.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ export const prepare_files_from_original_states = async (params: {
4747
} else if (state.proposed_content !== undefined) {
4848
current_content = state.proposed_content
4949
}
50-
} catch (error) {
50+
} catch {
5151
continue
5252
}
5353

5454
let new_content_for_diff = current_content
5555
if (state.is_pure_rename) {
5656
new_content_for_diff = ''
57-
} else if (state.is_checked === false && state.current_content !== undefined) {
57+
} else if (
58+
state.is_checked === false &&
59+
state.current_content !== undefined
60+
) {
5861
current_content = state.current_content
5962
new_content_for_diff = state.content
6063
} else if (state.is_checked === false && state.ai_content !== undefined) {

0 commit comments

Comments
 (0)