Skip to content

Commit

Permalink
auto-fixed prefer-const violation
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jun 8, 2022
1 parent aa23a0d commit 0656d21
Show file tree
Hide file tree
Showing 862 changed files with 6,490 additions and 6,490 deletions.
2 changes: 1 addition & 1 deletion build/azure-pipelines/common/computeNodeModulesCacheKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ shasum.update(fs.readFileSync(path.join(ROOT, '.yarnrc')));
shasum.update(fs.readFileSync(path.join(ROOT, 'remote/.yarnrc')));

// Add `package.json` and `yarn.lock` files
for (let dir of dirs) {
for (const dir of dirs) {
const packageJsonPath = path.join(ROOT, dir, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
const relevantPackageJsonSections = {
Expand Down
2 changes: 1 addition & 1 deletion build/darwin/create-universal-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function main() {
force: true
});

let productJson = await fs.readJson(productJsonPath);
const productJson = await fs.readJson(productJsonPath);
Object.assign(productJson, {
darwinUniversalAssetId: 'darwin-universal'
});
Expand Down
38 changes: 19 additions & 19 deletions build/gulpfile.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ const compilation = require('./lib/compilation');
const monacoapi = require('./lib/monaco-api');
const fs = require('fs');

let root = path.dirname(__dirname);
let sha1 = util.getVersion(root);
let semver = require('./monaco/package.json').version;
let headerVersion = semver + '(' + sha1 + ')';
const root = path.dirname(__dirname);
const sha1 = util.getVersion(root);
const semver = require('./monaco/package.json').version;
const headerVersion = semver + '(' + sha1 + ')';

// Build

let editorEntryPoints = [
const editorEntryPoints = [
{
name: 'vs/editor/editor.main',
include: [],
Expand All @@ -40,11 +40,11 @@ let editorEntryPoints = [
}
];

let editorResources = [
const editorResources = [
'out-editor-build/vs/base/browser/ui/codicons/**/*.ttf'
];

let BUNDLED_FILE_HEADER = [
const BUNDLED_FILE_HEADER = [
'/*!-----------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * Version: ' + headerVersion,
Expand Down Expand Up @@ -224,7 +224,7 @@ const appendJSToESMImportsTask = task.define('append-js-to-esm-imports', () => {
result.push(line);
continue;
}
let modifiedLine = (
const modifiedLine = (
line
.replace(/^import(.*)\'([^']+)\'/, `import$1'$2.js'`)
.replace(/^export \* from \'([^']+)\'/, `export * from '$1.js'`)
Expand All @@ -239,10 +239,10 @@ const appendJSToESMImportsTask = task.define('append-js-to-esm-imports', () => {
* @param {string} contents
*/
function toExternalDTS(contents) {
let lines = contents.split(/\r\n|\r|\n/);
const lines = contents.split(/\r\n|\r|\n/);
let killNextCloseCurlyBrace = false;
for (let i = 0; i < lines.length; i++) {
let line = lines[i];
const line = lines[i];

if (killNextCloseCurlyBrace) {
if ('}' === line) {
Expand Down Expand Up @@ -316,7 +316,7 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => {
// package.json
gulp.src('build/monaco/package.json')
.pipe(es.through(function (data) {
let json = JSON.parse(data.contents.toString());
const json = JSON.parse(data.contents.toString());
json.private = false;
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
this.emit('data', data);
Expand Down Expand Up @@ -360,10 +360,10 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => {
return;
}

let relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map'));
const relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map'));

let strContents = data.contents.toString();
let newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
const newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
strContents = strContents.replace(/\/\/# sourceMappingURL=[^ ]+$/, newStr);

data.contents = Buffer.from(strContents);
Expand Down Expand Up @@ -483,13 +483,13 @@ function createTscCompileTask(watch) {
cwd: path.join(__dirname, '..'),
// stdio: [null, 'pipe', 'inherit']
});
let errors = [];
let reporter = createReporter('monaco');
const errors = [];
const reporter = createReporter('monaco');

/** @type {NodeJS.ReadWriteStream | undefined} */
let report;
// eslint-disable-next-line no-control-regex
let magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
const magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings

child.stdout.on('data', data => {
let str = String(data);
Expand All @@ -502,12 +502,12 @@ function createTscCompileTask(watch) {
report.end();

} else if (str) {
let match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
const match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
if (match) {
// trying to massage the message so that it matches the gulp-tsb error messages
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
let fullpath = path.join(root, match[1]);
let message = match[3];
const fullpath = path.join(root, match[1]);
const message = match[3];
reporter(fullpath + message);
} else {
reporter(str);
Expand Down
2 changes: 1 addition & 1 deletion build/gulpfile.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const tasks = compilations.map(function (tsconfigFile) {
const baseUrl = getBaseUrl(out);

let headerId, headerOut;
let index = relativeDirname.indexOf('/');
const index = relativeDirname.indexOf('/');
if (index < 0) {
headerId = 'vscode.' + relativeDirname;
headerOut = 'out';
Expand Down
2 changes: 1 addition & 1 deletion build/gulpfile.hygiene.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function checkPackageJSON(actualPath) {
const actual = require(path.join(__dirname, '..', actualPath));
const rootPackageJSON = require('../package.json');
const checkIncluded = (set1, set2) => {
for (let depName in set1) {
for (const depName in set1) {
const depVersion = set1[depName];
const rootDepVersion = set2[depName];
if (!rootDepVersion) {
Expand Down
2 changes: 1 addition & 1 deletion build/gulpfile.reh.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
].map(resource => gulp.src(resource, { base: '.' }).pipe(rename(resource)));
}

let all = es.merge(
const all = es.merge(
packageJsonStream,
productJsonStream,
license,
Expand Down
14 changes: 7 additions & 7 deletions build/gulpfile.vscode.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ gulp.task(core);
* @return {Object} A map of paths to checksums.
*/
function computeChecksums(out, filenames) {
let result = {};
const result = {};
filenames.forEach(function (filename) {
let fullPath = path.join(process.cwd(), out, filename);
const fullPath = path.join(process.cwd(), out, filename);
result[filename] = computeChecksum(fullPath);
});
return result;
Expand All @@ -137,9 +137,9 @@ function computeChecksums(out, filenames) {
* @return {string} The checksum for `filename`.
*/
function computeChecksum(filename) {
let contents = fs.readFileSync(filename);
const contents = fs.readFileSync(filename);

let hash = crypto
const hash = crypto
.createHash('md5')
.update(contents)
.digest('base64')
Expand Down Expand Up @@ -453,20 +453,20 @@ gulp.task(task.define(

gulp.task('vscode-translations-pull', function () {
return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => {
let includeDefault = !!innoSetupConfig[language.id].defaultInfo;
const includeDefault = !!innoSetupConfig[language.id].defaultInfo;
return i18n.pullSetupXlfFiles(apiHostname, apiName, apiToken, language, includeDefault).pipe(vfs.dest(`../vscode-translations-import/${language.id}/setup`));
}));
});

gulp.task('vscode-translations-import', function () {
let options = minimist(process.argv.slice(2), {
const options = minimist(process.argv.slice(2), {
string: 'location',
default: {
location: '../vscode-translations-import'
}
});
return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => {
let id = language.id;
const id = language.id;
return gulp.src(`${options.location}/${id}/vscode-setup/messages.xlf`)
.pipe(i18n.prepareIslFiles(language, innoSetupConfig[language.id]))
.pipe(vfs.dest(`./build/win32/i18n`));
Expand Down
4 changes: 2 additions & 2 deletions build/gulpfile.vscode.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function packageTask(sourceFolderName, destinationFolderName) {
gulp.src('resources/server/code-512.png', { base: 'resources/server' })
);

let all = es.merge(
const all = es.merge(
packageJsonStream,
license,
sources,
Expand All @@ -218,7 +218,7 @@ function packageTask(sourceFolderName, destinationFolderName) {
pwaicons
);

let result = all
const result = all
.pipe(util.skipDirectories())
.pipe(util.fixWin32DirectoryPermissions());

Expand Down
4 changes: 2 additions & 2 deletions build/hygiene.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ function hygiene(some, linting = true) {
})
.then(
(result) => {
let original = result.src.replace(/\r\n/gm, '\n');
let formatted = result.dest.replace(/\r\n/gm, '\n');
const original = result.src.replace(/\r\n/gm, '\n');
const formatted = result.dest.replace(/\r\n/gm, '\n');

if (original !== formatted) {
console.error(
Expand Down
2 changes: 1 addition & 1 deletion build/lib/asar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena
}
}, function () {

let finish = () => {
const finish = () => {
{
const headerPickle = pickle.createEmpty();
headerPickle.writeString(JSON.stringify(filesystem.header));
Expand Down
2 changes: 1 addition & 1 deletion build/lib/builtInExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function getBuiltInExtensions(): Promise<void> {
const streams: Stream[] = [];

for (const extension of [...builtInExtensions, ...webBuiltInExtensions]) {
let controlState = control[extension.name] || 'marketplace';
const controlState = control[extension.name] || 'marketplace';
control[extension.name] = controlState;

streams.push(syncExtension(extension, controlState));
Expand Down
10 changes: 5 additions & 5 deletions build/lib/compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const reporter = createReporter();

function getTypeScriptCompilerOptions(src: string): ts.CompilerOptions {
const rootDir = path.join(__dirname, `../../${src}`);
let options: ts.CompilerOptions = {};
const options: ts.CompilerOptions = {};
options.verbose = false;
options.sourceMap = true;
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
Expand Down Expand Up @@ -96,7 +96,7 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod

const compile = createCompile(src, build, true);
const srcPipe = gulp.src(`${src}/**`, { base: `${src}` });
let generator = new MonacoGenerator(false);
const generator = new MonacoGenerator(false);
if (src === 'src') {
generator.execute();
}
Expand All @@ -116,7 +116,7 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
const src = gulp.src('src/**', { base: 'src' });
const watchSrc = watch('src/**', { base: 'src', readDelay: 200 });

let generator = new MonacoGenerator(true);
const generator = new MonacoGenerator(true);
generator.execute();

return watchSrc
Expand All @@ -140,7 +140,7 @@ class MonacoGenerator {
this._isWatch = isWatch;
this.stream = es.through();
this._watchedFiles = {};
let onWillReadFile = (moduleId: string, filePath: string) => {
const onWillReadFile = (moduleId: string, filePath: string) => {
if (!this._isWatch) {
return;
}
Expand Down Expand Up @@ -182,7 +182,7 @@ class MonacoGenerator {
}

private _run(): monacodts.IMonacoDeclarationResult | null {
let r = monacodts.run3(this._declarationResolver);
const r = monacodts.run3(this._declarationResolver);
if (!r && !this._isWatch) {
// The build must always be able to generate the monaco.d.ts
throw new Error(`monaco.d.ts generation error - Cannot continue`);
Expand Down
4 changes: 2 additions & 2 deletions build/lib/eslint/code-no-unexternalized-strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
key = keyNode.value;

} else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) {
for (let property of keyNode.properties) {
for (const property of keyNode.properties) {
if (property.type === AST_NODE_TYPES.Property && !property.computed) {
if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') {
if (isStringLiteral(property.value)) {
Expand Down Expand Up @@ -97,7 +97,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
// (2)
// report all invalid NLS keys
if (!key.match(NoUnexternalizedStrings._rNlsKeys)) {
for (let value of values) {
for (const value of values) {
context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } });
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/lib/eslint/vscode-dts-cancellation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature[key.name=/^(provide|resolve).+/]']: (node: any) => {

let found = false;
for (let param of (<TSESTree.TSMethodSignature>node).params) {
for (const param of (<TSESTree.TSMethodSignature>node).params) {
if (param.type === AST_NODE_TYPES.Identifier) {
found = found || param.name === 'token';
}
Expand Down
4 changes: 2 additions & 2 deletions build/lib/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export function scanBuiltinExtensions(extensionsRoot: string, exclude: string[]
if (!fs.existsSync(packageJSONPath)) {
continue;
}
let packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8'));
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8'));
if (!isWebExtension(packageJSON)) {
continue;
}
Expand Down Expand Up @@ -461,7 +461,7 @@ export function translatePackageJSON(packageJSON: string, packageNLSPath: string
const CharCode_PC = '%'.charCodeAt(0);
const packageNls: NLSFormat = JSON.parse(fs.readFileSync(packageNLSPath).toString());
const translate = (obj: any) => {
for (let key in obj) {
for (const key in obj) {
const val = obj[key];
if (Array.isArray(val)) {
val.forEach(translate);
Expand Down
2 changes: 1 addition & 1 deletion build/lib/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function getVersion(repo: string): string | undefined {

const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;
let refsMatch: RegExpExecArray | null;
let refs: { [ref: string]: string } = {};
const refs: { [ref: string]: string } = {};

while (refsMatch = refsRegex.exec(refsRaw)) {
refs[refsMatch[2]] = refsMatch[1];
Expand Down
Loading

0 comments on commit 0656d21

Please sign in to comment.