Skip to content

refactor imports in src #1923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/attach.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import WebSocket = require('isomorphic-ws');
import querystring = require('node:querystring');
import stream = require('node:stream');
import WebSocket from 'isomorphic-ws';
import querystring from 'node:querystring';
import stream from 'node:stream';

import { KubeConfig } from './config';
import { isResizable, ResizableStream, TerminalSizeQueue } from './terminal-size-queue';
Expand Down
2 changes: 1 addition & 1 deletion src/attach_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import WebSocket = require('isomorphic-ws');
import WebSocket from 'isomorphic-ws';
import { ReadableStreamBuffer, WritableStreamBuffer } from 'stream-buffers';
import { anyFunction, anything, capture, instance, mock, verify, when } from 'ts-mockito';

Expand Down
4 changes: 2 additions & 2 deletions src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import https = require('node:https');
import https from 'node:https';

import { User } from './config_types';
import WebSocket = require('isomorphic-ws');
import WebSocket from 'isomorphic-ws';

export interface Authenticator {
isAuthProvider(user: User): boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/azure_auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as proc from 'node:child_process';
import https = require('node:https');
import * as jsonpath from 'jsonpath-plus';
import proc from 'node:child_process';
import https from 'node:https';
import jsonpath from 'jsonpath-plus';

import { Authenticator } from './auth';
import { User } from './config_types';
Expand Down
6 changes: 3 additions & 3 deletions src/cache_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, use } from 'chai';
import chaiAsPromised = require('chai-as-promised');
import chaiAsPromised from 'chai-as-promised';

import * as mock from 'ts-mockito';
import mock from 'ts-mockito';

import { V1ListMeta, V1Namespace, V1NamespaceList, V1ObjectMeta, V1Pod } from './api';
import { deleteItems, deleteObject, ListWatch } from './cache';
Expand All @@ -11,7 +11,7 @@ import { ListPromise } from './informer';

use(chaiAsPromised);

import nock = require('nock');
import nock from 'nock';
import { Watch } from './watch';

const server = 'http://foo.company.com';
Expand Down
18 changes: 9 additions & 9 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import fs = require('node:fs');
import https = require('node:https');
import yaml = require('js-yaml');
import net = require('node:net');
import path = require('node:path');
import fs from 'node:fs';
import https from 'node:https';
import yaml from 'js-yaml';
import net from 'node:net';
import path from 'node:path';

import { Headers, RequestInit } from 'node-fetch';
import * as api from './api';
import { RequestContext } from './api';
import { Authenticator } from './auth';
import { AzureAuth } from './azure_auth';
import {
Expand All @@ -31,8 +31,8 @@ import {
ServerConfiguration,
} from './gen';
import { OpenIDConnectAuth } from './oidc_auth';
import WebSocket = require('isomorphic-ws');
import child_process = require('node:child_process');
import WebSocket from 'isomorphic-ws';
import child_process from 'node:child_process';

const SERVICEACCOUNT_ROOT: string = '/var/run/secrets/kubernetes.io/serviceaccount';
const SERVICEACCOUNT_CA_PATH: string = SERVICEACCOUNT_ROOT + '/ca.crt';
Expand Down Expand Up @@ -212,7 +212,7 @@ export class KubeConfig implements SecurityAuthentication {
* Applies SecurityAuthentication to RequestContext of an API Call from API Client
* @param context
*/
public async applySecurityAuthentication(context: api.RequestContext): Promise<void> {
public async applySecurityAuthentication(context: RequestContext): Promise<void> {
const cluster = this.getCurrentCluster();
const user = this.getCurrentUser();

Expand Down
7 changes: 3 additions & 4 deletions src/config_test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { readFileSync } from 'node:fs';
import * as https from 'node:https';
import https from 'node:https';
import { Agent, RequestOptions } from 'node:https';
import { join } from 'node:path';
import path, { join } from 'node:path';

import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import mockfs = require('mock-fs');
import * as path from 'node:path';
import mockfs from 'mock-fs';

import { Headers } from 'node-fetch';
import { HttpMethod } from '.';
Expand Down
2 changes: 1 addition & 1 deletion src/config_types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fs from 'node:fs';
import fs from 'node:fs';

export enum ActionOnInvalid {
THROW = 'throw',
Expand Down
4 changes: 2 additions & 2 deletions src/cp.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'node:fs';
import fs from 'node:fs';
import { WritableStreamBuffer } from 'stream-buffers';
import * as tar from 'tar';
import * as tmp from 'tmp-promise';
import tmp from 'tmp-promise';

import { KubeConfig } from './config';
import { Exec } from './exec';
Expand Down
4 changes: 2 additions & 2 deletions src/cp_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { anything, anyFunction, instance, mock, verify, when } from 'ts-mockito';
import * as querystring from 'node:querystring';
import WebSocket = require('isomorphic-ws');
import querystring from 'node:querystring';
import WebSocket from 'isomorphic-ws';

import { CallAwaiter } from '../test';
import { KubeConfig } from './config';
Expand Down
6 changes: 3 additions & 3 deletions src/exec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import WebSocket = require('isomorphic-ws');
import querystring = require('node:querystring');
import stream = require('stream');
import WebSocket from 'isomorphic-ws';
import querystring from 'node:querystring';
import stream from 'stream';

import { V1Status } from './api';
import { KubeConfig } from './config';
Expand Down
4 changes: 2 additions & 2 deletions src/exec_auth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { OutgoingHttpHeaders } from 'node:http';
import https = require('node:https');
import https from 'node:https';

import { Authenticator } from './auth';
import { User } from './config_types';

import child_process = require('node:child_process');
import child_process from 'node:child_process';

export interface CredentialStatus {
readonly token: string;
Expand Down
2 changes: 1 addition & 1 deletion src/exec_auth_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ExecAuth } from './exec_auth';
import { User } from './config_types';
import { fail } from 'node:assert';

import child_process = require('node:child_process');
import child_process from 'node:child_process';

describe('ExecAuth', () => {
it('should claim correctly', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/file_auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs = require('node:fs');
import https = require('node:https');
import fs from 'node:fs';
import https from 'node:https';

import { Authenticator } from './auth';
import { User } from './config_types';
Expand Down
6 changes: 3 additions & 3 deletions src/gcp_auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as proc from 'node:child_process';
import https = require('node:https');
import * as jsonpath from 'jsonpath-plus';
import proc from 'node:child_process';
import https from 'node:https';
import jsonpath from 'jsonpath-plus';

import { Authenticator } from './auth';
import { User } from './config_types';
Expand Down
4 changes: 2 additions & 2 deletions src/integration_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, use } from 'chai';
import chaiAsPromised = require('chai-as-promised');
import nock = require('nock');
import chaiAsPromised from 'chai-as-promised';
import nock from 'nock';

import { CoreV1Api } from './api';
import { KubeConfig } from './config';
Expand Down
2 changes: 1 addition & 1 deletion src/metrics_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fail } from 'node:assert';
import { expect } from 'chai';
import nock = require('nock');
import nock from 'nock';
import { KubeConfig } from './config';
import { V1Status, ApiException } from './gen';
import { Metrics, NodeMetricsList, PodMetricsList } from './metrics';
Expand Down
2 changes: 1 addition & 1 deletion src/object_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fail } from 'node:assert';
import { expect } from 'chai';
import nock = require('nock');
import nock from 'nock';
import { Configuration, V1APIResource, V1APIResourceList, V1Secret } from './api';
import { KubeConfig } from './config';
import { KubernetesObjectApi } from './object';
Expand Down
6 changes: 3 additions & 3 deletions src/portforward.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import WebSocket = require('isomorphic-ws');
import querystring = require('node:querystring');
import stream = require('node:stream');
import WebSocket from 'isomorphic-ws';
import querystring from 'node:querystring';
import stream from 'node:stream';

import { KubeConfig } from './config';
import { WebSocketHandler, WebSocketInterface } from './web-socket-handler';
Expand Down
2 changes: 1 addition & 1 deletion src/proto-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import http = require('node:http');
import http from 'node:http';

import { KubeConfig } from './config';

Expand Down
2 changes: 1 addition & 1 deletion src/top_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import nock = require('nock');
import nock from 'nock';
import { KubeConfig } from './config';
import { Metrics, PodMetricsList } from './metrics';
import { topPods } from './top';
Expand Down
2 changes: 1 addition & 1 deletion src/watch_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import nock = require('nock');
import nock from 'nock';
import { PassThrough } from 'node:stream';
import { KubeConfig } from './config';
import { Cluster, Context, User } from './config_types';
Expand Down
4 changes: 2 additions & 2 deletions src/web-socket-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import WebSocket = require('isomorphic-ws');
import stream = require('node:stream');
import WebSocket from 'isomorphic-ws';
import stream from 'node:stream';

import { V1Status } from './api';
import { KubeConfig } from './config';
Expand Down
2 changes: 1 addition & 1 deletion src/web-socket-handler_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Readable } from 'node:stream';
import { setImmediate as setImmediatePromise } from 'node:timers/promises';
import { expect } from 'chai';
import WebSocket = require('isomorphic-ws');
import WebSocket from 'isomorphic-ws';
import { WritableStreamBuffer } from 'stream-buffers';

import { V1Status } from './api';
Expand Down
2 changes: 1 addition & 1 deletion src/yaml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as yaml from 'js-yaml';
import yaml from 'js-yaml';

export function loadYaml<T>(data: string, opts?: yaml.LoadOptions): T {
return yaml.load(data, opts) as any as T;
Expand Down
Loading