mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-01 15:22:08 +00:00
Update prettier to latest. Remove tslint (#1641)
* Rev up prettier * Reformat * Remove deprecated tslint * Remove call to tslint and update package-lock.json
This commit is contained in:
@@ -142,7 +142,7 @@ const addToMap = (...decorators: Decorator[]): PropertyDecorator => {
|
||||
addPropertyToMap(target, propertyName, className, "dataFieldName", propertyName);
|
||||
|
||||
decorators.map((decorator: Decorator) =>
|
||||
addPropertyToMap(target, propertyName, className, decorator.name, decorator.value)
|
||||
addPropertyToMap(target, propertyName, className, decorator.name, decorator.value),
|
||||
);
|
||||
};
|
||||
};
|
||||
@@ -172,30 +172,30 @@ export const Values = (inputOptions: InputOptions): PropertyDecorator => {
|
||||
{ name: "min", value: inputOptions.min },
|
||||
{ name: "max", value: inputOptions.max },
|
||||
{ name: "step", value: inputOptions.step },
|
||||
{ name: "uiType", value: inputOptions.uiType }
|
||||
{ name: "uiType", value: inputOptions.uiType },
|
||||
);
|
||||
} else if (isBooleanInputOptions(inputOptions)) {
|
||||
return addToMap(
|
||||
{ name: "labelTKey", value: inputOptions.labelTKey },
|
||||
{ name: "trueLabelTKey", value: inputOptions.trueLabelTKey },
|
||||
{ name: "falseLabelTKey", value: inputOptions.falseLabelTKey }
|
||||
{ name: "falseLabelTKey", value: inputOptions.falseLabelTKey },
|
||||
);
|
||||
} else if (isChoiceInputOptions(inputOptions)) {
|
||||
return addToMap(
|
||||
{ name: "labelTKey", value: inputOptions.labelTKey },
|
||||
{ name: "placeholderTKey", value: inputOptions.placeholderTKey },
|
||||
{ name: "choices", value: inputOptions.choices }
|
||||
{ name: "choices", value: inputOptions.choices },
|
||||
);
|
||||
} else if (isDescriptionDisplayOptions(inputOptions)) {
|
||||
return addToMap(
|
||||
{ name: "labelTKey", value: inputOptions.labelTKey },
|
||||
{ name: "description", value: inputOptions.description },
|
||||
{ name: "isDynamicDescription", value: inputOptions.isDynamicDescription }
|
||||
{ name: "isDynamicDescription", value: inputOptions.isDynamicDescription },
|
||||
);
|
||||
} else {
|
||||
return addToMap(
|
||||
{ name: "labelTKey", value: inputOptions.labelTKey },
|
||||
{ name: "placeholderTKey", value: inputOptions.placeholderTKey }
|
||||
{ name: "placeholderTKey", value: inputOptions.placeholderTKey },
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ const onRegionsChange = (newValue: InputType, currentState: Map<string, SmartUiI
|
||||
|
||||
const onEnableDbLevelThroughputChange = (
|
||||
newValue: InputType,
|
||||
currentState: Map<string, SmartUiInput>
|
||||
currentState: Map<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentState.set("enableDbLevelThroughput", { value: newValue });
|
||||
const currentDbThroughput = currentState.get("dbThroughput");
|
||||
@@ -64,7 +64,7 @@ const onEnableDbLevelThroughputChange = (
|
||||
|
||||
const validate = (
|
||||
currentvalues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
): void => {
|
||||
if (currentvalues.get("dbThroughput") === baselineValues.get("dbThroughput")) {
|
||||
throw new Error("DbThroughputValidationError");
|
||||
@@ -87,7 +87,7 @@ export default class SelfServeExample extends SelfServeBaseClass {
|
||||
*/
|
||||
public onSave = async (
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
): Promise<OnSaveResult> => {
|
||||
validate(currentValues, baselineValues);
|
||||
const regions = Regions[currentValues.get("regions")?.value as keyof typeof Regions];
|
||||
|
||||
@@ -65,7 +65,7 @@ const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInpu
|
||||
const onNumberOfInstancesChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentValues.set("instances", { value: newValue });
|
||||
const ComputeOriginallyEnabled = baselineValues.get("enableCompute")?.value as boolean;
|
||||
@@ -95,7 +95,7 @@ const onNumberOfInstancesChange = (
|
||||
const onEnableComputeChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentValues.set("enableCompute", { value: newValue });
|
||||
const ComputeOriginallyEnabled = baselineValues.get("enableCompute")?.value as boolean;
|
||||
@@ -235,7 +235,7 @@ export default class GraphAPICompute extends SelfServeBaseClass {
|
||||
|
||||
public onSave = async (
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Promise<OnSaveResult> => {
|
||||
selfServeTrace({ selfServeClassName: GraphAPICompute.name });
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInpu
|
||||
const onNumberOfInstancesChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentValues.set("instances", { value: newValue });
|
||||
const MaterializedViewsBuilderOriginallyEnabled = baselineValues.get("enableMaterializedViewsBuilder")
|
||||
@@ -93,7 +93,7 @@ const onNumberOfInstancesChange = (
|
||||
const onEnableMaterializedViewsBuilderChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentValues.set("enableMaterializedViewsBuilder", { value: newValue });
|
||||
const MaterializedViewsBuilderOriginallyEnabled = baselineValues.get("enableMaterializedViewsBuilder")
|
||||
@@ -247,7 +247,7 @@ export default class MaterializedViewsBuilder extends SelfServeBaseClass {
|
||||
|
||||
public onSave = async (
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Promise<OnSaveResult> => {
|
||||
selfServeTrace({ selfServeClassName: MaterializedViewsBuilder.name });
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ describe("SelfServeComponent", () => {
|
||||
|
||||
it("should render and honor save, discard, refresh actions", async () => {
|
||||
const wrapper = shallow(
|
||||
<SelfServeComponent descriptor={exampleData} t={undefined} i18n={undefined} tReady={undefined} />
|
||||
<SelfServeComponent descriptor={exampleData} t={undefined} i18n={undefined} tReady={undefined} />,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
@@ -161,7 +161,7 @@ describe("SelfServeComponent", () => {
|
||||
|
||||
it("getResolvedValue", async () => {
|
||||
const wrapper = shallow(
|
||||
<SelfServeComponent descriptor={exampleData} t={undefined} i18n={undefined} tReady={undefined} />
|
||||
<SelfServeComponent descriptor={exampleData} t={undefined} i18n={undefined} tReady={undefined} />,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
const selfServeComponent = wrapper.instance() as SelfServeComponent;
|
||||
@@ -184,7 +184,7 @@ describe("SelfServeComponent", () => {
|
||||
it("message bar and spinner snapshots", async () => {
|
||||
const newDescriptor = { ...exampleData, onRefresh: onRefreshIsUpdatingMock };
|
||||
let wrapper = shallow(
|
||||
<SelfServeComponent descriptor={newDescriptor} t={undefined} i18n={undefined} tReady={undefined} />
|
||||
<SelfServeComponent descriptor={newDescriptor} t={undefined} i18n={undefined} tReady={undefined} />,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
let selfServeComponent = wrapper.instance() as SelfServeComponent;
|
||||
@@ -194,7 +194,7 @@ describe("SelfServeComponent", () => {
|
||||
|
||||
newDescriptor.onRefresh = onRefreshMock;
|
||||
wrapper = shallow(
|
||||
<SelfServeComponent descriptor={newDescriptor} t={undefined} i18n={undefined} tReady={undefined} />
|
||||
<SelfServeComponent descriptor={newDescriptor} t={undefined} i18n={undefined} tReady={undefined} />,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
selfServeComponent = wrapper.instance() as SelfServeComponent;
|
||||
|
||||
@@ -153,7 +153,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
||||
|
||||
this.setState({
|
||||
compileErrorMessage: `The following fields have default values set but are not input properties of this class: ${keys.join(
|
||||
", "
|
||||
", ",
|
||||
)}`,
|
||||
});
|
||||
}
|
||||
@@ -183,7 +183,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
||||
private initializeSmartUiNode = async (
|
||||
currentNode: Node,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Promise<void> => {
|
||||
currentNode.info = await this.getResolvedValue(currentNode.info);
|
||||
|
||||
@@ -192,7 +192,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
||||
}
|
||||
|
||||
const promises = currentNode.children?.map(
|
||||
async (child: Node) => await this.initializeSmartUiNode(child, currentValues, baselineValues)
|
||||
async (child: Node) => await this.initializeSmartUiNode(child, currentValues, baselineValues),
|
||||
);
|
||||
if (promises) {
|
||||
await Promise.all(promises);
|
||||
@@ -202,7 +202,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
||||
private getResolvedInput = async (
|
||||
input: AnyDisplay,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Promise<AnyDisplay> => {
|
||||
input.labelTKey = await this.getResolvedValue(input.labelTKey);
|
||||
input.placeholderTKey = await this.getResolvedValue(input.placeholderTKey);
|
||||
@@ -258,7 +258,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
||||
const newValues = input.onChange(
|
||||
newValue,
|
||||
this.state.currentValues,
|
||||
this.state.baselineValues as ReadonlyMap<string, SmartUiInput>
|
||||
this.state.baselineValues as ReadonlyMap<string, SmartUiInput>,
|
||||
);
|
||||
this.setState({ currentValues: newValues });
|
||||
} else {
|
||||
@@ -281,7 +281,7 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
||||
try {
|
||||
const onSaveResult = await this.props.descriptor.onSave(
|
||||
this.state.currentValues,
|
||||
this.state.baselineValues as ReadonlyMap<string, SmartUiInput>
|
||||
this.state.baselineValues as ReadonlyMap<string, SmartUiInput>,
|
||||
);
|
||||
if (onSaveResult.portalNotification) {
|
||||
const requestInitializedPortalNotification = onSaveResult.portalNotification.initialize;
|
||||
|
||||
@@ -12,7 +12,7 @@ interface BaseInput {
|
||||
onChange?: (
|
||||
newValue: InputType,
|
||||
currentState: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
) => Map<string, SmartUiInput>;
|
||||
placeholderTKey?: (() => Promise<string>) | string;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export interface SelfServeDescriptor {
|
||||
initialize?: () => Promise<Map<string, SmartUiInput>>;
|
||||
onSave?: (
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
) => Promise<OnSaveResult>;
|
||||
inputNames?: string[];
|
||||
onRefresh?: () => Promise<RefreshResult>;
|
||||
@@ -95,7 +95,7 @@ export type onSaveCallback =
|
||||
*/
|
||||
(
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
) => Promise<OnSaveResult>;
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ export type OnChangeCallback =
|
||||
(
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
) => Map<string, SmartUiInput>;
|
||||
|
||||
export enum NumberUiType {
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("SelfServeUtils", () => {
|
||||
public onRefresh = jest.fn();
|
||||
}
|
||||
expect(() => new Test().toSelfServeDescriptor()).toThrow(
|
||||
"@IsDisplayable decorator was not declared for the class 'Test'"
|
||||
"@IsDisplayable decorator was not declared for the class 'Test'",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ export interface DecoratorProperties {
|
||||
onChange?: (
|
||||
newValue: InputType,
|
||||
currentState: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
) => Map<string, SmartUiInput>;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ export interface DecoratorProperties {
|
||||
const setValue = <T extends keyof DecoratorProperties, K extends DecoratorProperties[T]>(
|
||||
name: T,
|
||||
value: K,
|
||||
fieldObject: DecoratorProperties
|
||||
fieldObject: DecoratorProperties,
|
||||
): void => {
|
||||
fieldObject[name] = value;
|
||||
};
|
||||
@@ -121,7 +121,7 @@ export const addPropertyToMap = <T extends keyof DecoratorProperties, K extends
|
||||
propertyName: string,
|
||||
className: string,
|
||||
descriptorName: keyof DecoratorProperties,
|
||||
descriptorValue: K
|
||||
descriptorValue: K,
|
||||
): void => {
|
||||
const context =
|
||||
(Reflect.getMetadata(className, target) as Map<string, DecoratorProperties>) ??
|
||||
@@ -136,7 +136,7 @@ export const updateContextWithDecorator = <T extends keyof DecoratorProperties,
|
||||
propertyName: string,
|
||||
className: string,
|
||||
descriptorName: keyof DecoratorProperties,
|
||||
descriptorValue: K
|
||||
descriptorValue: K,
|
||||
): void => {
|
||||
if (!(context instanceof Map)) {
|
||||
throw new Error(`@IsDisplayable should be the first decorator for the class '${className}'.`);
|
||||
@@ -146,7 +146,7 @@ export const updateContextWithDecorator = <T extends keyof DecoratorProperties,
|
||||
|
||||
if (getValue(descriptorName, propertyObject) && descriptorName !== "type" && descriptorName !== "dataFieldName") {
|
||||
throw new Error(
|
||||
`Duplicate value passed for '${descriptorName}' on property '${propertyName}' of class '${className}'`
|
||||
`Duplicate value passed for '${descriptorName}' on property '${propertyName}' of class '${className}'`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ const addToDescriptor = (
|
||||
context: Map<string, DecoratorProperties>,
|
||||
root: Node,
|
||||
key: string,
|
||||
inputNames: string[]
|
||||
inputNames: string[],
|
||||
): void => {
|
||||
const value = context.get(key);
|
||||
inputNames.push(value.id);
|
||||
|
||||
@@ -71,7 +71,7 @@ const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInpu
|
||||
const onNumberOfInstancesChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentValues.set("instances", { value: newValue });
|
||||
const dedicatedGatewayOriginallyEnabled = baselineValues.get("enableDedicatedGateway")?.value as boolean;
|
||||
@@ -101,7 +101,7 @@ const onNumberOfInstancesChange = (
|
||||
const onEnableDedicatedGatewayChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>
|
||||
baselineValues: ReadonlyMap<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentValues.set("enableDedicatedGateway", { value: newValue });
|
||||
const dedicatedGatewayOriginallyEnabled = baselineValues.get("enableDedicatedGateway")?.value as boolean;
|
||||
@@ -279,7 +279,7 @@ export default class SqlX extends SelfServeBaseClass {
|
||||
|
||||
public onSave = async (
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
baselineValues: Map<string, SmartUiInput>
|
||||
baselineValues: Map<string, SmartUiInput>,
|
||||
): Promise<OnSaveResult> => {
|
||||
selfServeTrace({ selfServeClassName: SqlX.name });
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
Reference in New Issue
Block a user