Skip to content

Commit a0c566f

Browse files
Trotttargos
authored andcommitted
debugger: apply automatic lint fixes for inspect_repl.js
For issues that ESLint can fix automatically, fix them. PR-URL: #38411 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent b884ea7 commit a0c566f

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

lib/internal/inspector/inspect_repl.js

+17-14
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ function createRepl(inspector) {
353353
})
354354
.join('\n');
355355
}
356+
356357
function listScripts(displayNatives = false) {
357358
print(formatScripts(displayNatives));
358359
}
@@ -402,9 +403,9 @@ function createRepl(inspector) {
402403
const i = start + offset;
403404
const isCurrent = i === (lineNumber + 1);
404405

405-
const markedLine = isCurrent
406-
? markSourceColumn(lineText, columnNumber, options.colors)
407-
: lineText;
406+
const markedLine = isCurrent ?
407+
markSourceColumn(lineText, columnNumber, options.colors) :
408+
lineText;
408409

409410
let isBreakpoint = false;
410411
knownBreakpoints.forEach(({ location }) => {
@@ -488,7 +489,7 @@ function createRepl(inspector) {
488489

489490
function prepareControlCode(input) {
490491
if (input === '\n') return lastCommand;
491-
// exec process.title => exec("process.title");
492+
// Add parentheses: exec process.title => exec("process.title");
492493
const match = input.match(/^\s*exec\s+([^\n]*)/);
493494
if (match) {
494495
lastCommand = `exec(${JSON.stringify(match[1])})`;
@@ -678,13 +679,13 @@ function createRepl(inspector) {
678679
// setBreakpoint('fn()'): Break when a function is called
679680
if (script.endsWith('()')) {
680681
const debugExpr = `debug(${script.slice(0, -2)})`;
681-
const debugCall = selectedFrame
682-
? Debugger.evaluateOnCallFrame({
682+
const debugCall = selectedFrame ?
683+
Debugger.evaluateOnCallFrame({
683684
callFrameId: selectedFrame.callFrameId,
684685
expression: debugExpr,
685686
includeCommandLineAPI: true,
686-
})
687-
: Runtime.evaluate({
687+
}) :
688+
Runtime.evaluate({
688689
expression: debugExpr,
689690
includeCommandLineAPI: true,
690691
});
@@ -807,7 +808,7 @@ function createRepl(inspector) {
807808

808809
inspector.suspendReplWhile(() =>
809810
Promise.all([formatWatchers(true), selectedFrame.list(2)])
810-
.then(([watcherList, context]) => {
811+
.then(({ 0: watcherList, 1: context }) => {
811812
if (watcherList) {
812813
return `${watcherList}\n${inspect(context)}`;
813814
}
@@ -829,17 +830,15 @@ function createRepl(inspector) {
829830
Debugger.on('scriptParsed', (script) => {
830831
const { scriptId, url } = script;
831832
if (url) {
832-
knownScripts[scriptId] = Object.assign({
833-
isNative: isNativeUrl(url),
834-
}, script);
833+
knownScripts[scriptId] = { isNative: isNativeUrl(url), ...script };
835834
}
836835
});
837836

838837
Profiler.on('consoleProfileFinished', ({ profile }) => {
839838
Profile.createAndRegister({ profile });
840839
print([
841840
'Captured new CPU profile.',
842-
`Access it with profiles[${profiles.length - 1}]`
841+
`Access it with profiles[${profiles.length - 1}]`,
843842
].join('\n'));
844843
});
845844

@@ -931,22 +930,26 @@ function createRepl(inspector) {
931930
print(`Heap snapshot: ${done}/${total}`, false);
932931
}
933932
}
933+
934934
function onChunk({ chunk }) {
935935
sizeWritten += chunk.length;
936936
writer.write(chunk);
937937
print(`Writing snapshot: ${sizeWritten}`, false);
938938
}
939+
939940
function onResolve() {
940941
writer.end(() => {
941942
teardown();
942943
print(`Wrote snapshot: ${absoluteFile}`);
943944
resolve();
944945
});
945946
}
947+
946948
function onReject(error) {
947949
teardown();
948950
reject(error);
949951
}
952+
950953
function teardown() {
951954
HeapProfiler.removeListener(
952955
'reportHeapSnapshotProgress', onProgress);
@@ -1071,7 +1074,7 @@ function createRepl(inspector) {
10711074
.then(() => Debugger.setBlackboxPatterns({ patterns: [] }))
10721075
.then(() => Debugger.setPauseOnExceptions({ state: pauseOnExceptionState }))
10731076
.then(() => restoreBreakpoints())
1074-
.then(() => Runtime.runIfWaitingForDebugger())
1077+
.then(() => Runtime.runIfWaitingForDebugger());
10751078
}
10761079

10771080
return function startRepl() {

0 commit comments

Comments
 (0)