Skip to content

Commit

Permalink
chore(deps): eslint and prettier upgrade to v9 (#8552)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta authored Oct 1, 2024
1 parent 2e84f01 commit 21dfd73
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 193 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

59 changes: 0 additions & 59 deletions .eslintrc.js

This file was deleted.

82 changes: 82 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import stylistic from "@stylistic/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: [
"**/*.d.ts",
"**/out",
// used for CLI
"**/main.js",
"packages/electron-builder/cli.js",
"packages/electron-builder/install-app-deps.js"
],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
"@stylistic": stylistic,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: ["./packages/*/tsconfig.json"],
},
},

rules: {
"@typescript-eslint/no-require-imports": "off",
semi: "off",
"prettier/prettier": "warn",
"@typescript-eslint/prefer-promise-reject-errors": "off",

"@stylistic/member-delimiter-style": ["error", {
multiline: {
delimiter: "none",
},
}],

"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-constant-condition": "off",

"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
}],

"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": ["off", {}],
"@typescript-eslint/no-redundant-type-constituents": "off",
},
}];
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"//": "do not wrap into single quotes - windows doesn't unwrap arg in this case",
"compile": "tsc --build",
"lint": "eslint packages --ext .ts",
"lint": "eslint packages",
"lint-staged": "lint-staged",
"lint-deps": "node ./test/out/helpers/checkDeps.js",
"pretest": "pnpm lint-deps && pnpm lint",
Expand Down Expand Up @@ -54,7 +54,7 @@
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"conventional-changelog-cli": "5.0.0",
"eslint": "^8.57.1",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"fs-extra": "10.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/ProtonFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ProtonFramework extends LibUiFramework {
const babelOptions: any = { ast: false, sourceMaps: "inline" }
if (process.env.TEST_SET_BABEL_PRESET === "true") {
babel = require("@babel/core")
// eslint-disable-next-line @typescript-eslint/no-use-before-define

babel = testOnlyBabel(babel, babelOptions, this.version)
} else {
try {
Expand Down
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/asar/asarUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { AsarFilesystem, Node } from "./asar"
import { hashFile, hashFileContents } from "./integrity"
import { detectUnpackedDirs } from "./unpackDetector"

// eslint-disable-next-line @typescript-eslint/no-var-requires
const pickle = require("chromium-pickle-js")

/** @internal */
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/codeSign/macCodeSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink
// use constant file
const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || tmpdir(), `${createHash("sha256").update(currentDir).update("app-builder").digest("hex")}.keychain`)
// noinspection JSUnusedLocalSymbols
// eslint-disable-next-line @typescript-eslint/no-unused-vars

await removeKeychain(keychainFile, false).catch(_ => {
/* ignore*/
})
Expand Down
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export class MacPackager extends PlatformPackager<MacConfiguration> {
break

case "dmg": {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { DmgTarget } = require("dmg-builder")
mapper(name, outDir => new DmgTarget(this, outDir))
break
Expand Down
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/publish/KeygenPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export class KeygenPublisher extends HttpPublisher {
_arch: Arch,
dataLength: number,
requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_file: string
): Promise<string> {
return HttpExecutor.retryOnServerError(async () => {
Expand Down
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ export class NsisTarget extends Target {
let i = 0
while (!(await exists(uninstallerPath)) && i++ < 100) {
// noinspection JSUnusedLocalSymbols
// eslint-disable-next-line @typescript-eslint/no-unused-vars
await new Promise((resolve, _reject) => setTimeout(resolve, 300))
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/util/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Configuration } from "../../configuration"
import { FileSet } from "../../options/PlatformSpecificBuildOptions"
import { reactCra } from "../../presets/rectCra"
import { PACKAGE_VERSION } from "../../version"
// eslint-disable-next-line @typescript-eslint/no-var-requires
const validateSchema = require("@develar/schema-utils")

// https://github.com/electron-userland/electron-builder/issues/1847
Expand Down
1 change: 0 additions & 1 deletion packages/app-builder-lib/src/vm/ParallelsVm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export class ParallelsVmManager extends VmManager {

if (!this.isExitHookAdded) {
this.isExitHookAdded = true
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("async-exit-hook")((callback: (() => void) | null) => {
const stopArgs = ["suspend", vmId]
if (callback == null) {
Expand Down
1 change: 0 additions & 1 deletion packages/builder-util/src/asyncTaskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class AsyncTaskManager {
return []
}

// eslint-disable-next-line @typescript-eslint/no-floating-promises
list = tasks.slice()
tasks.length = 0
}
Expand Down
1 change: 0 additions & 1 deletion packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
}
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
private createProviderRuntimeOptions() {
return {
isUseMultipleRangeRequest: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ function validateAndAdd(operation: Operation, operations: Array<Operation>, chec
operations.push(operation)
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
function buildChecksumMap(file: BlockMapFile, fileOffset: number, logger: Logger) {
const checksumToOffset = new Map<string, number>()
const checksumToSize = new Map<string, number>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export class PrivateGitHubProvider extends BaseGitHubProvider<PrivateGitHubUpdat
return this.configureHeaders("application/octet-stream")
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
private configureHeaders(accept: string) {
return {
accept,
Expand Down
Loading

0 comments on commit 21dfd73

Please sign in to comment.