mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 06:56:38 +00:00
Add more files to strict compile. Update CONTRIBUTING.md (#63)
* Add more files to strict compile. Update CONTRIBUTING.md to recommend FluentUI use * Remove eslint-disable and use non-null assertion
This commit is contained in:
parent
c51a55013c
commit
3f34936acd
@ -30,12 +30,13 @@ For IE support, polyfill is preferred over new usage of lodash or underscore. We
|
|||||||
### Typescript
|
### Typescript
|
||||||
* Follow this [typescript style guide](https://github.com/excelmicro/typescript) which is based on [airbnb's style guide](https://github.com/airbnb/javascript).
|
* Follow this [typescript style guide](https://github.com/excelmicro/typescript) which is based on [airbnb's style guide](https://github.com/airbnb/javascript).
|
||||||
* Conventions speficic to this project:
|
* Conventions speficic to this project:
|
||||||
* Use double-quotes for string
|
- Use double-quotes for string
|
||||||
* Don't use null, use undefined
|
- Don't use `null`, use `undefined`
|
||||||
* Pascal case for private static readonly fields
|
- Pascal case for private static readonly fields
|
||||||
* Camel case for classnames in markup
|
- Camel case for classnames in markup
|
||||||
* Don't use class unless necessary
|
* Don't use class unless necessary
|
||||||
* Code related to notebooks should be dynamically imported so that it is loaded from a separate bundle only if the account is notebook-enabled. There are already top-level notebook components which are dynamically imported and their dependencies can be statically imported from these files.
|
* Code related to notebooks should be dynamically imported so that it is loaded from a separate bundle only if the account is notebook-enabled. There are already top-level notebook components which are dynamically imported and their dependencies can be statically imported from these files.
|
||||||
|
* Prefer using [Fluent UI controls](https://developer.microsoft.com/en-us/fluentui#/controls/web) over creating your own, in order to maintain consistency and support a11y.
|
||||||
|
|
||||||
### React
|
### React
|
||||||
* Prefer using React class components over function components and hooks unless you have a simple component and require no nested functions:
|
* Prefer using React class components over function components and hooks unless you have a simple component and require no nested functions:
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as ReactBindingHandler from "./ReactBindingHandler";
|
import * as ReactBindingHandler from "./ReactBindingHandler";
|
||||||
|
|
||||||
interface RestorePoint {
|
|
||||||
readonly element: JQuery;
|
|
||||||
readonly width: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class BindingHandlersRegisterer {
|
export class BindingHandlersRegisterer {
|
||||||
public static registerBindingHandlers() {
|
public static registerBindingHandlers() {
|
||||||
ko.bindingHandlers.setTemplateReady = {
|
ko.bindingHandlers.setTemplateReady = {
|
||||||
@ -17,7 +12,7 @@ export class BindingHandlersRegisterer {
|
|||||||
bindingContext?: ko.BindingContext
|
bindingContext?: ko.BindingContext
|
||||||
) {
|
) {
|
||||||
const value = ko.unwrap(wrappedValueAccessor());
|
const value = ko.unwrap(wrappedValueAccessor());
|
||||||
bindingContext.$data.isTemplateReady(value);
|
bindingContext?.$data.isTemplateReady(value);
|
||||||
}
|
}
|
||||||
} as ko.BindingHandler;
|
} as ko.BindingHandler;
|
||||||
|
|
||||||
|
@ -59,13 +59,13 @@ function _generateLogEntry(
|
|||||||
level: Diagnostics.LogEntryLevel,
|
level: Diagnostics.LogEntryLevel,
|
||||||
message: string,
|
message: string,
|
||||||
area: string,
|
area: string,
|
||||||
code: number
|
code?: number
|
||||||
): Diagnostics.LogEntry {
|
): Diagnostics.LogEntry {
|
||||||
return {
|
return {
|
||||||
timestamp: new Date().getUTCSeconds(),
|
timestamp: new Date().getUTCSeconds(),
|
||||||
level: level,
|
level,
|
||||||
message: message,
|
message,
|
||||||
area: area,
|
area,
|
||||||
code: code
|
code
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export interface LogEntry {
|
|||||||
/**
|
/**
|
||||||
* The message code.
|
* The message code.
|
||||||
*/
|
*/
|
||||||
code: number;
|
code?: number;
|
||||||
/**
|
/**
|
||||||
* Any additional data to be logged.
|
* Any additional data to be logged.
|
||||||
*/
|
*/
|
||||||
|
@ -198,7 +198,7 @@ export class Heatmap {
|
|||||||
let timeSelected: string = data.points[0].x;
|
let timeSelected: string = data.points[0].x;
|
||||||
timeSelected = timeSelected.replace(" ", "T");
|
timeSelected = timeSelected.replace(" ", "T");
|
||||||
timeSelected = `${timeSelected}Z`;
|
timeSelected = `${timeSelected}Z`;
|
||||||
let xAxisIndex;
|
let xAxisIndex = 0;
|
||||||
for (let i = 0; i < this._chartData.xAxisPoints.length; i++) {
|
for (let i = 0; i < this._chartData.xAxisPoints.length; i++) {
|
||||||
if (this._chartData.xAxisPoints[i] === timeSelected) {
|
if (this._chartData.xAxisPoints[i] === timeSelected) {
|
||||||
xAxisIndex = i;
|
xAxisIndex = i;
|
||||||
@ -234,7 +234,8 @@ export function handleMessage(event: MessageEvent) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plotly.purge(Heatmap.elementId);
|
Plotly.purge(Heatmap.elementId);
|
||||||
document.getElementById(Heatmap.elementId).innerHTML = "";
|
|
||||||
|
document.getElementById(Heatmap.elementId)!.innerHTML = "";
|
||||||
const data = event.data.data;
|
const data = event.data.data;
|
||||||
const chartData: DataPayload = data.chartData;
|
const chartData: DataPayload = data.chartData;
|
||||||
const chartSettings: HeatmapCaptions = data.chartSettings;
|
const chartSettings: HeatmapCaptions = data.chartSettings;
|
||||||
@ -259,8 +260,8 @@ export function handleMessage(event: MessageEvent) {
|
|||||||
noDataMessageContent.classList.add("dark-theme");
|
noDataMessageContent.classList.add("dark-theme");
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById(Heatmap.elementId).appendChild(chartTitleElement);
|
document.getElementById(Heatmap.elementId)!.appendChild(chartTitleElement);
|
||||||
document.getElementById(Heatmap.elementId).appendChild(noDataMessageElement);
|
document.getElementById(Heatmap.elementId)!.appendChild(noDataMessageElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { NotebookContentRecordProps, selectors } from "@nteract/core";
|
|||||||
* A bunch of utilities to interact with nteract
|
* A bunch of utilities to interact with nteract
|
||||||
*/
|
*/
|
||||||
export default class NTeractUtil {
|
export default class NTeractUtil {
|
||||||
public static getCurrentCellType(content: NotebookContentRecordProps): "markdown" | "code" | "raw" {
|
public static getCurrentCellType(content: NotebookContentRecordProps): "markdown" | "code" | "raw" | undefined {
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ import { Notebook } from "../../../Common/Constants";
|
|||||||
import { CellId } from "@nteract/commutable";
|
import { CellId } from "@nteract/commutable";
|
||||||
|
|
||||||
export interface CdbRecordProps {
|
export interface CdbRecordProps {
|
||||||
databaseAccountName: string;
|
databaseAccountName: string | undefined;
|
||||||
defaultExperience: string;
|
defaultExperience: string | undefined;
|
||||||
kernelRestartDelayMs: number;
|
kernelRestartDelayMs: number;
|
||||||
hoveredCellId: CellId;
|
hoveredCellId: CellId | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CdbRecord = Immutable.RecordOf<CdbRecordProps>;
|
export type CdbRecord = Immutable.RecordOf<CdbRecordProps>;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
if (window.parent !== window) {
|
if (window.parent !== window) {
|
||||||
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
(window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__ = (window.parent as any).__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ export class LocalStorageUtility {
|
|||||||
return !!localStorage.getItem(StorageKey[key]);
|
return !!localStorage.getItem(StorageKey[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getEntryString(key: StorageKey): string {
|
public static getEntryString(key: StorageKey): string | null {
|
||||||
return localStorage.getItem(StorageKey[key]);
|
return localStorage.getItem(StorageKey[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ export class SessionStorageUtility {
|
|||||||
return !!sessionStorage.getItem(StorageKey[key]);
|
return !!sessionStorage.getItem(StorageKey[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getEntryString(key: StorageKey): string {
|
public static getEntryString(key: StorageKey): string | null {
|
||||||
return sessionStorage.getItem(StorageKey[key]);
|
return sessionStorage.getItem(StorageKey[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
export class StringUtility {
|
export class StringUtility {
|
||||||
public static toNumber(num: string): number {
|
public static toNumber(num: string | null): number {
|
||||||
return Number(num);
|
return Number(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static toBoolean(valueStr: string): boolean {
|
public static toBoolean(valueStr: string | null): boolean {
|
||||||
return valueStr === "true";
|
return valueStr === "true";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,33 +82,35 @@ export default class TelemetryProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static traceOpen(action: Action, data?: any, timestamp?: number): number {
|
public static traceOpen(action: Action, data?: any, timestamp?: number): number {
|
||||||
|
const validTimestamp = timestamp || Date.now();
|
||||||
MessageHandler.sendMessage({
|
MessageHandler.sendMessage({
|
||||||
type: MessageTypes.TelemetryInfo,
|
type: MessageTypes.TelemetryInfo,
|
||||||
data: {
|
data: {
|
||||||
action: Action[action],
|
action: Action[action],
|
||||||
actionModifier: ActionModifiers.Open,
|
actionModifier: ActionModifiers.Open,
|
||||||
timestamp: timestamp || Date.now(),
|
timestamp: validTimestamp,
|
||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
appInsights.startTrackEvent(Action[action]);
|
||||||
return timestamp;
|
return validTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static traceMark(action: Action, data?: any, timestamp?: number): number {
|
public static traceMark(action: Action, data?: any, timestamp?: number): number {
|
||||||
|
const validTimestamp = timestamp || Date.now();
|
||||||
MessageHandler.sendMessage({
|
MessageHandler.sendMessage({
|
||||||
type: MessageTypes.TelemetryInfo,
|
type: MessageTypes.TelemetryInfo,
|
||||||
data: {
|
data: {
|
||||||
action: Action[action],
|
action: Action[action],
|
||||||
actionModifier: ActionModifiers.Mark,
|
actionModifier: ActionModifiers.Mark,
|
||||||
timestamp: timestamp || Date.now(),
|
timestamp: validTimestamp,
|
||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appInsights.startTrackEvent(Action[action]);
|
appInsights.startTrackEvent(Action[action]);
|
||||||
return timestamp;
|
return validTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getData(data?: any): any {
|
private static getData(data?: any): any {
|
||||||
|
@ -8,11 +8,14 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"./src/AuthType.ts",
|
"./src/AuthType.ts",
|
||||||
|
"./src/Bindings/BindingHandlersRegisterer.ts",
|
||||||
"./src/Bindings/ReactBindingHandler.ts",
|
"./src/Bindings/ReactBindingHandler.ts",
|
||||||
"./src/Common/ArrayHashMap.ts",
|
"./src/Common/ArrayHashMap.ts",
|
||||||
"./src/Common/Constants.ts",
|
"./src/Common/Constants.ts",
|
||||||
"./src/Common/DeleteFeedback.ts",
|
"./src/Common/DeleteFeedback.ts",
|
||||||
"./src/Common/HashMap.ts",
|
"./src/Common/HashMap.ts",
|
||||||
|
"./src/Common/HeadersUtility.ts",
|
||||||
|
"./src/Common/Logger.ts",
|
||||||
"./src/Common/MessageHandler.ts",
|
"./src/Common/MessageHandler.ts",
|
||||||
"./src/Common/ObjectCache.ts",
|
"./src/Common/ObjectCache.ts",
|
||||||
"./src/Common/ThemeUtility.ts",
|
"./src/Common/ThemeUtility.ts",
|
||||||
@ -23,8 +26,10 @@
|
|||||||
"./src/Contracts/Diagnostics.ts",
|
"./src/Contracts/Diagnostics.ts",
|
||||||
"./src/Contracts/ExplorerContracts.ts",
|
"./src/Contracts/ExplorerContracts.ts",
|
||||||
"./src/Contracts/Versions.ts",
|
"./src/Contracts/Versions.ts",
|
||||||
|
"./src/Controls/Heatmap/Heatmap.ts",
|
||||||
"./src/Controls/Heatmap/HeatmapDatatypes.ts",
|
"./src/Controls/Heatmap/HeatmapDatatypes.ts",
|
||||||
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
|
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
|
||||||
|
"./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
|
||||||
"./src/Explorer/Controls/Toolbar/IToolbarAction.ts",
|
"./src/Explorer/Controls/Toolbar/IToolbarAction.ts",
|
||||||
"./src/Explorer/Controls/Toolbar/IToolbarDisplayable.ts",
|
"./src/Explorer/Controls/Toolbar/IToolbarDisplayable.ts",
|
||||||
"./src/Explorer/Controls/Toolbar/IToolbarDropDown.ts",
|
"./src/Explorer/Controls/Toolbar/IToolbarDropDown.ts",
|
||||||
@ -35,8 +40,11 @@
|
|||||||
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
"./src/Explorer/Notebook/FileSystemUtil.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
|
||||||
"./src/Explorer/Notebook/NotebookComponent/loadTransform.ts",
|
"./src/Explorer/Notebook/NotebookComponent/loadTransform.ts",
|
||||||
|
"./src/Explorer/Notebook/NotebookComponent/reducers.ts",
|
||||||
|
"./src/Explorer/Notebook/NotebookComponent/types.ts",
|
||||||
"./src/Explorer/Notebook/NotebookContentItem.ts",
|
"./src/Explorer/Notebook/NotebookContentItem.ts",
|
||||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||||
|
"./src/Explorer/Notebook/NTeractUtil.ts",
|
||||||
"./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts",
|
"./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts",
|
||||||
"./src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts",
|
"./src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts",
|
||||||
"./src/Explorer/Tables/Constants.ts",
|
"./src/Explorer/Tables/Constants.ts",
|
||||||
@ -44,16 +52,20 @@
|
|||||||
"./src/GitHub/GitHubConnector.ts",
|
"./src/GitHub/GitHubConnector.ts",
|
||||||
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",
|
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",
|
||||||
"./src/PlatformType.ts",
|
"./src/PlatformType.ts",
|
||||||
|
"./src/quickstart.ts",
|
||||||
|
"./src/ReactDevTools.ts",
|
||||||
"./src/ResourceProvider/IResourceProviderClient.ts",
|
"./src/ResourceProvider/IResourceProviderClient.ts",
|
||||||
|
"./src/setupTests.ts",
|
||||||
|
"./src/Shared/appInsights.ts",
|
||||||
|
"./src/Shared/ExplorerSettings.ts",
|
||||||
|
"./src/Shared/StorageUtility.ts",
|
||||||
"./src/Shared/StringUtility.ts",
|
"./src/Shared/StringUtility.ts",
|
||||||
"./src/Shared/Telemetry/TelemetryConstants.ts",
|
"./src/Shared/Telemetry/TelemetryConstants.ts",
|
||||||
"./src/Shared/appInsights.ts",
|
"./src/Shared/Telemetry/TelemetryProcessor.ts",
|
||||||
"./src/Utils/GitHubUtils.ts",
|
"./src/Utils/GitHubUtils.ts",
|
||||||
"./src/Utils/MessageValidation.ts",
|
"./src/Utils/MessageValidation.ts",
|
||||||
"./src/Utils/OfferUtils.ts",
|
"./src/Utils/OfferUtils.ts",
|
||||||
"./src/Utils/StringUtils.ts",
|
"./src/Utils/StringUtils.ts",
|
||||||
"./src/quickstart.ts",
|
|
||||||
"./src/setupTests.ts",
|
|
||||||
"./src/workers/upload/definitions.ts"
|
"./src/workers/upload/definitions.ts"
|
||||||
],
|
],
|
||||||
"include": []
|
"include": []
|
||||||
|
Loading…
Reference in New Issue
Block a user