* Some lint clean-up

* whitespace rules

* todo for later
This commit is contained in:
Stephen Weatherford (MSFT) 2018-07-13 14:16:56 -07:00 коммит произвёл GitHub
Родитель aa1dd439cd
Коммит b9e8f4a45d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
23 изменённых файлов: 84 добавлений и 88 удалений

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

@ -36,7 +36,7 @@ function computeItems(folder: vscode.WorkspaceFolder, uris: vscode.Uri[]): vscod
async function resolveImageItem(folder: vscode.WorkspaceFolder, dockerFileUri?: vscode.Uri): Promise<Item> {
if (dockerFileUri) {
return createItem(folder, dockerFileUri);
};
}
const uris: vscode.Uri[] = await getDockerFileUris(folder);

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

@ -25,4 +25,4 @@ export default async function inspectImage(context?: ImageNode) {
*/
reporter && reporter.sendTelemetryEvent("command", { command: "vscode-docker.image.inspect" });
}
};
}

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

@ -46,5 +46,5 @@ export async function pushImage(context?: ImageNode) {
}
}
};
}
}

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

@ -36,6 +36,7 @@ export async function removeContainer(context?: ContainerNode) {
vscode.window.setStatusBarMessage("Docker: Removing Container(s)...", new Promise((resolve, reject) => {
containersToRemove.forEach((c) => {
// tslint:disable-next-line:no-function-expression // Grandfathered in
docker.getContainer(c.Id).remove({ force: true }, function (err: Error, data: any) {
containerCounter++;
if (err) {

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

@ -30,6 +30,7 @@ export async function removeImage(context?: ImageNode) {
vscode.window.setStatusBarMessage("Docker: Removing Image(s)...", new Promise((resolve, reject) => {
imagesToRemove.forEach((img) => {
// tslint:disable-next-line:no-function-expression // Grandfathered in
docker.getImage(img.Id).remove({ force: true }, function (err, data: any) {
imageCounter++;
if (err) {

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

@ -8,15 +8,13 @@ import vscode = require('vscode');
const teleCmdId: string = 'vscode-docker.container.restart';
export async function restartContainer(context?: ContainerNode) {
let containersToRestart: Docker.ContainerDesc[];
if (context && context.containerDesc) {
containersToRestart = [context.containerDesc];
}
else {
} else {
const opts = {
"filters": {
"status": ["running", "paused", "exited"]
@ -26,8 +24,7 @@ export async function restartContainer(context?: ContainerNode) {
if (selectedItem) {
if (selectedItem.label.toLocaleLowerCase().includes("all containers")) {
containersToRestart = await docker.getContainerDescriptors(opts);
}
else {
} else {
containersToRestart = [selectedItem.containerDesc];
}
}

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

@ -37,6 +37,7 @@ export async function stopContainer(context?: ContainerNode) {
vscode.window.setStatusBarMessage("Docker: Stopping Container(s)...", new Promise((resolve, reject) => {
containersToStop.forEach((c) => {
// tslint:disable-next-line:no-function-expression // Grandfathered in
docker.getContainer(c.Id).stop(function (err: Error, data: any) {
containerCounter++;
if (err) {

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

@ -56,6 +56,7 @@ export async function tagImage(context?: ImageNode) {
const image = docker.getImage(imageToTag.Id);
// tslint:disable-next-line:no-function-expression // Grandfathered in
image.tag({ repo: repo, tag: tag }, function (err: Error, data: any) {
if (err) {
vscode.window.showErrorMessage('Docker Tag error: ' + err.message);
@ -73,5 +74,5 @@ export async function tagImage(context?: ImageNode) {
});
}
}
};
}
}

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

@ -16,7 +16,7 @@ class DockerClient {
public getContainerDescriptors(opts?: {}): Thenable<Docker.ContainerDesc[]> {
return new Promise((resolve, reject) => {
if (!opts) {
let opts = {}
opts = {}
}
this.endPoint.listContainers(opts, (err, containers) => {
@ -31,7 +31,7 @@ class DockerClient {
public getImageDescriptors(opts?: {}): Thenable<Docker.ImageDesc[]> {
return new Promise((resolve, reject) => {
if (!opts) {
let opts = {}
opts = {}
}
this.endPoint.listImages(opts, (err, images) => {
if (err) {
@ -57,7 +57,7 @@ class DockerClient {
return resolve(info.OSType === "windows" ? DockerEngineType.Windows : DockerEngineType.Linux);
});
});
};
}
// On Linux or macOS, this can only ever be linux,
// so short-circuit the Docker call entirely.

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

@ -1,22 +1,21 @@
import * as Docker from 'dockerode';
import {docker} from './docker-endpoint';
import { docker } from './docker-endpoint';
import vscode = require('vscode');
import { ContainerDesc } from 'dockerode';
export interface ContainerItem extends vscode.QuickPickItem {
containerDesc: Docker.ContainerDesc
}
function createItem(container: Docker.ContainerDesc) : ContainerItem {
return <ContainerItem> {
function createItem(container: Docker.ContainerDesc): ContainerItem {
return <ContainerItem>{
label: container.Image,
containerDesc: container
};
}
function computeItems(containers: Docker.ContainerDesc[], includeAll: boolean) : ContainerItem[] {
const items : ContainerItem[] = [];
function computeItems(containers: Docker.ContainerDesc[], includeAll: boolean): ContainerItem[] {
const items: ContainerItem[] = [];
for (let i = 0; i < containers.length; i++) {
const item = createItem(containers[i]);
@ -24,15 +23,15 @@ function computeItems(containers: Docker.ContainerDesc[], includeAll: boolean) :
}
if (includeAll && containers.length > 0) {
items.unshift(<ContainerItem> {
label: 'All Containers'
items.unshift(<ContainerItem>{
label: 'All Containers'
});
}
return items;
}
export async function quickPickContainer(includeAll: boolean = false, opts?: {}) : Promise<ContainerItem>{
export async function quickPickContainer(includeAll: boolean = false, opts?: {}): Promise<ContainerItem> {
let containers: ContainerDesc[];
// "status": ["created", "restarting", "running", "paused", "exited", "dead"]
@ -42,7 +41,7 @@ export async function quickPickContainer(includeAll: boolean = false, opts?: {})
"status": ["running"]
}
};
};
}
try {
containers = await docker.getContainerDescriptors(opts);

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

@ -25,4 +25,3 @@ export class DockerDebugConfigProvider implements vscode.DebugConfigurationProvi
}
}

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

@ -8,6 +8,7 @@ import { promptForPort, quickPickPlatform, quickPickOS } from './config-utils';
import { reporter } from '../telemetry/telemetry';
import { match } from 'minimatch';
// tslint:disable-next-line:max-func-body-length
function genDockerFile(serviceName: string, platform: string, os: string, port: string, { cmd, author, version, artifactName }: PackageJson): string {
switch (platform.toLowerCase()) {
case 'node.js':
@ -272,6 +273,7 @@ services:
}
}
// tslint:disable-next-line:max-func-body-length
function genDockerComposeDebug(serviceName: string, platform: string, os: string, port: string, { fullCommand: cmd }: PackageJson): string {
switch (platform.toLowerCase()) {
case 'node.js':

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

@ -45,7 +45,7 @@ export class DockerComposeCompletionItemProvider implements CompletionItemProvid
var imageTextWithQuoteMatchYaml = textBefore.match(/^\s*image\s*\:\s*"([^"]*)$/);
if (imageTextWithQuoteMatchYaml) {
var imageText = imageTextWithQuoteMatchYaml[1];
let imageText = imageTextWithQuoteMatchYaml[1];
return yamlSuggestSupport.suggestImages(imageText);
}
@ -53,7 +53,7 @@ export class DockerComposeCompletionItemProvider implements CompletionItemProvid
var imageTextWithoutQuoteMatch = textBefore.match(/^\s*image\s*\:\s*([\w\:\/]*)/);
if (imageTextWithoutQuoteMatch) {
var imageText = imageTextWithoutQuoteMatch[1];
let imageText = imageTextWithoutQuoteMatch[1];
return yamlSuggestSupport.suggestImages(imageText);
}

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

@ -43,14 +43,14 @@ export class DockerComposeHoverProvider implements HoverProvider {
};
});
}).then((results) => {
var r = results.filter(r => !!r.result);
if (r.length === 0) {
var filteredResults = results.filter(r => !!r.result);
if (filteredResults.length === 0) {
return;
}
let range = new Range(position.line, r[0].startIndex, position.line, r[0].endIndex);
let range = new Range(position.line, filteredResults[0].startIndex, position.line, filteredResults[0].endIndex);
let hover = new Hover(r[0].result, range);
let hover = new Hover(filteredResults[0].result, range);
return hover;

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

@ -10,7 +10,7 @@ import composeVersionKeys from './dockerCompose/dockerComposeKeyInfo';
import { DockerComposeParser } from './dockerCompose/dockerComposeParser';
import vscode = require('vscode');
import { buildImage } from './commands/build-image';
import inspectImageCommand from './commands/inspect-image';
import inspectImage from './commands/inspect-image';
import { removeImage } from './commands/remove-image';
import { pushImage } from './commands/push-image';
import { startContainer, startContainerInteractive, startAzureCLI } from './commands/start-container';
@ -38,7 +38,6 @@ import * as opn from 'opn';
import { DockerDebugConfigProvider } from './configureWorkspace/configDebugProvider';
import { browseAzurePortal } from './explorer/utils/azureUtils';
export const FROM_DIRECTIVE_PATTERN = /^\s*FROM\s*([\w-\/:]*)(\s*AS\s*[a-z][a-z0-9-_\\.]*)?$/i;
export const COMPOSE_FILE_GLOB_PATTERN = '**/[dD]ocker-[cC]ompose*.{yaml,yml}';
export const DOCKERFILE_GLOB_PATTERN = '**/{*.dockerfile,[dD]ocker[fF]ile}';
@ -52,7 +51,7 @@ export interface ComposeVersionKeys {
All: KeyInfo,
v1: KeyInfo,
v2: KeyInfo
};
}
let client: LanguageClient;
@ -94,7 +93,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.configure', configure));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.build', buildImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.inspect', inspectImageCommand));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.inspect', inspectImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.remove', removeImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.push', pushImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.tag', tagImage));
@ -136,7 +135,6 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
ctx.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('docker', new DockerDebugConfigProvider()));
activateLanguageClient(ctx);
}

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

@ -10,7 +10,6 @@ import WebSiteManagementClient = require('azure-arm-website');
import * as vscode from 'vscode';
import * as WebSiteModels from '../../node_modules/azure-arm-website/lib/models';
export interface PartialList<T> extends Array<T> {
nextLink?: string;
}
@ -35,12 +34,15 @@ export function waitForWebSiteState(webSiteManagementClient: WebSiteManagementCl
count += intervalMs;
if (count < timeoutMs) {
// tslint:disable-next-line:no-string-based-set-timeout // false positive
setTimeout(func, intervalMs, count);
} else {
reject(new Error(`Timeout waiting for Web Site "${site.name}" state "${state}".`));
}
}
};
// tslint:disable-next-line:no-string-based-set-timeout // false positive
setTimeout(func, intervalMs, intervalMs);
});
}

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

@ -110,8 +110,6 @@ export class AzureRegistryNode extends NodeBase {
}
}
export class AzureRepositoryNode extends NodeBase {
constructor(
@ -156,8 +154,6 @@ export class AzureRepositoryNode extends NodeBase {
const { accessToken, refreshToken } = await acquireToken(session);
if (accessToken && refreshToken) {
const tenantId = element.subscription.tenantId;
await request.post('https://' + element.repository + '/oauth2/exchange', {
form: {
grant_type: 'access_token_refresh_token',
@ -286,6 +282,7 @@ async function acquireToken(session: AzureSession) {
return new Promise<{ accessToken: string; refreshToken: string; }>((resolve, reject) => {
const credentials: any = session.credentials;
const environment: any = session.environment;
// tslint:disable-next-line:no-function-expression // Grandfathered in
credentials.context.acquireToken(environment.activeDirectoryResourceId, credentials.username, credentials.clientId, function (err: any, result: any) {
if (err) {
reject(err);

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

@ -4,10 +4,8 @@ import * as moment from 'moment';
import * as dockerHub from '../utils/dockerHubUtils';
import { NodeBase } from './nodeBase';
export class DockerHubOrgNode extends NodeBase {
constructor(
public readonly label: string,
public readonly contextValue: string,
@ -86,7 +84,7 @@ export class DockerHubRepositoryNode extends NodeBase {
node.password = element.password;
node.userName = element.userName;
node.repository = element.repository;
node.created = moment(new Date(myTags[i].last_updated)).fromNow();;
node.created = moment(new Date(myTags[i].last_updated)).fromNow();
imageNodes.push(node);
}
@ -122,6 +120,3 @@ export class DockerHubImageNode extends NodeBase {
}
}
}

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

@ -189,5 +189,3 @@ export class RegistryRootNode extends NodeBase {
}
}
}

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

@ -9,7 +9,7 @@ let _token: Token;
export interface Token {
token: string
};
}
export interface User {
company: string
@ -24,12 +24,12 @@ export interface User {
profile_url: string
type: string
username: string
};
}
export interface Repository {
namespace: string
name: string
};
}
export interface RepositoryInfo {
user: string
@ -242,6 +242,8 @@ export function browseDockerHub(context?: DockerHubImageNode | DockerHubReposito
case 'dockerHubImageTag':
url = `${url}r/${context.repository.namespace}/${context.repository.name}/tags`;
break;
default:
break;
}
opn(url);
}

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

@ -19,10 +19,12 @@ export function trimWithElipsis(str: string, max: number = 10): string {
*/
export function getCoreNodeModule(moduleName: string) {
try {
// tslint:disable-next-line:non-literal-require
return require(`${vscode.env.appRoot}/node_modules.asar/${moduleName}`);
} catch (err) { }
try {
// tslint:disable-next-line:non-literal-require
return require(`${vscode.env.appRoot}/node_modules/${moduleName}`);
} catch (err) { }

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

@ -22,6 +22,7 @@ interface IPackageInfo {
}
function getPackageInfo(context: vscode.ExtensionContext): IPackageInfo {
// tslint:disable-next-line:non-literal-require
let extensionPackage = require(context.asAbsolutePath('./package.json'));
if (extensionPackage) {
return {

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

@ -17,23 +17,23 @@
],
"no-inner-html": true,
"no-octal-literal": true,
// TODO: "no-reserved-keywords": true,
"no-reserved-keywords": false, // changed
"no-string-based-set-immediate": true,
"no-string-based-set-interval": true,
// TODO: "no-string-based-set-timeout": true,
// TODO: "non-literal-require": true,
"no-string-based-set-timeout": true,
"non-literal-require": true,
"possible-timing-attack": true,
"react-anchor-blank-noopener": true,
"react-iframe-missing-sandbox": true,
"react-no-dangerous-html": true,
"await-promise": [
false, // TODO: true,
true,
"Thenable" // changed
],
"forin": true,
"jquery-deferred-must-complete": true,
"label-position": true,
// TODO: "match-default-export-name": true,
"match-default-export-name": true,
"mocha-avoid-only": true,
"mocha-no-side-effect-code": true,
// TODO: "no-any": true,
@ -41,7 +41,7 @@
"no-bitwise": true,
"no-conditional-assignment": true,
"no-console": [
false, // TODO: true,
false, // changed
"debug",
"info",
"log",
@ -54,8 +54,8 @@
"no-debugger": true,
"no-duplicate-case": true,
"no-duplicate-super": true,
// TODO: "no-duplicate-variable": true,
// TODO: "no-empty": true,
"no-duplicate-variable": true,
"no-empty": false, // changed
// TODO: "no-floating-promises": true,
"no-for-in-array": true,
"no-import-side-effect": true,
@ -70,7 +70,7 @@
"no-regex-spaces": true,
"no-sparse-arrays": true,
"no-stateless-class": true,
// TODO: "no-string-literal": true,
"no-string-literal": false, // TODO
"no-string-throw": true,
"no-unnecessary-bind": true,
"no-unnecessary-callback-wrapper": true,
@ -81,19 +81,19 @@
// TODO: "no-unused-expression": true,
// TODO: "no-use-before-declare": true,
"no-with-statement": true,
// TODO: "promise-function-async": true,
// TODO:"promise-function-async": true,
// TODO: "promise-must-complete": true,
"radix": true,
"react-this-binding-issue": true,
"react-unused-props-and-state": true,
// TODO: "restrict-plus-operands": true,
"restrict-plus-operands": false, // changed
"strict-boolean-expressions": [
false, // TODO: true,
false, // changed
"allow-string", // changed
"allow-undefined-union", // changed
"allow-mix" // changed
],
// TODO: "switch-default": true,
"switch-default": true,
"triple-equals": [
false, // TODO: true,
"allow-null-check"
@ -110,24 +110,24 @@
"callable-types": true,
"chai-prefer-contains-to-index-of": true,
"chai-vague-errors": true,
// TODO: "class-name": true,
"class-name": true,
"comment-format": true,
"completed-docs": [
false, // changed
"classes"
],
// TODO: "export-name": true,
// TODO: "function-name": true,
"export-name": false,
"function-name": false, // changed
"import-name": false, // changed
// TODO: "interface-name": true,
"interface-name": false, // changed
"jsdoc-format": true,
"max-classes-per-file": [
false, // TODO: true,
false, // changed
3
],
"max-file-line-count": true,
"max-func-body-length": [
false, // TODO: true,
true,
100,
{
"ignore-parameters-to-function-regex": "describe"
@ -139,7 +139,7 @@
],
// TODO: "member-access": true,
"member-ordering": [
false, // TODO: true,
false, // changed
{
"order": "fields-first"
}
@ -148,17 +148,17 @@
"mocha-unneeded-done": true,
"new-parens": true,
"no-construct": true,
// TODO: "no-default-export": true,
"no-default-export": false, // changed
"no-empty-interface": true,
"no-for-in": true,
// TODO: "no-function-expression": true,
"no-function-expression": true,
"no-inferrable-types": false,
"no-multiline-string": false, // changed
"no-null-keyword": false,
"no-parameter-properties": false, // changed
"no-relative-imports": false, // changed
"no-require-imports": false, // changed
// TODO: "no-shadowed-variable": true,
"no-shadowed-variable": true,
// TODO: "no-suspicious-comment": true,
"no-typeof-undefined": true,
"no-unnecessary-field-initialization": true,
@ -174,14 +174,14 @@
"ignore-arrow-function-shorthand" // changed
],
"object-literal-sort-keys": false,
// TODO: "one-variable-per-declaration": true,
"one-variable-per-declaration": false, // changed
"only-arrow-functions": false,
// TODO: "ordered-imports": true,
"prefer-array-literal": true,
"prefer-const": false, // changed
// TODO: "prefer-for-of": true,
"prefer-method-signature": true,
// TODO: "prefer-template": true,
"prefer-template": false, // changed
"return-undefined": false,
"typedef": [
false, // TODO: true,
@ -220,26 +220,26 @@
"arguments",
"statements"
],
// TODO: "curly": true,
// TODO: "eofline": true,
"curly": false, // TODO
"eofline": false, // changed
"import-spacing": true,
"indent": [
false, // TODO: true,
true,
"spaces"
],
"linebreak-style": false, //changed
"newline-before-return": false, // changed
// TODO: "no-consecutive-blank-lines": true,
"no-consecutive-blank-lines": true, // changed
"no-empty-line-after-opening-brace": false,
// TODO: "no-single-line-block-comment": true,
// TODO: "no-trailing-whitespace": true,
// TODO: "no-unnecessary-semicolons": true,
"no-single-line-block-comment": false, // changed
"no-trailing-whitespace": true,
"no-unnecessary-semicolons": true,
"object-literal-key-quotes": [
false, // TODO: true,
false, // changed
"as-needed"
],
"one-line": [
false, // TODO: true,
true,
"check-open-brace",
"check-catch",
"check-else",
@ -255,7 +255,7 @@
"always"
],
"trailing-comma": [
false, // TODO: true,
false, // changed
{
"singleline": "never",
"multiline": "never"
@ -263,7 +263,7 @@
],
"typedef-whitespace": false,
"whitespace": [
false, // TODO: true,
true,
"check-branch",
"check-decl",
"check-operator",
@ -295,7 +295,7 @@
}
],
"object-literal-shorthand": false,
// TODO: "prefer-type-cast": true,
"prefer-type-cast": false, // changed
"space-before-function-paren": false,
"missing-optional-annotation": false,
"no-duplicate-parameter-names": false,
@ -311,4 +311,4 @@
"test/**"
]
}
}
}