diff --git a/.eslintrc.json b/.eslintrc.json index b74472d692..256cfdf5fe 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,6 +16,9 @@ "airbnb-base", "plugin:import/typescript" ], + "globals": { + "NodeJS": "readonly" + }, "rules": { "class-methods-use-this": "off", "import/extensions": [ @@ -46,6 +49,8 @@ "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize." } ], + "no-shadow": "off", + "@typescript-eslint/no-shadow": ["error"], "no-unused-vars": "off", "@typescript-eslint/no-this-alias": ["error", { "allowDestructuring": true @@ -55,7 +60,9 @@ "argsIgnorePattern": "^_", "ignoreRestSiblings": true, "vars": "all" - }] + }], + "no-use-before-define": "off", + "@typescript-eslint/no-use-before-define": ["error"] }, "overrides": [ { diff --git a/package.json b/package.json index f64b776e04..f59ffdf39e 100644 --- a/package.json +++ b/package.json @@ -117,8 +117,8 @@ "@types/webpack-dev-middleware": "^3.7.0", "@types/webpack-hot-middleware": "^2.25.0", "@types/webpack-merge": "^4.1.5", - "@typescript-eslint/eslint-plugin": "^3.0.0", - "@typescript-eslint/parser": "^3.0.0", + "@typescript-eslint/eslint-plugin": "^4.0.1", + "@typescript-eslint/parser": "^4.0.1", "babel-plugin-source-map-support": "^2.1.2", "chai": "4.2.0", "chai-as-promised": "^7.0.0", diff --git a/packages/api/cli/src/electron-forge-start.ts b/packages/api/cli/src/electron-forge-start.ts index 951eb00ee7..ff036daa99 100644 --- a/packages/api/cli/src/electron-forge-start.ts +++ b/packages/api/cli/src/electron-forge-start.ts @@ -1,9 +1,8 @@ import { api, StartOptions } from '@electron-forge/core'; import { ElectronProcess } from '@electron-forge/shared-types'; - import fs from 'fs-extra'; -import program from 'commander'; import path from 'path'; +import program from 'commander'; import './util/terminate'; import workingDir from './util/working-dir'; diff --git a/packages/api/core/src/api/install.ts b/packages/api/core/src/api/install.ts index d2a3e57890..20d2cc5d5d 100644 --- a/packages/api/core/src/api/install.ts +++ b/packages/api/core/src/api/install.ts @@ -25,13 +25,6 @@ const GITHUB_API = 'https://api.github.com'; class InstallerImpl extends InstallerBase { name = 'impl'; } -interface Release { - // eslint-disable-next-line camelcase - tag_name: string; - prerelease: boolean; - assets: Asset[]; -} - export interface Asset { id: string; name: string; @@ -40,6 +33,13 @@ export interface Asset { browser_download_url: string; } +interface Release { + // eslint-disable-next-line camelcase + tag_name: string; + prerelease: boolean; + assets: Asset[]; +} + export interface InstallOptions { /** * Whether to use sensible defaults or prompt the user visually diff --git a/packages/api/core/src/api/start.ts b/packages/api/core/src/api/start.ts index 31357787f3..4c37519ba7 100644 --- a/packages/api/core/src/api/start.ts +++ b/packages/api/core/src/api/start.ts @@ -3,8 +3,8 @@ import { asyncOra } from '@electron-forge/async-ora'; import { ElectronProcess, ForgeArch, ForgePlatform, StartOptions, } from '@electron-forge/shared-types'; -import { spawn, SpawnOptions } from 'child_process'; import path from 'path'; +import { spawn, SpawnOptions } from 'child_process'; import { readMutatedPackageJson } from '../util/read-package-json'; import rebuild from '../util/rebuild'; diff --git a/packages/plugin/webpack/package.json b/packages/plugin/webpack/package.json index 02f3e67440..fd6959e969 100644 --- a/packages/plugin/webpack/package.json +++ b/packages/plugin/webpack/package.json @@ -11,6 +11,7 @@ "test": "mocha --require ts-node/register test/**/*_spec.ts test/**/**/*_spec.ts --opts ../../../mocha.opts" }, "devDependencies": { + "@types/node": "^14.6.1", "chai": "4.2.0", "mocha": "^8.1.3" }, diff --git a/packages/plugin/webpack/src/WebpackPlugin.ts b/packages/plugin/webpack/src/WebpackPlugin.ts index f4744f0b36..03263c2cfb 100644 --- a/packages/plugin/webpack/src/WebpackPlugin.ts +++ b/packages/plugin/webpack/src/WebpackPlugin.ts @@ -1,16 +1,16 @@ /* eslint "no-console": "off" */ import { asyncOra } from '@electron-forge/async-ora'; -import PluginBase from '@electron-forge/plugin-base'; -import { ElectronProcess, ForgeConfig } from '@electron-forge/shared-types'; -import Logger, { Tab } from '@electron-forge/web-multi-logger'; import debug from 'debug'; +import { ElectronProcess, ForgeConfig } from '@electron-forge/shared-types'; +import express from 'express'; import fs from 'fs-extra'; +import http from 'http'; +import Logger, { Tab } from '@electron-forge/web-multi-logger'; import path from 'path'; +import PluginBase from '@electron-forge/plugin-base'; import webpack, { Configuration } from 'webpack'; -import webpackHotMiddleware from 'webpack-hot-middleware'; import webpackDevMiddleware from 'webpack-dev-middleware'; -import express from 'express'; -import http from 'http'; +import webpackHotMiddleware from 'webpack-hot-middleware'; import once from './util/once'; import { WebpackPluginConfig } from './Config'; diff --git a/packages/utils/async-ora/src/ora-handler.ts b/packages/utils/async-ora/src/ora-handler.ts index 8f1e0ed96e..235733bfe7 100644 --- a/packages/utils/async-ora/src/ora-handler.ts +++ b/packages/utils/async-ora/src/ora-handler.ts @@ -20,7 +20,7 @@ export class OraImpl { export interface AsyncOraMethod { ( initialOraValue: string, - asyncFn: (ora: OraImpl) => Promise, + asyncFn: (oraImpl: OraImpl) => Promise, processExitFn?: (code: number) => void, ): Promise; interactive?: boolean; diff --git a/yarn.lock b/yarn.lock index 63e7aab762..676f76595d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1236,11 +1236,6 @@ resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== -"@types/eslint-visitor-keys@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" - integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== - "@types/express-serve-static-core@*": version "4.17.9" resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.9.tgz#2d7b34dcfd25ec663c25c85d76608f8b249667f1" @@ -1514,54 +1509,63 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@^3.0.0": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz#7e061338a1383f59edc204c605899f93dc2e2c8f" - integrity sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ== +"@typescript-eslint/eslint-plugin@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.0.1.tgz#88bde9239e29d688315718552cf80a3490491017" + integrity sha512-pQZtXupCn11O4AwpYVUX4PDFfmIJl90ZgrEBg0CEcqlwvPiG0uY81fimr1oMFblZnpKAq6prrT9a59pj1x58rw== dependencies: - "@typescript-eslint/experimental-utils" "3.10.1" + "@typescript-eslint/experimental-utils" "4.0.1" + "@typescript-eslint/scope-manager" "4.0.1" debug "^4.1.1" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz#e179ffc81a80ebcae2ea04e0332f8b251345a686" - integrity sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw== +"@typescript-eslint/experimental-utils@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.0.1.tgz#7d9a3ab6821ad5274dad2186c1aa0d93afd696eb" + integrity sha512-gAqOjLiHoED79iYTt3F4uSHrYmg/GPz/zGezdB0jAdr6S6gwNiR/j7cTZ8nREKVzMVKLd9G3xbg1sV9GClW3sw== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/typescript-estree" "3.10.1" + "@typescript-eslint/scope-manager" "4.0.1" + "@typescript-eslint/types" "4.0.1" + "@typescript-eslint/typescript-estree" "4.0.1" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^3.0.0": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.10.1.tgz#1883858e83e8b442627e1ac6f408925211155467" - integrity sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw== +"@typescript-eslint/parser@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.0.1.tgz#73772080db7a7a4534a35d719e006f503e664dc3" + integrity sha512-1+qLmXHNAWSQ7RB6fdSQszAiA7JTwzakj5cNYjBTUmpH2cqilxMZEIV+DRKjVZs8NzP3ALmKexB0w/ExjcK9Iw== dependencies: - "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "3.10.1" - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/typescript-estree" "3.10.1" - eslint-visitor-keys "^1.1.0" + "@typescript-eslint/scope-manager" "4.0.1" + "@typescript-eslint/types" "4.0.1" + "@typescript-eslint/typescript-estree" "4.0.1" + debug "^4.1.1" -"@typescript-eslint/types@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727" - integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ== +"@typescript-eslint/scope-manager@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.0.1.tgz#24d93c3000bdfcc5a157dc4d32b742405a8631b5" + integrity sha512-u3YEXVJ8jsj7QCJk3om0Y457fy2euEOkkzxIB/LKU3MdyI+FJ2gI0M4aKEaXzwCSfNDiZ13a3lDo5DVozc+XLQ== + dependencies: + "@typescript-eslint/types" "4.0.1" + "@typescript-eslint/visitor-keys" "4.0.1" -"@typescript-eslint/typescript-estree@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853" - integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w== +"@typescript-eslint/types@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.0.1.tgz#1cf72582f764931f085cb8230ff215980fe467b2" + integrity sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg== + +"@typescript-eslint/typescript-estree@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz#29a43c7060641ec51c902d9f50ac7c5866ec479f" + integrity sha512-zGzleORFXrRWRJAMLTB2iJD1IZbCPkg4hsI8mGdpYlKaqzvKYSEWVAYh14eauaR+qIoZVWrXgYSXqLtTlxotiw== dependencies: - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/visitor-keys" "3.10.1" + "@typescript-eslint/types" "4.0.1" + "@typescript-eslint/visitor-keys" "4.0.1" debug "^4.1.1" - glob "^7.1.6" + globby "^11.0.1" is-glob "^4.0.1" lodash "^4.17.15" semver "^7.3.2" @@ -1575,12 +1579,13 @@ lodash.unescape "4.0.1" semver "5.5.0" -"@typescript-eslint/visitor-keys@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931" - integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ== +"@typescript-eslint/visitor-keys@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.1.tgz#d4e8de62775f2a6db71c7e8539633680039fdd6c" + integrity sha512-yBSqd6FjnTzbg5RUy9J+9kJEyQjTI34JdGMJz+9ttlJzLCnGkBikxw+N5n2VDcc3CesbIEJ0MnZc5uRYnrEnCw== dependencies: - eslint-visitor-keys "^1.1.0" + "@typescript-eslint/types" "4.0.1" + eslint-visitor-keys "^2.0.0" "@webassemblyjs/ast@1.9.0": version "1.9.0" @@ -4141,6 +4146,11 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== +eslint-visitor-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" + integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + eslint@^6.5.1: version "6.8.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb"