mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 07:04:04 -05:00
Library updates and lint fixes (#8099)
* Minor updates only * Added explicit radix parameter (10) to all Number.parseInt() calls throughout the codebase (new lint rule) * Updated several @ts-ignore comments to @ts-expect-error for better TypeScript practices (new lint rule) * Removed unnecessary @ts-ignore comments in some mode files (ditto) * Used "none return" based arrow functions for some map stuff * Replaced a `map()` call that didn't return anything to a for() loop * Fixed up some cypress stuff, noting work for the future
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
import {setMonacoEditorContent} from '../support/utils';
|
||||
|
||||
// TODO: all these tests ought to be able to use `should(have.text, ...)`.
|
||||
describe('Monaco Editor Utilities', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/');
|
||||
@@ -33,8 +34,7 @@ describe('Monaco Editor Utilities', () => {
|
||||
const simpleCode = 'int main() { return 42; }';
|
||||
setMonacoEditorContent(simpleCode);
|
||||
|
||||
// Verify the content was set (basic check)
|
||||
cy.get('.monaco-editor').should('contain.text', 'main');
|
||||
cy.get('.monaco-editor .view-lines').first().should('contain.text', 'main');
|
||||
});
|
||||
|
||||
it('should set complex multi-line code content', () => {
|
||||
@@ -43,26 +43,23 @@ describe('Monaco Editor Utilities', () => {
|
||||
|
||||
int main() {
|
||||
std::vector<int> nums = {1, 2, 3, 4, 5};
|
||||
|
||||
|
||||
for (int num : nums) {
|
||||
std::cout << num << std::endl;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}`;
|
||||
setMonacoEditorContent(complexCode);
|
||||
|
||||
// Verify the content was set (basic check)
|
||||
cy.get('.monaco-editor').should('contain.text', 'iostream');
|
||||
cy.get('.monaco-editor').should('contain.text', 'vector');
|
||||
cy.get('.monaco-editor .view-lines').first().should('contain.text', 'iostream');
|
||||
cy.get('.monaco-editor .view-lines').first().should('contain.text', 'vector');
|
||||
});
|
||||
|
||||
it('should handle special characters and quotes', () => {
|
||||
const codeWithSpecialChars = `const char* message = "Hello, \"World\"!";
|
||||
int result = (x > 0) ? x : -x;`;
|
||||
const codeWithSpecialChars = `const char* message = "Hello, \\"World\\"!";`;
|
||||
setMonacoEditorContent(codeWithSpecialChars);
|
||||
|
||||
// Verify the content was set (basic check)
|
||||
cy.get('.monaco-editor').should('contain.text', 'Hello');
|
||||
cy.get('.monaco-editor .view-lines').first().should('contain.text', 'Hello');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ export function startListening(webServer: express.Express, appArgs: AppArguments
|
||||
function setupSystemdSocketListening(webServer: express.Express, ss: {fd: number}): void {
|
||||
// ms (5 min default)
|
||||
const idleTimeout = process.env.IDLE_TIMEOUT;
|
||||
const timeout = (idleTimeout === undefined ? 300 : Number.parseInt(idleTimeout)) * 1000;
|
||||
const timeout = (idleTimeout === undefined ? 300 : Number.parseInt(idleTimeout, 10)) * 1000;
|
||||
if (idleTimeout) {
|
||||
setupIdleTimeout(webServer, timeout);
|
||||
logger.info(` IDLE_TIMEOUT: ${idleTimeout}`);
|
||||
|
||||
@@ -29,6 +29,7 @@ import express from 'express';
|
||||
import urljoin from 'url-join';
|
||||
|
||||
import {ElementType} from '../../shared/common-utils.js';
|
||||
import {unwrap} from '../assert.js';
|
||||
import {logger} from '../logger.js';
|
||||
import {PugRequireHandler, ServerOptions} from './server.interfaces.js';
|
||||
|
||||
@@ -71,7 +72,7 @@ export async function setupWebPackDevMiddleware(options: ServerOptions, router:
|
||||
|
||||
type WebpackConfiguration = ElementType<Parameters<typeof webpack>[0]>;
|
||||
|
||||
const webpackCompiler = webpack([webpackConfig as WebpackConfiguration]);
|
||||
const webpackCompiler = unwrap(webpack([webpackConfig as WebpackConfiguration]));
|
||||
router.use(
|
||||
webpackDevMiddleware(webpackCompiler, {
|
||||
publicPath: '/',
|
||||
|
||||
@@ -3143,7 +3143,7 @@ export class BaseCompiler {
|
||||
if (res.languageId) result.languageId = res.languageId;
|
||||
if (result.objdumpTime) {
|
||||
const dumpAndParseTime =
|
||||
Number.parseInt(result.objdumpTime) + Number.parseInt(result.parsingTime);
|
||||
Number.parseInt(result.objdumpTime, 10) + Number.parseInt(result.parsingTime, 10);
|
||||
BaseCompiler.objdumpAndParseCounter.inc(dumpAndParseTime);
|
||||
}
|
||||
} else {
|
||||
|
||||
2
lib/cache/from-config.ts
vendored
2
lib/cache/from-config.ts
vendored
@@ -32,7 +32,7 @@ import {OnDiskCache} from './on-disk.js';
|
||||
import {S3Cache} from './s3.js';
|
||||
|
||||
function paramInt(config: string, param: string): number {
|
||||
const result = Number.parseInt(param);
|
||||
const result = Number.parseInt(param, 10);
|
||||
if (Number.isNaN(result)) throw new Error(`Bad params: ${config}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
6
lib/cache/on-disk.ts
vendored
6
lib/cache/on-disk.ts
vendored
@@ -70,7 +70,7 @@ export class OnDiskCache extends BaseCache {
|
||||
if (stat.size === 0 || fullPath.endsWith('.tmp')) {
|
||||
logger.info(`Removing old temporary or broken empty file ${fullPath}`);
|
||||
fs.unlink(fullPath, () => {});
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
key: name,
|
||||
@@ -85,10 +85,10 @@ export class OnDiskCache extends BaseCache {
|
||||
|
||||
// Sort oldest first
|
||||
|
||||
// @ts-ignore filter(Boolean) should have sufficed but doesn't
|
||||
// @ts-expect-error filter(Boolean) should have sufficed but doesn't
|
||||
info.sort((x, y) => x.sort - y.sort);
|
||||
for (const i of info) {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
this.cache.set(i.key, i.data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export class PythonCFGParser extends BaseCFGParser {
|
||||
let funcName: string | undefined;
|
||||
if (line.text.startsWith('Disassembly of')) {
|
||||
const srcLineStr = line.text.match(/line (\d+)/)?.[1];
|
||||
const srcLineNum = srcLineStr ? Number.parseInt(srcLineStr) : null;
|
||||
const srcLineNum = srcLineStr ? Number.parseInt(srcLineStr, 10) : null;
|
||||
if (srcLineNum && fullRes && fullRes.inputFilename) {
|
||||
if (src === null) {
|
||||
src = await fs.readFile(fullRes.inputFilename, 'utf8');
|
||||
|
||||
@@ -363,7 +363,7 @@ export class CompilerFinder {
|
||||
const pathParts = bits[1].split('/');
|
||||
return {
|
||||
host: bits[0],
|
||||
port: Number.parseInt(unwrap(pathParts.shift())),
|
||||
port: Number.parseInt(unwrap(pathParts.shift()), 10),
|
||||
uriBase: pathParts.join('/'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ export class CarbonExplorerCompiler extends BaseCompiler {
|
||||
// Hook to parse out the "result: 123" line at the end of the interpreted execution run.
|
||||
const re = /^result: (\d+)$/;
|
||||
const match = re.exec(this.lastLine(result.asm as ResultLine[]));
|
||||
const code = match ? Number.parseInt(match[1]) : -1;
|
||||
const code = match ? Number.parseInt(match[1], 10) : -1;
|
||||
result.execResult = {
|
||||
stdout: result.stdout,
|
||||
stderr: [],
|
||||
|
||||
@@ -271,7 +271,7 @@ export class D8Compiler extends BaseCompiler implements SimpleOutputFilenameComp
|
||||
let lineNumber;
|
||||
for (const l of asm.split(/\n/)) {
|
||||
if (this.lineNumberRegex.test(l)) {
|
||||
lineNumber = Number.parseInt(l.match(this.lineNumberRegex)[1]);
|
||||
lineNumber = Number.parseInt(l.match(this.lineNumberRegex)[1], 10);
|
||||
segments.push({text: l, source: null});
|
||||
} else if (this.methodEndRegex.test(l)) {
|
||||
lineNumber = null;
|
||||
|
||||
@@ -256,7 +256,7 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
let match;
|
||||
if (this.versionPrefixRegex.test(this.compiler.id)) {
|
||||
match = this.compiler.id.match(this.versionPrefixRegex);
|
||||
versionPrefix = Number.parseInt(match![2]);
|
||||
versionPrefix = Number.parseInt(match![2], 10);
|
||||
} else if (this.latestVersionRegex.test(this.compiler.id)) {
|
||||
isLatest = true;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
dexPc = -1;
|
||||
} else if (this.smaliLineNumberRegex.test(l)) {
|
||||
// Line numbers are given in decimal.
|
||||
lineNumber = Number.parseInt(l.match(this.smaliLineNumberRegex)![1]);
|
||||
lineNumber = Number.parseInt(l.match(this.smaliLineNumberRegex)![1], 10);
|
||||
dexPcsToLines[methodSignature][dexPc] = lineNumber;
|
||||
} else if (this.smaliDexPcRegex.test(l)) {
|
||||
// Dex PCs are given in hex.
|
||||
@@ -736,7 +736,7 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
inCode = false;
|
||||
} else if (this.methodSizeRegex.test(l)) {
|
||||
match = l.match(this.methodSizeRegex);
|
||||
methodsToSizes[currentMethod] = Number.parseInt(match![2]);
|
||||
methodsToSizes[currentMethod] = Number.parseInt(match![2], 10);
|
||||
currentCodeOffset = Number.parseInt(match![1], 16);
|
||||
inCode = true;
|
||||
} else if (inCode && this.insnRegex.test(l)) {
|
||||
|
||||
@@ -96,7 +96,7 @@ export class HookCompiler extends BaseCompiler {
|
||||
}
|
||||
const match = text.match(instructionRegex);
|
||||
if (match) {
|
||||
const lineNo = Number.parseInt(match[1]);
|
||||
const lineNo = Number.parseInt(match[1], 10);
|
||||
item.source = {line: lineNo, file: null};
|
||||
lastLineNo = lineNo;
|
||||
continue;
|
||||
|
||||
@@ -358,7 +358,7 @@ export class JavaCompiler extends BaseCompiler implements SimpleOutputFilenameCo
|
||||
// default: <code>
|
||||
const match = codeLineCandidate.match(/\s+([\d-]+|default): (.*)/);
|
||||
if (match) {
|
||||
const instrOffset = Number.parseInt(match[1]);
|
||||
const instrOffset = Number.parseInt(match[1], 10);
|
||||
method.instructions.push({
|
||||
instrOffset: instrOffset,
|
||||
// Should an instruction ever not be followed by a line number table,
|
||||
@@ -393,7 +393,7 @@ export class JavaCompiler extends BaseCompiler implements SimpleOutputFilenameCo
|
||||
lastIndex = lineRegex.lastIndex;
|
||||
const [, sourceLineS, instructionS] = m;
|
||||
logger.verbose('Found source mapping: ', sourceLineS, 'to instruction', instructionS);
|
||||
const instrOffset = Number.parseInt(instructionS);
|
||||
const instrOffset = Number.parseInt(instructionS, 10);
|
||||
|
||||
// Some instructions don't receive an explicit line number.
|
||||
// They are all assigned to the previous explicit line number,
|
||||
@@ -415,7 +415,7 @@ export class JavaCompiler extends BaseCompiler implements SimpleOutputFilenameCo
|
||||
currentInstr++;
|
||||
}
|
||||
|
||||
const sourceLine = Number.parseInt(sourceLineS);
|
||||
const sourceLine = Number.parseInt(sourceLineS, 10);
|
||||
currentSourceLine = sourceLine;
|
||||
if (method.instructions[currentInstr]) {
|
||||
method.instructions[currentInstr].sourceLine = currentSourceLine;
|
||||
|
||||
@@ -57,7 +57,8 @@ export class NumbaCompiler extends BaseCompiler {
|
||||
if (!match) continue;
|
||||
item.text = item.text.slice(0, match.index);
|
||||
const inNvccCode = false;
|
||||
if (this.asm.hasOpcode(item.text, inNvccCode)) item.source = {line: Number.parseInt(match[1]), file: null};
|
||||
if (this.asm.hasOpcode(item.text, inNvccCode))
|
||||
item.source = {line: Number.parseInt(match[1], 10), file: null};
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ export class OdinCompiler extends BaseCompiler {
|
||||
for (const line of asmLines) {
|
||||
const match = line.match(fileFind);
|
||||
if (match) {
|
||||
const lineNum = Number.parseInt(match[1]);
|
||||
const lineNum = Number.parseInt(match[1], 10);
|
||||
if (match[4] && !line.includes('.cv_file')) {
|
||||
// Clang-style file directive '.file X "dir" "filename"'
|
||||
if (match[4].startsWith('/')) {
|
||||
|
||||
@@ -66,7 +66,7 @@ export class PtxAssembler extends BaseCompiler {
|
||||
lineObj.text = `<source>:${match[1]} ${match[2].trim()}`;
|
||||
lineObj.tag = {
|
||||
severity: 0,
|
||||
line: Number.parseInt(match[1]),
|
||||
line: Number.parseInt(match[1], 10),
|
||||
column: 0,
|
||||
text: match[2].trim(),
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ export class PythonCompiler extends BaseCompiler {
|
||||
const match = line.match(lineRe);
|
||||
|
||||
if (match) {
|
||||
const lineno = Number.parseInt(match[1]);
|
||||
const lineno = Number.parseInt(match[1], 10);
|
||||
sourceLoc = {line: lineno, file: null};
|
||||
lastLineNo = lineno;
|
||||
} else if (line) {
|
||||
|
||||
@@ -67,7 +67,7 @@ export class RakuCompiler extends BaseCompiler {
|
||||
lastLineNo = null;
|
||||
sourceLoc = {line: null, file: null};
|
||||
} else if (matchLine) {
|
||||
const lineno = Number.parseInt(matchLine[2]);
|
||||
const lineno = Number.parseInt(matchLine[2], 10);
|
||||
sourceLoc = {line: lineno, file: null};
|
||||
lastLineNo = lineno;
|
||||
} else if (line) {
|
||||
|
||||
@@ -64,12 +64,12 @@ export class RubyCompiler extends BaseCompiler {
|
||||
const match = line.match(lineRe);
|
||||
|
||||
if (match) {
|
||||
lastLineNo = Number.parseInt(match[1]);
|
||||
lastLineNo = Number.parseInt(match[1], 10);
|
||||
} else if (line) {
|
||||
const fileMatch = line.match(fileRe);
|
||||
if (fileMatch) {
|
||||
lastFile = fileMatch[1];
|
||||
lastLineNo = Number.parseInt(fileMatch[2]);
|
||||
lastLineNo = Number.parseInt(fileMatch[2], 10);
|
||||
}
|
||||
} else {
|
||||
lastFile = null;
|
||||
|
||||
@@ -115,7 +115,7 @@ export class SolidityCompiler extends BaseCompiler {
|
||||
return node.name === 'FunctionDefinition';
|
||||
})
|
||||
.map(node => {
|
||||
const [begin, length] = node.src.split(':').map(x => Number.parseInt(x));
|
||||
const [begin, length] = node.src.split(':').map(x => Number.parseInt(x, 10));
|
||||
|
||||
let name = node.attributes.isConstructor ? 'constructor' : node.attributes.name;
|
||||
|
||||
@@ -147,7 +147,7 @@ export class SolidityCompiler extends BaseCompiler {
|
||||
return node.nodeType === 'FunctionDefinition';
|
||||
})
|
||||
.map(node => {
|
||||
const [begin, length] = node.src.split(':').map(x => Number.parseInt(x));
|
||||
const [begin, length] = node.src.split(':').map(x => Number.parseInt(x, 10));
|
||||
|
||||
let name = node.kind === 'constructor' ? 'constructor' : node.name;
|
||||
|
||||
@@ -179,7 +179,7 @@ export class SolidityCompiler extends BaseCompiler {
|
||||
const generatedSources = {};
|
||||
for (const generatedSource of generatedSourcesData) {
|
||||
generatedSources[generatedSource.id] = generatedSource.ast.statements.map(statement => {
|
||||
const [begin, length] = statement.src.split(':').map(x => Number.parseInt(x));
|
||||
const [begin, length] = statement.src.split(':').map(x => Number.parseInt(x, 10));
|
||||
return {
|
||||
name: statement.name,
|
||||
begin: begin,
|
||||
|
||||
@@ -162,7 +162,7 @@ export class z88dkCompiler extends BaseCompiler {
|
||||
if (this.externalparser) {
|
||||
const objResult = await this.externalparser.objdumpAndParseAssembly(result.dirPath, args, filters);
|
||||
if (objResult.parsingTime !== undefined) {
|
||||
objResult.objdumpTime = Number.parseInt(result.execTime) - Number.parseInt(result.parsingTime);
|
||||
objResult.objdumpTime = Number.parseInt(result.execTime, 10) - Number.parseInt(result.parsingTime, 10);
|
||||
delete objResult.execTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ export class RouteAPI {
|
||||
|
||||
storedCodeHandler(req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const id = req.params.id;
|
||||
const sessionid = Number.parseInt(req.params.session);
|
||||
const sessionid = Number.parseInt(req.params.session, 10);
|
||||
this.storageHandler
|
||||
.expandId(id)
|
||||
.then(result => {
|
||||
|
||||
@@ -29,7 +29,6 @@ import {LEVEL, MESSAGE} from 'triple-beam';
|
||||
import winston from 'winston';
|
||||
import LokiTransport from 'winston-loki';
|
||||
|
||||
// @ts-ignore
|
||||
import {Papertrail} from 'winston-papertrail';
|
||||
import TransportStream, {TransportStreamOptions} from 'winston-transport';
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ export class AsmParserCpp implements IAsmParser {
|
||||
// TODO perhaps we'll need to check the file here at some point in the future.
|
||||
// TODO I've temporarily disabled this as the result is visually too noisy
|
||||
// was: source = {file: null, line: parseInt(match.groups.line)};
|
||||
source = {file: match.groups.file, line: Number.parseInt(match.groups.line)};
|
||||
source = {file: match.groups.file, line: Number.parseInt(match.groups.line, 10)};
|
||||
if (filters.directives) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ export class DartAsmParser extends AsmParser {
|
||||
if (dontMaskFilenames) {
|
||||
source = {
|
||||
file: utils.maskRootdir(match[1]),
|
||||
line: Number.parseInt(match.groups.line),
|
||||
line: Number.parseInt(match.groups.line, 10),
|
||||
mainsource: true,
|
||||
};
|
||||
} else {
|
||||
source = {file: null, line: Number.parseInt(match.groups.line), mainsource: true};
|
||||
source = {file: null, line: Number.parseInt(match.groups.line, 10), mainsource: true};
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -156,12 +156,12 @@ export class DotNetAsmParser implements IAsmParser {
|
||||
|
||||
for (const i in result.labelDef) {
|
||||
const label = result.labelDef[i];
|
||||
labelDefinitions.push([label.name, Number.parseInt(i)]);
|
||||
labelDefinitions.push([label.name, Number.parseInt(i, 10)]);
|
||||
}
|
||||
|
||||
for (const i in result.methodDef) {
|
||||
const method = result.methodDef[i];
|
||||
labelDefinitions.push([method, Number.parseInt(i)]);
|
||||
labelDefinitions.push([method, Number.parseInt(i, 10)]);
|
||||
}
|
||||
|
||||
for (const line in asmLines) {
|
||||
|
||||
@@ -105,7 +105,7 @@ export class AsmEWAVRParser extends AsmParser {
|
||||
const getLineNumberFromComment = (line: string) => {
|
||||
const matches = line.match(this.lineNumberComment);
|
||||
if (matches) {
|
||||
return Number.parseInt(matches[1]);
|
||||
return Number.parseInt(matches[1], 10);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -244,9 +244,9 @@ export class PTXAsmParser extends AsmParser {
|
||||
private processSourceLine(line: string, files: Record<number, string>): AsmResultSource | null {
|
||||
const locMatch = line.match(this.sourceTag);
|
||||
if (locMatch) {
|
||||
const fileNum = Number.parseInt(locMatch[1]);
|
||||
const lineNum = Number.parseInt(locMatch[2]);
|
||||
const columnNum = Number.parseInt(locMatch[3]);
|
||||
const fileNum = Number.parseInt(locMatch[1], 10);
|
||||
const lineNum = Number.parseInt(locMatch[2], 10);
|
||||
const columnNum = Number.parseInt(locMatch[3], 10);
|
||||
|
||||
const file = files[fileNum];
|
||||
if (file) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class SPIRVAsmParser extends AsmParser {
|
||||
for (const line of asmLines) {
|
||||
const match = line.match(opString);
|
||||
if (match) {
|
||||
const lineNum = Number.parseInt(match[1]);
|
||||
const lineNum = Number.parseInt(match[1], 10);
|
||||
files[lineNum] = match[2];
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ export class SPIRVAsmParser extends AsmParser {
|
||||
|
||||
let match = line.match(opConstant);
|
||||
if (match) {
|
||||
constantIdToValue[match[1]] = Number.parseInt(match[2]);
|
||||
constantIdToValue[match[1]] = Number.parseInt(match[2], 10);
|
||||
}
|
||||
match = line.match(opDebugSoruce);
|
||||
if (match) {
|
||||
@@ -154,7 +154,7 @@ export class SPIRVAsmParser extends AsmParser {
|
||||
if (match) {
|
||||
const opStringId = idToOpString[match[1]];
|
||||
source = {
|
||||
file: utils.maskRootdir(opStrings[Number.parseInt(opStringId)]),
|
||||
file: utils.maskRootdir(opStrings[Number.parseInt(opStringId, 10)]),
|
||||
line: constantIdToValue[match[1]],
|
||||
mainsource: true,
|
||||
};
|
||||
@@ -164,11 +164,11 @@ export class SPIRVAsmParser extends AsmParser {
|
||||
match = line.match(sourceTag);
|
||||
if (match) {
|
||||
source = {
|
||||
file: utils.maskRootdir(opStrings[Number.parseInt(match[1])]),
|
||||
line: Number.parseInt(match[2]),
|
||||
file: utils.maskRootdir(opStrings[Number.parseInt(match[1], 10)]),
|
||||
line: Number.parseInt(match[2], 10),
|
||||
mainsource: true,
|
||||
};
|
||||
const sourceCol = Number.parseInt(match[3]);
|
||||
const sourceCol = Number.parseInt(match[3], 10);
|
||||
if (!Number.isNaN(sourceCol) && sourceCol !== 0) {
|
||||
source.column = sourceCol;
|
||||
}
|
||||
|
||||
@@ -83,12 +83,12 @@ export class TurboCAsmParser extends AsmParser {
|
||||
if (filters.dontMaskFilenames) {
|
||||
source = {
|
||||
file: currentfile,
|
||||
line: Number.parseInt(currentline),
|
||||
line: Number.parseInt(currentline, 10),
|
||||
};
|
||||
} else {
|
||||
source = {
|
||||
file: null,
|
||||
line: Number.parseInt(currentline),
|
||||
line: Number.parseInt(currentline, 10),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ export class VcAsmParser extends AsmParser {
|
||||
const getLineNumberFromComment = (line: string) => {
|
||||
const matches = line.match(this.lineNumberComment);
|
||||
if (matches) {
|
||||
return Number.parseInt(matches[1]);
|
||||
return Number.parseInt(matches[1], 10);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ export class AsmParserZ88dk extends AsmParser {
|
||||
const handleSource = (line: string) => {
|
||||
const match = line.match(this.sourceTag);
|
||||
if (match) {
|
||||
const sourceLine = Number.parseInt(match[1]);
|
||||
const sourceLine = Number.parseInt(match[1], 10);
|
||||
const file = utils.maskRootdir(match[2]);
|
||||
if (file) {
|
||||
if (dontMaskFilenames) {
|
||||
@@ -76,7 +76,7 @@ export class AsmParserZ88dk extends AsmParser {
|
||||
line: sourceLine,
|
||||
};
|
||||
}
|
||||
const sourceCol = Number.parseInt(match[3]);
|
||||
const sourceCol = Number.parseInt(match[3], 10);
|
||||
if (!Number.isNaN(sourceCol) && sourceCol !== 0) {
|
||||
source.column = sourceCol;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ export class AsmParser extends AsmRegex implements IAsmParser {
|
||||
const match = line.match(this.fileFind);
|
||||
if (!match) continue;
|
||||
|
||||
const lineNum = Number.parseInt(match[1]);
|
||||
const lineNum = Number.parseInt(match[1], 10);
|
||||
if (match[4] && !line.includes('.cv_file')) {
|
||||
// Clang-style file directive '.file X "dir" "filename"'
|
||||
if (match[4].startsWith('/')) {
|
||||
@@ -644,11 +644,11 @@ export class AsmParser extends AsmRegex implements IAsmParser {
|
||||
if (dontMaskFilenames) {
|
||||
source = {
|
||||
file: utils.maskRootdir(match[1]),
|
||||
line: Number.parseInt(match.groups.line),
|
||||
line: Number.parseInt(match.groups.line, 10),
|
||||
mainsource: true,
|
||||
};
|
||||
} else {
|
||||
source = {file: null, line: Number.parseInt(match.groups.line), mainsource: true};
|
||||
source = {file: null, line: Number.parseInt(match.groups.line, 10), mainsource: true};
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ export class Dex2OatPassDumpParser {
|
||||
for (const instruction of methodsToInstructions[methodName]) {
|
||||
if (this.dexPcRegex.test(instruction)) {
|
||||
match = instruction.match(this.dexPcRegex);
|
||||
dexPc = Number.parseInt(match![1]);
|
||||
dexPc = Number.parseInt(match![1], 10);
|
||||
remove.push(instruction);
|
||||
} else if (this.offsetRegex.test(instruction)) {
|
||||
match = instruction.match(this.offsetRegex);
|
||||
|
||||
@@ -116,7 +116,7 @@ export class RacketPassDumpParser {
|
||||
}
|
||||
const linkletPhaseMatch = line.text.match(this.linkletPhaseHeader);
|
||||
if (linkletPhaseMatch) {
|
||||
linkletPhase = Number.parseInt(linkletPhaseMatch[1]);
|
||||
linkletPhase = Number.parseInt(linkletPhaseMatch[1], 10);
|
||||
continue;
|
||||
}
|
||||
const stepMatch = line.text.match(this.stepHeader);
|
||||
|
||||
@@ -79,12 +79,12 @@ export class SourceLineHandler {
|
||||
const match = line.match(this.sourceTag);
|
||||
if (!match) return null;
|
||||
|
||||
const file = utils.maskRootdir(context.files[Number.parseInt(match[1])]);
|
||||
const sourceLine = Number.parseInt(match[2]);
|
||||
const file = utils.maskRootdir(context.files[Number.parseInt(match[1], 10)]);
|
||||
const sourceLine = Number.parseInt(match[2], 10);
|
||||
|
||||
if (!file) return null;
|
||||
|
||||
return this.createSource(file, sourceLine, context, Number.parseInt(match[3]));
|
||||
return this.createSource(file, sourceLine, context, Number.parseInt(match[3], 10));
|
||||
}
|
||||
|
||||
handleD2Tag(line: string): AsmResultSource | null {
|
||||
@@ -93,7 +93,7 @@ export class SourceLineHandler {
|
||||
|
||||
return {
|
||||
file: null,
|
||||
line: Number.parseInt(match[1]),
|
||||
line: Number.parseInt(match[1], 10),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -101,10 +101,10 @@ export class SourceLineHandler {
|
||||
const match = line.match(this.sourceCVTag);
|
||||
if (!match) return null;
|
||||
|
||||
const sourceLine = Number.parseInt(match[3]);
|
||||
const file = utils.maskRootdir(context.files[Number.parseInt(match[2])]);
|
||||
const sourceLine = Number.parseInt(match[3], 10);
|
||||
const file = utils.maskRootdir(context.files[Number.parseInt(match[2], 10)]);
|
||||
|
||||
return this.createSource(file, sourceLine, context, Number.parseInt(match[4]));
|
||||
return this.createSource(file, sourceLine, context, Number.parseInt(match[4], 10));
|
||||
}
|
||||
|
||||
handle6502Debug(line: string, context: SourceHandlerContext): AsmResultSource | null {
|
||||
@@ -116,7 +116,7 @@ export class SourceLineHandler {
|
||||
if (!match) return null;
|
||||
|
||||
const file = utils.maskRootdir(match[1]);
|
||||
const sourceLine = Number.parseInt(match[2]);
|
||||
const sourceLine = Number.parseInt(match[2], 10);
|
||||
|
||||
return this.createSource(file, sourceLine, context);
|
||||
}
|
||||
@@ -126,9 +126,9 @@ export class SourceLineHandler {
|
||||
if (!match) return undefined;
|
||||
|
||||
// cf http://www.math.utah.edu/docs/info/stabs_11.html#SEC48
|
||||
switch (Number.parseInt(match[1])) {
|
||||
switch (Number.parseInt(match[1], 10)) {
|
||||
case STAB_N_SLINE:
|
||||
return {file: null, line: Number.parseInt(match[2])};
|
||||
return {file: null, line: Number.parseInt(match[2], 10)};
|
||||
case STAB_N_SO:
|
||||
case STAB_N_SOL:
|
||||
return null;
|
||||
|
||||
@@ -47,7 +47,7 @@ export function parse(suText: string): StackUsageInfo[] {
|
||||
DebugLoc: {File: pathLocName[0], Line: lineNumber, Column: 0},
|
||||
Function: pathLocName.at(-1),
|
||||
Qualifier: qualifier,
|
||||
BytesUsed: Number.parseInt(c[1]),
|
||||
BytesUsed: Number.parseInt(c[1], 10),
|
||||
displayString: c[1] + ' bytes, ' + qualifier,
|
||||
};
|
||||
output.push(su as StackUsageInfo);
|
||||
|
||||
@@ -50,7 +50,7 @@ export class ClippyTool extends BaseTool {
|
||||
) {
|
||||
assert(inputFilepath);
|
||||
const clippyArgs = [...(args || []), ...(compilationInfo.compilationOptions || [])];
|
||||
const idxOutput = clippyArgs.findIndex(arg => arg === '-o');
|
||||
const idxOutput = clippyArgs.indexOf('-o');
|
||||
if (idxOutput !== -1 && idxOutput + 1 < clippyArgs.length) {
|
||||
clippyArgs[idxOutput + 1] = path.join(
|
||||
path.dirname(inputFilepath),
|
||||
|
||||
22
lib/utils.ts
22
lib/utils.ts
@@ -175,8 +175,8 @@ function applyParse_SourceWithLine(lineObj: ResultLine, filteredLine: string, in
|
||||
if (match) {
|
||||
const message = match[4].trim();
|
||||
lineObj.tag = {
|
||||
line: Number.parseInt(match[1]),
|
||||
column: Number.parseInt(match[3] || '0'),
|
||||
line: Number.parseInt(match[1], 10),
|
||||
column: Number.parseInt(match[3] || '0', 10),
|
||||
text: message,
|
||||
severity: parseSeverity(message),
|
||||
file: inputFilename ? path.basename(inputFilename) : undefined,
|
||||
@@ -190,8 +190,8 @@ function applyParse_FileWithLine(lineObj: ResultLine, filteredLine: string) {
|
||||
const message = match[5].trim();
|
||||
lineObj.tag = {
|
||||
file: match[1],
|
||||
line: Number.parseInt(match[2]),
|
||||
column: Number.parseInt(match[4] || '0'),
|
||||
line: Number.parseInt(match[2], 10),
|
||||
column: Number.parseInt(match[4] || '0', 10),
|
||||
text: message,
|
||||
severity: parseSeverity(message),
|
||||
};
|
||||
@@ -204,7 +204,7 @@ function applyParse_AtFileLine(lineObj: ResultLine, filteredLine: string) {
|
||||
if (match[1].startsWith('/app/')) {
|
||||
lineObj.tag = {
|
||||
file: match[1].replace(/^\/app\//, ''),
|
||||
line: Number.parseInt(match[2]),
|
||||
line: Number.parseInt(match[2], 10),
|
||||
column: 0,
|
||||
text: filteredLine,
|
||||
severity: 3,
|
||||
@@ -212,7 +212,7 @@ function applyParse_AtFileLine(lineObj: ResultLine, filteredLine: string) {
|
||||
} else if (!match[1].startsWith('/')) {
|
||||
lineObj.tag = {
|
||||
file: match[1],
|
||||
line: Number.parseInt(match[2]),
|
||||
line: Number.parseInt(match[2], 10),
|
||||
column: 0,
|
||||
text: filteredLine,
|
||||
severity: 3,
|
||||
@@ -277,9 +277,9 @@ export function parseRustOutput(lines: string, inputFilename?: string, pathPrefi
|
||||
title: `Add import for \`${path}\``,
|
||||
edits: [
|
||||
{
|
||||
line: Number.parseInt(line),
|
||||
line: Number.parseInt(line, 10),
|
||||
column: 1,
|
||||
endline: Number.parseInt(line),
|
||||
endline: Number.parseInt(line, 10),
|
||||
endcolumn: 1,
|
||||
text: `${indentation}use ${path};\n`,
|
||||
},
|
||||
@@ -299,8 +299,8 @@ export function parseRustOutput(lines: string, inputFilename?: string, pathPrefi
|
||||
const match = filteredLine.match(re);
|
||||
|
||||
if (match) {
|
||||
const line = Number.parseInt(match[1]);
|
||||
const column = Number.parseInt(match[3] || '0');
|
||||
const line = Number.parseInt(match[1], 10);
|
||||
const column = Number.parseInt(match[3] || '0', 10);
|
||||
|
||||
currentDiagnostic = result.pop();
|
||||
if (currentDiagnostic !== undefined) {
|
||||
@@ -456,7 +456,7 @@ export function squashHorizontalWhitespace(line: string, atStart = true): string
|
||||
export function toProperty(prop: string): boolean | number | string {
|
||||
if (prop === 'true' || prop === 'yes') return true;
|
||||
if (prop === 'false' || prop === 'no') return false;
|
||||
if (/^-?(0|[1-9]\d*)$/.test(prop)) return Number.parseInt(prop);
|
||||
if (/^-?(0|[1-9]\d*)$/.test(prop)) return Number.parseInt(prop, 10);
|
||||
if (/^-?\d*\.\d+$/.test(prop)) return Number.parseFloat(prop);
|
||||
return prop;
|
||||
}
|
||||
|
||||
4950
package-lock.json
generated
4950
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
62
package.json
62
package.json
@@ -18,27 +18,27 @@
|
||||
},
|
||||
"main": "./app.ts",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-dynamodb": "^3.848.0",
|
||||
"@aws-sdk/client-ec2": "^3.854.0",
|
||||
"@aws-sdk/client-s3": "^3.850.0",
|
||||
"@aws-sdk/client-sqs": "^3.854.0",
|
||||
"@aws-sdk/client-ssm": "^3.849.0",
|
||||
"@aws-sdk/credential-providers": "^3.848.0",
|
||||
"@aws-sdk/client-dynamodb": "^3.887.0",
|
||||
"@aws-sdk/client-ec2": "^3.887.0",
|
||||
"@aws-sdk/client-s3": "^3.887.0",
|
||||
"@aws-sdk/client-sqs": "^3.887.0",
|
||||
"@aws-sdk/client-ssm": "^3.887.0",
|
||||
"@aws-sdk/credential-providers": "^3.887.0",
|
||||
"@flatten-js/interval-tree": "^1.1.3",
|
||||
"@fortawesome/fontawesome-free": "^7.0.0",
|
||||
"@fortawesome/fontawesome-free": "^7.0.1",
|
||||
"@orchidjs/sifter": "^1.1.0",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@sentry/browser": "^9.42.1",
|
||||
"@sentry/node": "^9.42.1",
|
||||
"@types/semver": "^7.7.0",
|
||||
"@sentry/browser": "^9.46.0",
|
||||
"@sentry/node": "^9.46.0",
|
||||
"@types/semver": "^7.7.1",
|
||||
"big-integer": "^1.6.52",
|
||||
"bootstrap": "^5.3.7",
|
||||
"bootstrap": "^5.3.8",
|
||||
"buffer": "^6.0.3",
|
||||
"chart.js": "^4.5.0",
|
||||
"clipboard": "^2.0.11",
|
||||
"commander": "^14.0.0",
|
||||
"commander": "^14.0.1",
|
||||
"compression": "^1.8.1",
|
||||
"copy-webpack-plugin": "^13.0.0",
|
||||
"copy-webpack-plugin": "^13.0.1",
|
||||
"cross-env": "^10.0.0",
|
||||
"enhanced-ms": "^4.1.0",
|
||||
"events": "^3.3.0",
|
||||
@@ -50,14 +50,14 @@
|
||||
"js-cookie": "^3.0.5",
|
||||
"jszip": "^3.10.1",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"lru-cache": "^11.1.0",
|
||||
"lru-cache": "^11.2.1",
|
||||
"lz-string": "^1.5.0",
|
||||
"marked": "^15.0.12",
|
||||
"monaco-editor": "^0.49.0",
|
||||
"monaco-vim": "^0.4.2",
|
||||
"morgan": "^1.10.1",
|
||||
"node-targz": "^0.2.0",
|
||||
"p-queue": "^8.1.0",
|
||||
"p-queue": "^8.1.1",
|
||||
"path-browserify": "^1.0.1",
|
||||
"profanities": "^3.0.1",
|
||||
"prom-client": "^15.1.3",
|
||||
@@ -71,7 +71,7 @@
|
||||
"tom-select": "^2.4.3",
|
||||
"tree-kill": "^1.2.2",
|
||||
"triple-beam": "^1.4.1",
|
||||
"tsx": "^4.20.3",
|
||||
"tsx": "^4.20.5",
|
||||
"underscore": "^1.13.7",
|
||||
"url-join": "^5.0.0",
|
||||
"whatwg-fetch": "^3.6.20",
|
||||
@@ -81,22 +81,22 @@
|
||||
"winston-papertrail": "^1.0.5",
|
||||
"winston-transport": "^4.9.0",
|
||||
"ws": "^8.18.3",
|
||||
"yaml": "^2.8.0"
|
||||
"yaml": "^2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.1.2",
|
||||
"@sentry/types": "^9.42.1",
|
||||
"@smithy/util-stream": "^4.2.3",
|
||||
"@biomejs/biome": "^2.2.4",
|
||||
"@sentry/types": "^9.46.0",
|
||||
"@smithy/util-stream": "^4.3.1",
|
||||
"@types/bootstrap": "^5.2.10",
|
||||
"@types/chai": "^5.2.2",
|
||||
"@types/compression": "^1.8.1",
|
||||
"@types/express": "^5.0.3",
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@types/http-proxy": "^1.17.16",
|
||||
"@types/jquery": "^3.5.32",
|
||||
"@types/jquery": "^3.5.33",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/node-targz": "^0.2.4",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/request": "^2.48.13",
|
||||
"@types/response-time": "^2.3.9",
|
||||
"@types/temp": "^0.9.4",
|
||||
"@types/underscore": "^1.13.0",
|
||||
@@ -108,28 +108,28 @@
|
||||
"cheerio": "^1.1.2",
|
||||
"css-loader": "^7.1.2",
|
||||
"css-minimizer-webpack-plugin": "^7.0.2",
|
||||
"cypress": "^14.5.3",
|
||||
"cypress": "^14.5.4",
|
||||
"file-loader": "^6.2.0",
|
||||
"happy-dom": "^18.0.1",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.1.2",
|
||||
"mini-css-extract-plugin": "^2.9.2",
|
||||
"lint-staged": "^16.1.6",
|
||||
"mini-css-extract-plugin": "^2.9.4",
|
||||
"mock-fs": "^5.5.0",
|
||||
"monaco-editor-webpack-plugin": "^7.1.0",
|
||||
"nock": "^14.0.7",
|
||||
"nock": "^14.0.10",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"sass": "^1.89.2",
|
||||
"sass": "^1.92.1",
|
||||
"sass-loader": "^16.0.5",
|
||||
"source-map-loader": "^5.0.0",
|
||||
"supertest": "^7.1.4",
|
||||
"terser-webpack-plugin": "^5.3.14",
|
||||
"ts-loader": "^9.5.2",
|
||||
"typescript": "^5.8.3",
|
||||
"ts-loader": "^9.5.4",
|
||||
"typescript": "^5.9.2",
|
||||
"vitest": "^3.0.7",
|
||||
"vitest-fetch-mock": "^0.4.5",
|
||||
"webpack": "^5.100.2",
|
||||
"webpack": "^5.101.3",
|
||||
"webpack-cli": "^6.0.1",
|
||||
"webpack-dev-middleware": "^7.4.2",
|
||||
"webpack-dev-middleware": "^7.4.3",
|
||||
"webpack-manifest-plugin": "^5.0.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
||||
@@ -75,7 +75,7 @@ export function parse(err: Error) {
|
||||
|
||||
const lineMatch = line.match(/at (?:(.+?)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);
|
||||
if (!lineMatch) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let object: string | undefined;
|
||||
@@ -127,7 +127,7 @@ export function parse(err: Error) {
|
||||
.map((line): StackFrame | undefined => {
|
||||
const lineMatch = line.match(/(.*)@(.*):(\d+):(\d+)/);
|
||||
if (!lineMatch) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let object: string | undefined;
|
||||
|
||||
@@ -93,7 +93,7 @@ export function applyColours(
|
||||
): void {
|
||||
const scheme = schemes.find(scheme => scheme.name === schemeName) ?? schemes[0];
|
||||
const newDecorations: monaco.editor.IModelDeltaDecoration[] = Object.entries(colours).map(([line, index]) => {
|
||||
const realLineNumber = Number.parseInt(line) + 1;
|
||||
const realLineNumber = Number.parseInt(line, 10) + 1;
|
||||
return {
|
||||
range: new monaco.Range(realLineNumber, 1, realLineNumber, 1),
|
||||
options: {
|
||||
|
||||
@@ -421,12 +421,16 @@ export class Hub {
|
||||
if (container.tab.header.tabs.length === 1 && container.tab.header.closeButton) {
|
||||
container.tab.header.closeButton.element.show();
|
||||
}
|
||||
container.tab.header.tabs.forEach(tab => tab.closeElement.show());
|
||||
container.tab.header.tabs.forEach(tab => {
|
||||
tab.closeElement.show();
|
||||
});
|
||||
} else {
|
||||
if (container.tab.header.tabs.length === 1 && container.tab.header.closeButton) {
|
||||
container.tab.header.closeButton.element.hide();
|
||||
}
|
||||
container.tab.header.tabs.forEach(tab => tab.closeElement.hide());
|
||||
container.tab.header.tabs.forEach(tab => {
|
||||
tab.closeElement.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ export class LineColouring {
|
||||
let colourIdx = 0;
|
||||
|
||||
for (const editorIdStr of _.keys(this.colouredSourceLinesByEditor)) {
|
||||
const editorId = Number.parseInt(editorIdStr);
|
||||
const editorId = Number.parseInt(editorIdStr, 10);
|
||||
|
||||
const lines = this.getUniqueLinesForEditor(editorId);
|
||||
for (const line of lines) {
|
||||
@@ -116,7 +116,7 @@ export class LineColouring {
|
||||
const editorIds = _.keys(this.linesAndColourByEditor);
|
||||
|
||||
for (const compilerIdStr of compilerIds) {
|
||||
const compilerId = Number.parseInt(compilerIdStr);
|
||||
const compilerId = Number.parseInt(compilerIdStr, 10);
|
||||
for (const editorId of _.keys(this.colouredSourceLinesByEditor)) {
|
||||
for (const info of this.colouredSourceLinesByEditor[editorId]) {
|
||||
if (info.compilerId === compilerId && info.colourIdx >= 0) {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
function definition(): monaco.languages.IMonarchLanguage {
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
import cppp from './cppp-mode.js';
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
import cppp from './cppp-mode.js';
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
import cppp from './cppp-mode.js';
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
// We need to create a new definition for cpp so we can remove invalid keywords
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
import cppp from './cppp-mode.js';
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
import cppp from './cppp-mode.js';
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
function definition(): monaco.languages.IMonarchLanguage {
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
function definition(): monaco.languages.IMonarchLanguage {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as swift from 'monaco-editor/esm/vs/basic-languages/swift/swift';
|
||||
|
||||
function definition(): monaco.languages.IMonarchLanguage {
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
function definition(): monaco.languages.IMonarchLanguage {
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
// We need to ensure we use proper keywords for the Monaco Editor matcher. Note how
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
import nc from './nc-mode.js';
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as rust from 'monaco-editor/esm/vs/basic-languages/rust/rust';
|
||||
|
||||
// We need to patch the existing rust definition to fix hexadecimal literal highlighting
|
||||
|
||||
@@ -26,7 +26,6 @@ import $ from 'jquery';
|
||||
|
||||
import * as monaco from 'monaco-editor';
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore "Could not find a declaration file"
|
||||
import * as cpp from 'monaco-editor/esm/vs/basic-languages/cpp/cpp';
|
||||
|
||||
function definition(): monaco.languages.IMonarchLanguage {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import JSZip from 'jszip';
|
||||
// @ts-ignore
|
||||
import path from 'path-browserify';
|
||||
import _ from 'underscore';
|
||||
import {FiledataPair} from '../types/compilation/compilation.interfaces.js';
|
||||
|
||||
@@ -649,7 +649,7 @@ export class Cfg extends Pane<CfgState> {
|
||||
const left = span_box.left - block_bounding_box.left;
|
||||
doc += `<text ${attrs({
|
||||
x: block.coordinates.x + left,
|
||||
y: block.coordinates.y + top + span_box.height / 2 + Number.parseInt(block_style.paddingTop),
|
||||
y: block.coordinates.y + top + span_box.height / 2 + Number.parseInt(block_style.paddingTop, 10),
|
||||
class: 'code',
|
||||
fill: span_style.color,
|
||||
})}>${escapeHTML(text)}</text>`;
|
||||
|
||||
@@ -489,38 +489,37 @@ export class Conformance extends Pane<ConformanceViewState> {
|
||||
|
||||
let libraries: Record<string, Library | false> = {};
|
||||
let first = true;
|
||||
compilers.map(compiler => {
|
||||
if (compiler) {
|
||||
const filteredLibraries = LibUtils.getSupportedLibraries(compiler.libsArr, langId, compiler.remote);
|
||||
for (const compiler of compilers) {
|
||||
if (!compiler) continue;
|
||||
const filteredLibraries = LibUtils.getSupportedLibraries(compiler.libsArr, langId, compiler.remote);
|
||||
|
||||
if (first) {
|
||||
libraries = _.extend({}, filteredLibraries);
|
||||
first = false;
|
||||
} else {
|
||||
const libsInCommon = _.intersection(_.keys(libraries), _.keys(filteredLibraries));
|
||||
if (first) {
|
||||
libraries = _.extend({}, filteredLibraries);
|
||||
first = false;
|
||||
} else {
|
||||
const libsInCommon = _.intersection(_.keys(libraries), _.keys(filteredLibraries));
|
||||
|
||||
for (const libKey in libraries) {
|
||||
const lib = libraries[libKey];
|
||||
if (lib && libsInCommon.includes(libKey)) {
|
||||
const versionsInCommon = _.intersection(
|
||||
Object.keys(lib.versions),
|
||||
Object.keys(filteredLibraries[libKey].versions),
|
||||
);
|
||||
for (const libKey in libraries) {
|
||||
const lib = libraries[libKey];
|
||||
if (lib && libsInCommon.includes(libKey)) {
|
||||
const versionsInCommon = _.intersection(
|
||||
Object.keys(lib.versions),
|
||||
Object.keys(filteredLibraries[libKey].versions),
|
||||
);
|
||||
|
||||
lib.versions = _.pick(lib.versions, (version, versionkey) => {
|
||||
return versionsInCommon.includes(versionkey);
|
||||
}) as Record<string, LibraryVersion>; // TODO(jeremy-rifkin)
|
||||
} else {
|
||||
libraries[libKey] = false;
|
||||
}
|
||||
lib.versions = _.pick(lib.versions, (version, versionkey) => {
|
||||
return versionsInCommon.includes(versionkey);
|
||||
}) as Record<string, LibraryVersion>; // TODO(jeremy-rifkin)
|
||||
} else {
|
||||
libraries[libKey] = false;
|
||||
}
|
||||
|
||||
libraries = _.omit(libraries, lib => {
|
||||
return !lib || _.isEmpty(lib.versions);
|
||||
}) as Record<string, Library>; // TODO(jeremy-rifkin)
|
||||
}
|
||||
|
||||
libraries = _.omit(libraries, lib => {
|
||||
return !lib || _.isEmpty(lib.versions);
|
||||
}) as Record<string, Library>; // TODO(jeremy-rifkin)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return libraries as CompilerLibs; // TODO(jeremy-rifkin)
|
||||
}
|
||||
|
||||
@@ -50,12 +50,12 @@ function decodeSelectizeValue(value: string): DiffTypeAndExtra {
|
||||
const opts = value.split(':');
|
||||
if (opts.length > 1) {
|
||||
return {
|
||||
difftype: Number.parseInt(opts[0]),
|
||||
difftype: Number.parseInt(opts[0], 10),
|
||||
extraoption: opts[1],
|
||||
};
|
||||
}
|
||||
return {
|
||||
difftype: Number.parseInt(value),
|
||||
difftype: Number.parseInt(value, 10),
|
||||
extraoption: '',
|
||||
};
|
||||
}
|
||||
@@ -432,7 +432,7 @@ export class Diff extends MonacoPane<monaco.editor.IStandaloneDiffEditor, DiffSt
|
||||
if (typeof id === 'string') {
|
||||
const p = id.indexOf('_exec');
|
||||
if (p !== -1) {
|
||||
const execId = Number.parseInt(id.substr(0, p));
|
||||
const execId = Number.parseInt(id.substr(0, p), 10);
|
||||
this.eventHub.emit('resendExecution', execId);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,6 @@ import {Buffer} from 'buffer';
|
||||
import $ from 'jquery';
|
||||
import * as monaco from 'monaco-editor';
|
||||
import {editor} from 'monaco-editor';
|
||||
// @ts-ignore
|
||||
import * as monacoVim from 'monaco-vim';
|
||||
import TomSelect from 'tom-select';
|
||||
import _ from 'underscore';
|
||||
@@ -720,7 +719,7 @@ export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Edit
|
||||
const states: any[] = [];
|
||||
|
||||
for (const compilerIdStr of Object.keys(this.ourCompilers)) {
|
||||
const compilerId = Number.parseInt(compilerIdStr);
|
||||
const compilerId = Number.parseInt(compilerIdStr, 10);
|
||||
|
||||
const glCompiler: Compiler | undefined = _.find(
|
||||
this.container.layoutManager.root.getComponentsByName('compiler'),
|
||||
@@ -1242,7 +1241,7 @@ export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Edit
|
||||
// enabled: this.settings.colouriseBrackets,
|
||||
// independentColorPoolPerBracketType: true,
|
||||
// },
|
||||
// @ts-ignore once the bug is fixed we can remove this suppression
|
||||
// @ts-expect-error once the bug is fixed we can remove this suppression
|
||||
'bracketPairColorization.enabled': this.settings.colouriseBrackets,
|
||||
useVim: this.settings.useVim,
|
||||
quickSuggestions: this.settings.showQuickSuggestions,
|
||||
@@ -1469,17 +1468,17 @@ export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Edit
|
||||
const editorModel = this.editor.getModel();
|
||||
const widgets = _.compact(
|
||||
output.map(obj => {
|
||||
if (!obj.tag) return;
|
||||
if (!obj.tag) return undefined;
|
||||
|
||||
const trees = this.hub.trees;
|
||||
if (trees && trees.length > 0) {
|
||||
if (obj.tag.file) {
|
||||
if (this.id !== trees[0].multifileService.getEditorIdByFilename(obj.tag.file)) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
if (this.id !== trees[0].multifileService.getMainSourceEditorId()) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ export class OptPipeline extends MonacoPane<monaco.editor.IStandaloneDiffEditor,
|
||||
const target = e.target;
|
||||
this.passesList.find('.active').removeClass('active');
|
||||
$(target).addClass('active');
|
||||
this.displayPass(Number.parseInt(unwrap(target.getAttribute('data-i'))));
|
||||
this.displayPass(Number.parseInt(unwrap(target.getAttribute('data-i')), 10));
|
||||
});
|
||||
// try to select a pass
|
||||
if (this.state.selectedIndex >= passes.length) {
|
||||
@@ -484,7 +484,7 @@ export class OptPipeline extends MonacoPane<monaco.editor.IStandaloneDiffEditor,
|
||||
scrollMode: 'if-needed',
|
||||
block: 'nearest',
|
||||
});
|
||||
this.displayPass(Number.parseInt(unwrap(prev.getAttribute('data-i'))));
|
||||
this.displayPass(Number.parseInt(unwrap(prev.getAttribute('data-i')), 10));
|
||||
}
|
||||
}
|
||||
if (e.key === 'ArrowDown') {
|
||||
@@ -498,7 +498,7 @@ export class OptPipeline extends MonacoPane<monaco.editor.IStandaloneDiffEditor,
|
||||
scrollMode: 'if-needed',
|
||||
block: 'nearest',
|
||||
});
|
||||
this.displayPass(Number.parseInt(unwrap(next.getAttribute('data-i'))));
|
||||
this.displayPass(Number.parseInt(unwrap(next.getAttribute('data-i')), 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,9 @@ export class Opt extends MonacoPane<monaco.editor.IStandaloneCodeEditor, OptStat
|
||||
|
||||
this.editor?.changeViewZones(accessor => {
|
||||
const maxWidth = width ?? this.editor.getLayoutInfo().contentWidth;
|
||||
this.optRemarkViewZoneIds.forEach(id => accessor.removeZone(id));
|
||||
this.optRemarkViewZoneIds.forEach(id => {
|
||||
accessor.removeZone(id);
|
||||
});
|
||||
this.optRemarkViewZoneIds = remarksToDisplay.map(({displayString, optType, DebugLoc}) => {
|
||||
const domNode = document.createElement('div');
|
||||
domNode.classList.add('view-line', 'opt-line', optType.toLowerCase());
|
||||
|
||||
@@ -271,7 +271,7 @@ export class Tree {
|
||||
|
||||
private sendChangesToAllEditors() {
|
||||
for (const compilerId in this.ourCompilers) {
|
||||
this.sendCompilerChangesToEditor(Number.parseInt(compilerId));
|
||||
this.sendCompilerChangesToEditor(Number.parseInt(compilerId, 10));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ export class Tree {
|
||||
this.lineColouring.clear();
|
||||
|
||||
for (const [compilerId, asm] of Object.entries(this.asmByCompiler)) {
|
||||
this.lineColouring.addFromAssembly(Number.parseInt(compilerId), asm);
|
||||
this.lineColouring.addFromAssembly(Number.parseInt(compilerId, 10), asm);
|
||||
}
|
||||
|
||||
this.lineColouring.calculate();
|
||||
@@ -663,7 +663,7 @@ export class Tree {
|
||||
|
||||
private updateColours() {
|
||||
for (const compilerId in this.ourCompilers) {
|
||||
const id: number = Number.parseInt(compilerId);
|
||||
const id: number = Number.parseInt(compilerId, 10);
|
||||
this.eventHub.emit(
|
||||
'coloursForCompiler',
|
||||
id,
|
||||
@@ -684,7 +684,7 @@ export class Tree {
|
||||
|
||||
private updateColoursNone() {
|
||||
for (const compilerId in this.ourCompilers) {
|
||||
this.eventHub.emit('coloursForCompiler', Number.parseInt(compilerId), {}, this.settings.colourScheme);
|
||||
this.eventHub.emit('coloursForCompiler', Number.parseInt(compilerId, 10), {}, this.settings.colourScheme);
|
||||
}
|
||||
|
||||
this.multifileService.forEachOpenFile((file: MultifileFile) => {
|
||||
|
||||
@@ -27,7 +27,7 @@ import {localStorage} from './local.js';
|
||||
const CURRENT_SLIDE_KEY = 'presentationCurrentSlide';
|
||||
|
||||
export class Presentation {
|
||||
public currentSlide = Number.parseInt(localStorage.get(CURRENT_SLIDE_KEY, '0'));
|
||||
public currentSlide = Number.parseInt(localStorage.get(CURRENT_SLIDE_KEY, '0'), 10);
|
||||
public originalLocation = window.location.href;
|
||||
|
||||
public constructor(public maxSlides: number) {}
|
||||
|
||||
@@ -131,7 +131,9 @@ class Encoders {
|
||||
if (b) {
|
||||
a[a.length] = ',';
|
||||
}
|
||||
k = Number.isNaN(Number.parseInt(i)) ? Encoders.string(i) : Encoders.number(Number.parseInt(i));
|
||||
k = Number.isNaN(Number.parseInt(i, 10))
|
||||
? Encoders.string(i)
|
||||
: Encoders.number(Number.parseInt(i, 10));
|
||||
a.push(k, ':', v);
|
||||
b = true;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ class Slider extends BaseSetting {
|
||||
}
|
||||
|
||||
override getUi(): number {
|
||||
return Number.parseInt(this.val()?.toString() ?? '0');
|
||||
return Number.parseInt(this.val()?.toString() ?? '0', 10);
|
||||
}
|
||||
|
||||
private updateDisplay() {
|
||||
@@ -189,7 +189,7 @@ class Numeric extends BaseSetting {
|
||||
}
|
||||
|
||||
override getUi(): number {
|
||||
return this.clampValue(Number.parseInt(this.val()?.toString() ?? '0'));
|
||||
return this.clampValue(Number.parseInt(this.val()?.toString() ?? '0', 10));
|
||||
}
|
||||
|
||||
override putUi(value: number) {
|
||||
@@ -377,7 +377,7 @@ export class Settings {
|
||||
).elem;
|
||||
defaultFontScaleSelector.on('change', e => {
|
||||
assert(e.target instanceof HTMLSelectElement);
|
||||
this.eventHub.emit('broadcastFontScale', Number.parseInt(e.target.value));
|
||||
this.eventHub.emit('broadcastFontScale', Number.parseInt(e.target.value, 10));
|
||||
});
|
||||
|
||||
const formats: FormatBase[] = ['Google', 'LLVM', 'Mozilla', 'Chromium', 'WebKit', 'Microsoft', 'GNU'];
|
||||
|
||||
@@ -111,9 +111,9 @@ export class Sharing {
|
||||
this.shareFull = $('#shareFull');
|
||||
this.shareEmbed = $('#shareEmbed');
|
||||
|
||||
[this.shareShort, this.shareFull, this.shareEmbed].forEach(el =>
|
||||
el.on('click', e => BootstrapUtils.showModal(this.shareLinkDialog, e.currentTarget)),
|
||||
);
|
||||
[this.shareShort, this.shareFull, this.shareEmbed].forEach(el => {
|
||||
el.on('click', e => BootstrapUtils.showModal(this.shareLinkDialog, e.currentTarget));
|
||||
});
|
||||
this.settings = Settings.getStoredSettings();
|
||||
|
||||
this.clippyButton = null;
|
||||
@@ -477,7 +477,9 @@ export class Sharing {
|
||||
if (component.componentState) {
|
||||
Object.keys(component.componentState)
|
||||
.filter(e => keysToRemove.includes(e))
|
||||
.forEach(key => delete component.componentState[key]);
|
||||
.forEach(key => {
|
||||
delete component.componentState[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,9 @@ describe('Config Module', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset and recreate test languages before each test
|
||||
Object.keys(mockLanguages).forEach(key => delete mockLanguages[key as LanguageKey]);
|
||||
Object.keys(mockLanguages).forEach(key => {
|
||||
delete mockLanguages[key as LanguageKey];
|
||||
});
|
||||
|
||||
mockLanguages['c++'] = createMockLanguage('c++', 'C++', ['cpp']);
|
||||
mockLanguages.c = createMockLanguage('c', 'C', ['c99', 'c11']);
|
||||
|
||||
@@ -135,7 +135,7 @@ describe('javap parsing', () => {
|
||||
return {
|
||||
text: match[2],
|
||||
source: {
|
||||
line: Number.parseInt(match[1]),
|
||||
line: Number.parseInt(match[1], 10),
|
||||
file: null,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user