refactor: replace .forEach() with for-of (#39691)

* refactor: replace `.forEach()` with `for-of`

* refactor docs/fiddles/features/web-hid/renderer.js
This commit is contained in:
Milan Burda 2023-08-31 16:36:43 +02:00 committed by GitHub
parent 7858921a1f
commit 0b0707145b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 144 additions and 132 deletions

View file

@ -94,7 +94,9 @@ function useAppVeyorImage (targetBranch, options) {
assert(validJobs.includes(options.job), `Unknown AppVeyor CI job name: ${options.job}. Valid values are: ${validJobs}.`);
callAppVeyorBuildJobs(targetBranch, options.job, options);
} else {
validJobs.forEach((job) => callAppVeyorBuildJobs(targetBranch, job, options));
for (const job of validJobs) {
callAppVeyorBuildJobs(targetBranch, job, options);
}
}
}

View file

@ -193,7 +193,9 @@ function buildAppVeyor (targetBranch, options) {
assert(validJobs.includes(options.job), `Unknown AppVeyor CI job name: ${options.job}. Valid values are: ${validJobs}.`);
callAppVeyor(targetBranch, options.job, options);
} else {
validJobs.forEach((job) => callAppVeyor(targetBranch, job, options));
for (const job of validJobs) {
callAppVeyor(targetBranch, job, options);
}
}
}
@ -243,7 +245,9 @@ function buildCircleCI (targetBranch, options) {
} else {
assert(!options.arch, 'Cannot provide a single architecture while building all workflows, please specify a single workflow via --workflow');
options.runningPublishWorkflows = true;
circleCIPublishWorkflows.forEach((job) => circleCIcall(targetBranch, job, options));
for (const job of circleCIPublishWorkflows) {
circleCIcall(targetBranch, job, options);
}
}
}

View file

@ -461,7 +461,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
toBranch
};
pool.commits.forEach(commit => {
for (const commit of pool.commits) {
const str = commit.semanticType;
if (commit.isBreakingChange) {
notes.breaking.push(commit);
@ -478,7 +478,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
} else {
notes.unknown.push(commit);
}
});
}
return notes;
};

View file

@ -58,18 +58,18 @@ new Promise((resolve, reject) => {
.then((dirPath) => {
tempDir = dirPath;
// copy files from `/npm` to temp directory
files.forEach((name) => {
for (const name of files) {
const noThirdSegment = name === 'README.md' || name === 'LICENSE';
fs.writeFileSync(
path.join(tempDir, name),
fs.readFileSync(path.join(ELECTRON_DIR, noThirdSegment ? '' : 'npm', name))
);
});
}
// copy from root package.json to temp/package.json
const packageJson = require(path.join(tempDir, 'package.json'));
jsonFields.forEach((fieldName) => {
for (const fieldName of jsonFields) {
packageJson[fieldName] = rootPackageJson[fieldName];
});
}
packageJson.version = currentElectronVersion;
fs.writeFileSync(
path.join(tempDir, 'package.json'),

View file

@ -65,9 +65,9 @@ async function validateReleaseAssets (release, validatingRelease) {
const downloadUrls = release.assets.map(asset => ({ url: asset.browser_download_url, file: asset.name })).sort((a, b) => a.file.localeCompare(b.file));
failureCount = 0;
requiredAssets.forEach(asset => {
for (const asset of requiredAssets) {
check(extantAssets.includes(asset), asset);
});
}
check((failureCount === 0), 'All required GitHub assets exist for release', true);
if (!validatingRelease || !release.draft) {