More layering and compile strictness (#8973)

* add more folders to strictire compile, add more strict compile options

* update ci

* wip

* add more layering and fix issues

* add more strictness

* remove unnecessary assertion

* add missing checks

* fix indentation

* remove jsdoc
This commit is contained in:
Anthony Dresser
2020-01-29 20:35:11 -08:00
committed by GitHub
parent ddfdd43fc3
commit 56695be14a
185 changed files with 725 additions and 635 deletions

View File

@@ -2,12 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Type } from '@angular/core';
import * as platform from 'vs/platform/registry/common/platform';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
import { IInsightData } from 'sql/workbench/contrib/charts/browser/interfaces';
import { values } from 'vs/base/common/collections';
export type InsightIdentifier = string;
@@ -62,6 +60,11 @@ export interface ISize {
y: number;
}
export interface IInsightData {
columns: Array<string>;
rows: Array<Array<string>>;
}
export interface IInsightsView {
data: IInsightData;
setConfig?: (config: { [key: string]: any }) => void;
@@ -70,18 +73,22 @@ export interface IInsightsView {
export interface IInsightRegistry {
insightSchema: IJSONSchema;
registerInsight(id: string, description: string, schema: IJSONSchema, ctor: Type<IInsightsView>): InsightIdentifier;
registerInsight(id: string, description: string, schema: IJSONSchema, ctor: IInsightsViewCtor): InsightIdentifier;
registerExtensionInsight(id: string, val: IInsightsConfig): void;
getRegisteredExtensionInsights(id: string): IInsightsConfig;
getCtorFromId(id: string): Type<IInsightsView>;
getAllCtors(): Array<Type<IInsightsView>>;
getCtorFromId(id: string): IInsightsViewCtor;
getAllCtors(): Array<IInsightsViewCtor>;
getAllIds(): Array<string>;
}
interface IInsightsViewCtor {
new(...args: any[]): IInsightsView;
}
class InsightRegistry implements IInsightRegistry {
private _insightSchema: IJSONSchema = { type: 'object', description: nls.localize('schema.dashboardWidgets.InsightsRegistry', "Widget used in the dashboards"), properties: {}, additionalProperties: false };
private _extensionInsights: { [x: string]: IInsightsConfig } = {};
private _idToCtor: { [x: string]: Type<IInsightsView> } = {};
private _idToCtor: { [x: string]: IInsightsViewCtor } = {};
/**
* Register a dashboard widget
@@ -89,7 +96,7 @@ class InsightRegistry implements IInsightRegistry {
* @param description description of the widget
* @param schema config schema of the widget
*/
public registerInsight(id: string, description: string, schema: IJSONSchema, ctor: Type<IInsightsView>): InsightIdentifier {
public registerInsight(id: string, description: string, schema: IJSONSchema, ctor: IInsightsViewCtor): InsightIdentifier {
this._insightSchema.properties![id] = schema;
this._idToCtor[id] = ctor;
return id;
@@ -103,11 +110,11 @@ class InsightRegistry implements IInsightRegistry {
return this._extensionInsights[id];
}
public getCtorFromId(id: string): Type<IInsightsView> {
public getCtorFromId(id: string): IInsightsViewCtor {
return this._idToCtor[id];
}
public getAllCtors(): Array<Type<IInsightsView>> {
public getAllCtors(): Array<IInsightsViewCtor> {
return values(this._idToCtor);
}
@@ -123,7 +130,7 @@ class InsightRegistry implements IInsightRegistry {
const insightRegistry = new InsightRegistry();
platform.Registry.add(Extensions.InsightContribution, insightRegistry);
export function registerInsight(id: string, description: string, schema: IJSONSchema, ctor: Type<IInsightsView>): InsightIdentifier {
export function registerInsight(id: string, description: string, schema: IJSONSchema, ctor: IInsightsViewCtor): InsightIdentifier {
return insightRegistry.registerInsight(id, description, schema, ctor);
}