Skip to content

Commit 451d0de

Browse files
committed
Standardize numeric comparisons by replacing strict equality with loose equality across the project
1 parent e6f2a82 commit 451d0de

45 files changed

Lines changed: 81 additions & 82 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.

‎packages/browser/src/background/message-handler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const handle_get_tab_data = async (
164164
code: 'document.documentElement.outerHTML'
165165
})
166166

167-
if (!results || results.length === 0 || !results[0]) {
167+
if (!results || results.length == 0 || !results[0]) {
168168
throw new Error('Failed to get page content')
169169
}
170170

‎packages/browser/src/content-scripts/send-prompt-content-script/chatbots/doubao.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const doubao: Chatbot = {
4848
return
4949
}
5050
const menu_items = portal.querySelectorAll('li[role="menuitem"]')
51-
if (menu_items.length === 0) {
51+
if (menu_items.length == 0) {
5252
report_initialization_error({
5353
function_name: 'doubao.set_options',
5454
log_message: 'Options menu items not found'

‎packages/ui/src/components/editor/panel/PromptField/hooks/use-drag-drop.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const use_drag_drop = ({
2525

2626
const handle_drag_start = (e: React.DragEvent<HTMLDivElement>) => {
2727
const selection = window.getSelection()
28-
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
28+
if (!selection || selection.rangeCount == 0 || selection.isCollapsed) {
2929
e.preventDefault()
3030
return
3131
}

‎packages/ui/src/components/editor/panel/PromptField/hooks/use-handlers.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ export const use_handlers = (
295295

296296
const handle_copy = (e: React.ClipboardEvent<HTMLDivElement>) => {
297297
const selection = window.getSelection()
298-
if (!selection || selection.rangeCount === 0 || selection.isCollapsed)
299-
return
298+
if (!selection || selection.rangeCount == 0 || selection.isCollapsed) return
300299

301300
const range = selection.getRangeAt(0)
302301
const input_element = input_ref.current
@@ -579,7 +578,7 @@ export const use_handlers = (
579578
if (
580579
!input_ref.current ||
581580
!selection ||
582-
selection.rangeCount === 0 ||
581+
selection.rangeCount == 0 ||
583582
!selection.isCollapsed
584583
) {
585584
return
@@ -648,7 +647,7 @@ export const use_handlers = (
648647
) => {
649648
const active_history = props.chat_history
650649

651-
if (active_history.length === 0) return
650+
if (active_history.length == 0) return
652651

653652
e.preventDefault()
654653

@@ -669,7 +668,7 @@ export const use_handlers = (
669668
const new_index = history_index - 1
670669
set_history_index(new_index)
671670
update_and_set_caret(active_history[new_index])
672-
} else if (history_index === 0) {
671+
} else if (history_index == 0) {
673672
set_history_index(-1)
674673
update_and_set_caret('')
675674
}
@@ -681,7 +680,7 @@ export const use_handlers = (
681680

682681
if ((e.ctrlKey || e.metaKey) && !shiftKey && key.toLowerCase() == 'c') {
683682
const selection = window.getSelection()
684-
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
683+
if (!selection || selection.rangeCount == 0 || selection.isCollapsed) {
685684
e.preventDefault()
686685
props.on_copy()
687686
return
@@ -846,7 +845,7 @@ export const use_handlers = (
846845
if (e.ctrlKey || e.metaKey) {
847846
e.preventDefault()
848847
const raw_pos = raw_caret_pos_ref.current
849-
if (raw_pos === 0) return
848+
if (raw_pos == 0) return
850849

851850
const value = props.value
852851
let i = raw_pos - 1

‎packages/ui/src/components/editor/panel/PromptField/utils/caret.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const get_caret_position_from_div = (element: HTMLElement): number => {
22
const selection = window.getSelection()
3-
if (!selection || selection.rangeCount === 0) {
3+
if (!selection || selection.rangeCount == 0) {
44
return 0
55
}
66
const range = selection.getRangeAt(0)

‎packages/ui/src/components/editor/panel/Tasks/hooks/use-auto-focus-new-task.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const use_auto_focus_new_task = (
3131
(id) => !prev_ids_ref.current.has(id)
3232
)
3333

34-
if (added_ids.length === 1) {
34+
if (added_ids.length == 1) {
3535
const new_task = id_to_task.get(added_ids[0])
3636
if (new_task && new_task.text === '') {
3737
set_editing_timestamp(added_ids[0])

‎packages/vscode/src/commands/add-file-to-context-command.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const add_file_to_context_command = (
1717
'codeWebChat.addFileToContext',
1818
async () => {
1919
const workspace_roots = workspace_provider.get_workspace_roots()
20-
if (workspace_roots.length === 0) {
20+
if (workspace_roots.length == 0) {
2121
return
2222
}
2323

@@ -250,7 +250,7 @@ export const add_file_to_context_command = (
250250

251251
items.sort((a, b) => {
252252
const label_diff = natural_sort(a.label, b.label)
253-
if (label_diff !== 0) return label_diff
253+
if (label_diff != 0) return label_diff
254254
return natural_sort(a.description || '', b.description || '')
255255
})
256256

‎packages/vscode/src/commands/apply-chat-response-command/handlers/conflict-markers-handler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ function apply_conflict_markers_to_content(
378378

379379
const index = current_content.indexOf(search_text, cursor)
380380

381-
if (index === -1) {
381+
if (index == -1) {
382382
throw new Error(
383383
`Could not find content to replace for conflict marker. Context:\n${search_text.slice(0, 100)}...`
384384
)

‎packages/vscode/src/commands/apply-chat-response-command/handlers/truncated-handler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function find_line_sequence(
247247
sequence: string[],
248248
start_idx: number
249249
): number {
250-
if (sequence.length === 0) return -1
250+
if (sequence.length == 0) return -1
251251
if (start_idx >= lines.length) return -1
252252

253253
for (let i = start_idx; i <= lines.length - sequence.length; i++) {

‎packages/vscode/src/commands/apply-chat-response-command/utils/clipboard-parser/parsers/code-completion-parser.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ export const parse_code_completion = (params: {
5050
}
5151
}
5252

53-
if (code_block_start_index === -1) {
53+
if (code_block_start_index == -1) {
5454
return null
5555
}
5656

57-
if (code_block_end_index === -1) {
57+
if (code_block_end_index == -1) {
5858
code_block_end_index = lines.length - 1
5959
}
6060

0 commit comments

Comments
 (0)