chore: re-enable node/no-deprecated-api linting (#38899)

* chore: re-enable node/no-deprecated-api linting

* chore: re-enable no-global-assign linting
This commit is contained in:
Milan Burda 2023-06-26 19:51:59 +02:00 коммит произвёл GitHub
Родитель acba6d79fb
Коммит 81a454d148
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -10,7 +10,6 @@
"semi": ["error", "always"], "semi": ["error", "always"],
"no-var": "error", "no-var": "error",
"no-unused-vars": "off", "no-unused-vars": "off",
"no-global-assign": "off",
"guard-for-in": "error", "guard-for-in": "error",
"@typescript-eslint/no-unused-vars": ["error", { "@typescript-eslint/no-unused-vars": ["error", {
"vars": "all", "vars": "all",
@ -20,8 +19,7 @@
"prefer-const": ["error", { "prefer-const": ["error", {
"destructuring": "all" "destructuring": "all"
}], }],
"standard/no-callback-literal": "off", "standard/no-callback-literal": "off"
"node/no-deprecated-api": "off"
}, },
"parserOptions": { "parserOptions": {
"ecmaVersion": 6, "ecmaVersion": 6,

Просмотреть файл

@ -209,6 +209,7 @@ type ExtraURLLoaderOptions = {
allowNonHttpProtocols: boolean; allowNonHttpProtocols: boolean;
} }
function parseOptions (optionsIn: ClientRequestConstructorOptions | string): NodeJS.CreateURLLoaderOptions & ExtraURLLoaderOptions { function parseOptions (optionsIn: ClientRequestConstructorOptions | string): NodeJS.CreateURLLoaderOptions & ExtraURLLoaderOptions {
// eslint-disable-next-line node/no-deprecated-api
const options: any = typeof optionsIn === 'string' ? url.parse(optionsIn) : { ...optionsIn }; const options: any = typeof optionsIn === 'string' ? url.parse(optionsIn) : { ...optionsIn };
let urlStr: string = options.url; let urlStr: string = options.url;
@ -241,6 +242,7 @@ function parseOptions (optionsIn: ClientRequestConstructorOptions | string): Nod
// an invalid request. // an invalid request.
throw new TypeError('Request path contains unescaped characters'); throw new TypeError('Request path contains unescaped characters');
} }
// eslint-disable-next-line node/no-deprecated-api
const pathObj = url.parse(options.path || '/'); const pathObj = url.parse(options.path || '/');
urlObj.pathname = pathObj.pathname; urlObj.pathname = pathObj.pathname;
urlObj.search = pathObj.search; urlObj.search = pathObj.search;

Просмотреть файл

@ -1,6 +1,5 @@
import { dialog, Menu } from 'electron/main'; import { dialog, Menu } from 'electron/main';
import * as fs from 'fs'; import * as fs from 'fs';
import * as url from 'url';
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal'; import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils'; import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
@ -49,7 +48,7 @@ const getEditMenuItems = function (): Electron.MenuItemConstructorOptions[] {
}; };
const isChromeDevTools = function (pageURL: string) { const isChromeDevTools = function (pageURL: string) {
const { protocol } = url.parse(pageURL); const { protocol } = new URL(pageURL);
return protocol === 'devtools:'; return protocol === 'devtools:';
}; };