Skip to content

Commit 6c20eeb

Browse files
authored
chore: running eslint --fix on more files (#9502)
1 parent 06de969 commit 6c20eeb

22 files changed

Lines changed: 81 additions & 54 deletions

.changeset/hip-rocks-warn.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"app-builder-lib": patch
3+
"electron-updater": patch
4+
---
5+
6+
chore: running `eslint --fix` on more files

eslint.config.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ export default [{
2020
"**/out",
2121
// used for CLI
2222
"**/main.js",
23+
"test/vitest-setup.ts",
2324
"packages/app-builder-lib/helpers",
2425
"packages/electron-builder/cli.js",
25-
"packages/electron-builder/install-app-deps.js"
26+
"packages/electron-builder/install-app-deps.js",
27+
"packages/app-builder-lib/src/node-module-collector/hoist.ts", // @yarn/pkg vendor code
28+
"test/fixtures/**",
29+
"test/src/helpers/**",
2630
],
2731
}, ...compat.extends(
2832
"eslint:recommended",
@@ -52,6 +56,9 @@ export default [{
5256
"prettier/prettier": "warn",
5357
"@typescript-eslint/prefer-promise-reject-errors": "off",
5458

59+
"curly": ["error", "all"],
60+
"nonblock-statement-body-position": ["error", "below"],
61+
5562
"@stylistic/member-delimiter-style": ["error", {
5663
multiline: {
5764
delimiter: "none",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"scripts": {
66
"//": "do not wrap into single quotes - windows doesn't unwrap arg in this case",
77
"compile": "tsc --build",
8-
"lint": "eslint packages",
8+
"lint": "eslint packages test/src --ext .ts,.js",
99
"lint-deps": "node ./scripts/checkDeps.js",
1010
"pretest": "pnpm lint-deps && pnpm lint",
11-
"prettier": "prettier 'packages/**/*.{ts,js}' test/src/**/*.ts --write",
11+
"prettier": "prettier 'packages/**/*.{ts,js}' 'test/src/**/*.ts' --write",
1212
"///": "Please see https://github.com/electron-userland/electron-builder/blob/master/CONTRIBUTING.md#run-test-using-cli how to run particular test instead full (and very slow) run",
1313
"test-all": "pnpm compile && pnpm pretest && pnpm ci:test",
1414
"test-linux": "docker run --rm -e CI=\"${CI:-true}\" -e DEBUG=${DEBUG:-} -e UPDATE_SNAPSHOT=\"${UPDATE_SNAPSHOT:-false}\" -e TEST_FILES=\"${TEST_FILES:-HoistedNodeModuleTest}\" -w /project -v $(pwd):/project -v $(pwd)-node-modules:/project/node_modules -v $HOME/Library/Caches/electron:/root/.cache/electron -v $HOME/Library/Caches/electron-builder:/root/.cache/electron-builder ${ADDITIONAL_DOCKER_ARGS} ${TEST_RUNNER_IMAGE_TAG:-electronuserland/builder:22-wine-mono} /bin/bash -c \"bash ./docker/test-in-docker.sh\"",

packages/app-builder-lib/src/macPackager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,9 @@ export class MacPackager extends PlatformPackager<MacConfiguration> {
583583
Object.assign(appPlist, extendInfo)
584584
}
585585
for (const [k, v] of Object.entries(appPlist)) {
586-
if (v === null || v === undefined) delete appPlist[k]
586+
if (v === null || v === undefined) {
587+
delete appPlist[k]
588+
}
587589
}
588590
}
589591

packages/app-builder-lib/src/node-module-collector/hoist.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,10 @@ const decoupleGraphNode = (parent: HoisterWorkTree, node: HoisterWorkTree): Hois
336336
hoistedTo: new Map(hoistedTo),
337337
}
338338
const selfDep = clone.dependencies.get(name)
339-
if (selfDep && selfDep.ident == clone.ident)
340-
// Update self-reference
339+
if (selfDep && selfDep.ident == clone.ident) // Update self-reference
340+
{
341341
clone.dependencies.set(name, clone)
342+
}
342343

343344
parent.dependencies.set(clone.name, clone)
344345

@@ -536,10 +537,11 @@ const getNodeHoistInfo = (
536537
let reasonRoot
537538
let reason: string | null = null
538539
let dependsOn: Set<HoisterWorkTree> | null = new Set()
539-
if (outputReason)
540+
if (outputReason) {
540541
reasonRoot = `${Array.from(rootNodePathLocators)
541542
.map(x => prettyPrintLocator(x))
542543
.join(`→`)}`
544+
}
543545

544546
const parentNode = nodePath[nodePath.length - 1]
545547
// We cannot hoist self-references
@@ -585,11 +587,12 @@ const getNodeHoistInfo = (
585587
shadowedNodes.set(parentNode, shadowedNames)
586588
}
587589
shadowedNames.add(node.name)
588-
if (outputReason)
590+
if (outputReason) {
589591
reason = `- filled by ${prettyPrintLocator(parentDep.locator)} at ${nodePath
590592
.slice(0, idx)
591593
.map(x => prettyPrintLocator(x.locator))
592594
.join(`→`)}`
595+
}
593596
break
594597
}
595598
}

packages/app-builder-lib/src/util/packageDependencies.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { executeAppBuilderAsJson } from "./appBuilder"
44
export function createLazyProductionDeps<T extends boolean>(projectDir: string, excludedDependencies: Array<string> | null, flatten: T) {
55
return new Lazy(async () => {
66
const args = ["node-dep-tree", "--dir", projectDir]
7-
if (flatten) args.push("--flatten")
7+
if (flatten) {
8+
args.push("--flatten")
9+
}
810
if (excludedDependencies != null) {
911
for (const name of excludedDependencies) {
1012
args.push("--exclude-dep", name)

packages/electron-updater/src/providers/GitHubProvider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ export class GitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
8181
const hrefElement = hrefRegExp.exec(element.element("link").attribute("href"))!
8282

8383
// If this is null then something is wrong and skip this release
84-
if (hrefElement === null) continue
84+
if (hrefElement === null) {
85+
continue
86+
}
8587

8688
// This Release's Tag
8789
const hrefTag = hrefElement[1]

test/src/HoistTest.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ const getTreeHeight = (tree: HoisterResult): number => {
2929
const seen = new Set<HoisterResult>()
3030

3131
const visitNode = (node: HoisterResult) => {
32-
if (seen.has(node)) return
32+
if (seen.has(node)) {
33+
return
34+
}
3335
seen.add(node)
3436

3537
height += 1
3638
maxHeight = Math.max(height, maxHeight)
37-
for (const dep of node.dependencies) visitNode(dep)
39+
for (const dep of node.dependencies) {
40+
visitNode(dep)
41+
}
3842
height -= 1
3943
}
4044

test/src/PublishManagerTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ test.ifNotWindows("os macro", ({ expect }) =>
102102
publish: "always",
103103
projectDirCreated: async projectDir => {
104104
process.env.__TEST_S3_PUBLISHER__ = path.join(projectDir, "dist/s3")
105+
return Promise.resolve()
105106
},
106107
packed: async context => {
107108
const dir = path.join(context.projectDir, "dist/s3")

test/src/concurrentBuildsTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const config: Configuration = {
1515
artifactName: "${productName}-${version}-${arch}.${ext}",
1616
compression: "store",
1717
}
18-
const projectDirCreated = async (projectDir: string, tmpDir: TmpDir) => {
18+
const projectDirCreated = async (projectDir: string, _tmpDir: TmpDir) => {
1919
const buildConfig = (data: any, isApp: boolean) => {
2020
deepAssign(data, {
2121
name: "concurrent", // needs to be lowercase for fpm targets (can't use default fixture TestApp)

0 commit comments

Comments
 (0)