Auto fix new import lint rules

This commit is contained in:
Eric Jizba 2023-11-07 10:16:51 -08:00 коммит произвёл Eric Jizba
Родитель f29749a93d
Коммит 5e39e6803f
28 изменённых файлов: 42 добавлений и 43 удалений

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

@ -4,11 +4,11 @@
import { FunctionCallback } from '@azure/functions-core';
import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc';
import { RegisteredFunction } from './AppContext';
import { worker } from './WorkerContext';
import { AzFuncSystemError } from './errors';
import { loadScriptFile } from './loadScriptFile';
import { PackageJson } from './parsers/parsePackageJson';
import { nonNullProp } from './utils/nonNull';
import { worker } from './WorkerContext';
export async function loadLegacyFunction(
functionId: string,

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

@ -2,14 +2,14 @@
// Licensed under the MIT License.
import * as parseArgs from 'minimist';
import { CreateGrpcEventStream } from './GrpcClient';
import { worker } from './WorkerContext';
import { AzFuncSystemError, ensureErrorType } from './errors';
import { CreateGrpcEventStream } from './GrpcClient';
import { setupCoreModule } from './setupCoreModule';
import { setupEventStream } from './setupEventStream';
import { systemError, systemLog } from './utils/Logger';
import { startBlockedMonitor } from './utils/blockedMonitor';
import { systemError, systemLog } from './utils/Logger';
import { isEnvironmentVariableSet } from './utils/util';
import { worker } from './WorkerContext';
export function startNodeWorker(args) {
const parsedArgs = parseArgs(args.slice(2));

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

@ -4,8 +4,8 @@
import { ProgrammingModel } from '@azure/functions-core';
import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc';
import { AppContext } from './AppContext';
import { IEventStream } from './GrpcClient';
import { AzFuncSystemError } from './errors';
import { IEventStream } from './GrpcClient';
class WorkerContext {
app = new AppContext();

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

@ -5,8 +5,8 @@ import { FunctionCallback, FunctionMetadata } from '@azure/functions-core';
import * as path from 'path';
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { Disposable } from '../Disposable';
import { worker } from '../WorkerContext';
import { AzFuncSystemError } from '../errors';
import { worker } from '../WorkerContext';
import { fromCoreFunctionMetadata } from './converters/fromCoreFunctionMetadata';
export function registerFunction(metadata: FunctionMetadata, callback: FunctionCallback): Disposable {

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

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { worker } from '../WorkerContext';
import { startApp } from '../startApp';
import { worker } from '../WorkerContext';
import { EventHandler } from './EventHandler';
import { getWorkerCapabilities } from './getWorkerCapabilities';
import { getWorkerMetadata } from './getWorkerMetadata';

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

@ -2,10 +2,10 @@
// Licensed under the MIT License.
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { loadLegacyFunction } from '../LegacyFunctionLoader';
import { worker } from '../WorkerContext';
import { ensureErrorType } from '../errors';
import { loadLegacyFunction } from '../LegacyFunctionLoader';
import { isDefined, nonNullProp } from '../utils/nonNull';
import { worker } from '../WorkerContext';
import { EventHandler } from './EventHandler';
import LogCategory = rpc.RpcLog.RpcLogCategory;
import LogLevel = rpc.RpcLog.Level;

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

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { worker } from '../WorkerContext';
import { isDefined } from '../utils/nonNull';
import { worker } from '../WorkerContext';
import { EventHandler } from './EventHandler';
import LogCategory = rpc.RpcLog.RpcLogCategory;
import LogLevel = rpc.RpcLog.Level;

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

@ -15,15 +15,15 @@ import {
} from '@azure/functions-core';
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { RegisteredFunction } from '../AppContext';
import { getLegacyFunction } from '../LegacyFunctionLoader';
import { worker } from '../WorkerContext';
import { fromCoreInvocationResponse } from '../coreApi/converters/fromCoreInvocationResponse';
import { fromCoreLogCategory, fromCoreLogLevel } from '../coreApi/converters/fromCoreStatusResult';
import { toCoreFunctionMetadata } from '../coreApi/converters/toCoreFunctionMetadata';
import { toCoreInvocationRequest } from '../coreApi/converters/toCoreInvocationRequest';
import { AzFuncSystemError, ReadOnlyError, isError } from '../errors';
import { AzFuncSystemError, isError, ReadOnlyError } from '../errors';
import { executeHooks } from '../hooks/executeHooks';
import { getLegacyFunction } from '../LegacyFunctionLoader';
import { nonNullProp } from '../utils/nonNull';
import { worker } from '../WorkerContext';
import { EventHandler } from './EventHandler';
/**

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

@ -4,10 +4,10 @@
import { access, constants } from 'fs';
import * as path from 'path';
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { worker } from '../WorkerContext';
import { isError } from '../errors';
import { startApp } from '../startApp';
import { nonNullProp } from '../utils/nonNull';
import { worker } from '../WorkerContext';
import { EventHandler } from './EventHandler';
import { getWorkerCapabilities } from './getWorkerCapabilities';
import { getWorkerMetadata } from './getWorkerMetadata';

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

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { worker } from '../WorkerContext';
import { version as workerVersion } from '../constants';
import { worker } from '../WorkerContext';
export function getWorkerMetadata(): rpc.IWorkerMetadata {
const result: rpc.IWorkerMetadata = {

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

@ -3,9 +3,9 @@
import { AppTerminateContext } from '@azure/functions-core';
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { worker } from '../WorkerContext';
import { ReadOnlyError } from '../errors';
import { executeHooks } from '../hooks/executeHooks';
import { worker } from '../WorkerContext';
import LogCategory = rpc.RpcLog.RpcLogCategory;
import LogLevel = rpc.RpcLog.Level;

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

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import { HookCallback } from '@azure/functions-core';
import { worker } from '../WorkerContext';
import { AzFuncRangeError } from '../errors';
import { worker } from '../WorkerContext';
export function getHooks(hookName: string): HookCallback[] {
switch (hookName) {

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

@ -5,9 +5,9 @@ import * as retry from 'p-retry';
import * as path from 'path';
import * as url from 'url';
import { AzureFunctionsRpcMessages as rpc } from '../azure-functions-language-worker-protobuf/src/rpc';
import { worker } from './WorkerContext';
import { AzFuncSystemError } from './errors';
import { PackageJson } from './parsers/parsePackageJson';
import { worker } from './WorkerContext';
import LogCategory = rpc.RpcLog.RpcLogCategory;
import LogLevel = rpc.RpcLog.Level;

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

@ -1,13 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import { Disposable } from './Disposable';
import { worker } from './WorkerContext';
import { version } from './constants';
import { coreApiLog } from './coreApi/coreApiLog';
import { registerFunction } from './coreApi/registerFunction';
import { setProgrammingModel } from './coreApi/setProgrammingModel';
import { Disposable } from './Disposable';
import { registerHook } from './hooks/registerHook';
import { worker } from './WorkerContext';
import Module = require('module');
/**

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

@ -1,8 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import { expect } from 'chai';
import 'mocha';
import { expect } from 'chai';
import { startNodeWorker } from '../src/Worker';
describe('Worker', () => {

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

@ -1,8 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import { expect } from 'chai';
import 'mocha';
import { expect } from 'chai';
import { AzureFunctionsRpcMessages as rpc } from './../azure-functions-language-worker-protobuf/src/rpc';
import { startBlockedMonitor } from './../src/utils/blockedMonitor';
import LogLevel = rpc.RpcLog.Level;

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

@ -1,8 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import { expect } from 'chai';
import 'mocha';
import { expect } from 'chai';
import { ensureErrorType } from '../src/errors';
describe('errors', () => {

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

@ -1,14 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import 'mocha';
import { expect } from 'chai';
import * as fs from 'fs/promises';
import 'mocha';
import { worker } from '../../src/WorkerContext';
import { TestEventStream } from './TestEventStream';
import { beforeEventHandlerSuite } from './beforeEventHandlerSuite';
import { msg } from './msg';
import { setTestAppMainField, testAppPath, testAppSrcPath, testPackageJsonPath } from './testAppUtils';
import { TestEventStream } from './TestEventStream';
describe('FunctionEnvironmentReloadHandler', () => {
let stream: TestEventStream;

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

@ -1,19 +1,19 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import 'mocha';
import { expect } from 'chai';
import * as fs from 'fs/promises';
import 'mocha';
import * as path from 'path';
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { getLegacyFunction } from '../../src/LegacyFunctionLoader';
import { worker } from '../../src/WorkerContext';
import { delay } from '../../src/utils/delay';
import { nonNullValue } from '../../src/utils/nonNull';
import { RegExpStreamingMessage, TestEventStream } from './TestEventStream';
import { worker } from '../../src/WorkerContext';
import { beforeEventHandlerSuite } from './beforeEventHandlerSuite';
import { msg } from './msg';
import { tempFile, testAppSrcPath } from './testAppUtils';
import { RegExpStreamingMessage, TestEventStream } from './TestEventStream';
describe('FunctionLoadHandler', () => {
let stream: TestEventStream;

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

@ -3,16 +3,16 @@
/* eslint-disable deprecation/deprecation */
import 'mocha';
import { AzureFunction, Context } from '@azure/functions';
import * as coreTypes from '@azure/functions-core';
import { expect } from 'chai';
import 'mocha';
import * as sinon from 'sinon';
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { worker } from '../../src/WorkerContext';
import { TestEventStream } from './TestEventStream';
import { beforeEventHandlerSuite } from './beforeEventHandlerSuite';
import { msg } from './msg';
import { TestEventStream } from './TestEventStream';
import LogCategory = rpc.RpcLog.RpcLogCategory;
import LogLevel = rpc.RpcLog.Level;

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

@ -1,17 +1,17 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import 'mocha';
import * as coreTypes from '@azure/functions-core';
import { expect } from 'chai';
import * as fs from 'fs/promises';
import 'mocha';
import { worker } from '../../src/WorkerContext';
import { logColdStartWarning } from '../../src/eventHandlers/WorkerInitHandler';
import { isNode20Plus } from '../../src/utils/util';
import { TestEventStream } from './TestEventStream';
import { worker } from '../../src/WorkerContext';
import { beforeEventHandlerSuite } from './beforeEventHandlerSuite';
import { msg } from './msg';
import { setTestAppMainField, testAppPath, testPackageJsonPath } from './testAppUtils';
import { TestEventStream } from './TestEventStream';
describe('WorkerInitHandler', () => {
let stream: TestEventStream;

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

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import 'mocha';
import { TestEventStream } from './TestEventStream';
import { beforeEventHandlerSuite } from './beforeEventHandlerSuite';
import { TestEventStream } from './TestEventStream';
describe('WorkerStatusHandler', () => {
let stream: TestEventStream;

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

@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import { worker } from '../../src/WorkerContext';
import { setupCoreModule } from '../../src/setupCoreModule';
import { setupEventStream } from '../../src/setupEventStream';
import { worker } from '../../src/WorkerContext';
import { TestEventStream } from './TestEventStream';
let testEventStream: TestEventStream | undefined;

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

@ -3,8 +3,8 @@
import 'mocha';
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
import { RegExpProps, RegExpStreamingMessage } from './TestEventStream';
import { testAppPath, testAppSrcPath } from './testAppUtils';
import { RegExpProps, RegExpStreamingMessage } from './TestEventStream';
import LogCategory = rpc.RpcLog.RpcLogCategory;
import LogLevel = rpc.RpcLog.Level;
import escapeStringRegexp = require('escape-string-regexp');

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

@ -4,9 +4,9 @@
import * as coreTypes from '@azure/functions-core';
import { expect } from 'chai';
import { worker } from '../../src/WorkerContext';
import { TestEventStream } from './TestEventStream';
import { beforeEventHandlerSuite } from './beforeEventHandlerSuite';
import { msg } from './msg';
import { TestEventStream } from './TestEventStream';
import sinon = require('sinon');
describe('terminateWorker', () => {

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

@ -1,10 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import * as chai from 'chai';
import 'mocha';
import { expect } from 'chai';
import { isESModule } from '../src/loadScriptFile';
const expect = chai.expect;
describe('loadScriptFile', () => {
it('respects .cjs extension', () => {

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

@ -1,12 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import 'mocha';
import * as chai from 'chai';
import { expect } from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import 'mocha';
import * as mockFs from 'mock-fs';
import { parsePackageJson } from '../../src/parsers/parsePackageJson';
chai.use(chaiAsPromised);
describe('parsePackageJson', () => {

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

@ -1,14 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import 'mocha';
import { IHookCallbackContext, ITestCallbackContext } from 'mocha';
import { worker } from '../src/WorkerContext';
import { isNode20Plus } from '../src/utils/util';
import { TestEventStream } from './eventHandlers/TestEventStream';
import { worker } from '../src/WorkerContext';
import { beforeEventHandlerSuite } from './eventHandlers/beforeEventHandlerSuite';
import { msg } from './eventHandlers/msg';
import { setTestAppMainField, testAppPath } from './eventHandlers/testAppUtils';
import { TestEventStream } from './eventHandlers/TestEventStream';
describe('startApp', () => {
let stream: TestEventStream;