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:
Laurent Nguyen
2023-10-03 15:13:24 +00:00
committed by GitHub
parent e3c168b7be
commit 90c1439d34
311 changed files with 1899 additions and 2194 deletions

View File

@@ -251,7 +251,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
if (userContext.apiType === "Mongo" && userContext?.databaseAccount) {
this.mongoDBCollectionResource = await readMongoDBCollectionThroughRP(
this.collection.databaseId,
this.collection.id()
this.collection.id(),
);
if (this.mongoDBCollectionResource) {
@@ -357,7 +357,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
error: getErrorMessage(error),
errorStack: getErrorStack(error),
},
startKey
startKey,
);
} finally {
this.props.settingsTab.isExecuting(false);
@@ -431,7 +431,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(),
},
this.props.settingsTab.onLoadStartKey
this.props.settingsTab.onLoadStartKey,
);
this.props.settingsTab.onLoadStartKey = undefined;
}
@@ -566,7 +566,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
this.collection.databaseId,
this.collection.id(),
this.state.conflictResolutionPolicyProcedure,
false
false,
);
}
@@ -640,7 +640,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
const conflictResolutionPolicyMode = parseConflictResolutionMode(conflictResolutionPolicy?.mode);
const conflictResolutionPolicyPath = conflictResolutionPolicy?.conflictResolutionPath;
const conflictResolutionPolicyProcedure = parseConflictResolutionProcedure(
conflictResolutionPolicy?.conflictResolutionProcedure
conflictResolutionPolicy?.conflictResolutionProcedure,
);
const geospatialConfigTypeString: string =
(this.collection.geospatialConfig && this.collection.geospatialConfig()?.type) || GeospatialConfigType.Geometry;
@@ -780,7 +780,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(),
},
startKey
startKey,
);
};
@@ -828,7 +828,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
const updatedCollection: DataModels.Collection = await updateCollection(
this.collection.databaseId,
this.collection.id(),
newCollection
newCollection,
);
this.collection.rawDataModel = updatedCollection;
this.collection.defaultTtl(updatedCollection.defaultTtl);
@@ -862,7 +862,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
this.mongoDBCollectionResource = await updateCollection(
this.collection.databaseId,
this.collection.id(),
newMongoCollection
newMongoCollection,
);
await this.refreshIndexTransformationProgress();
@@ -881,7 +881,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(),
},
startKey
startKey,
);
} catch (error) {
traceFailure(
@@ -895,7 +895,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
error: getErrorMessage(error),
errorStack: getErrorStack(error),
},
startKey
startKey,
);
throw error;
}
@@ -942,12 +942,12 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(),
},
startKey
startKey,
);
};
public getMongoIndexTabContent = (
mongoIndexingPolicyComponentProps: MongoIndexingPolicyComponentProps
mongoIndexingPolicyComponentProps: MongoIndexingPolicyComponentProps,
): JSX.Element => {
if (userContext.authType === AuthType.AAD) {
if (userContext.apiType === "Mongo") {

View File

@@ -179,7 +179,7 @@ export const getRuPriceBreakdown = (
serverId: string,
numberOfRegions: number,
isMultimaster: boolean,
isAutoscale: boolean
isAutoscale: boolean,
): PriceBreakdown => {
const hourlyPrice: number = computeRUUsagePriceHourly({
serverId: serverId,
@@ -207,7 +207,7 @@ export const getEstimatedSpendingElement = (
throughput: number,
numberOfRegions: number,
priceBreakdown: PriceBreakdown,
isAutoscale: boolean
isAutoscale: boolean,
): JSX.Element => {
const ruRange: string = isAutoscale ? throughput / 10 + " RU/s - " : "";
return (
@@ -279,7 +279,7 @@ export const getUpdateThroughputBeyondInstantLimitMessage = (instantMaximumThrou
export const getUpdateThroughputBeyondSupportLimitMessage = (
instantMaximumThroughput: number,
maximumThroughput: number
maximumThroughput: number,
): JSX.Element => {
return (
<>
@@ -333,15 +333,15 @@ const getCurrentThroughput = (
isAutoscale: boolean,
throughput: number,
throughputUnit: string,
targetThroughput?: number
targetThroughput?: number,
): string => {
if (targetThroughput) {
if (throughput) {
return isAutoscale
? `, Current autoscale throughput: ${Math.round(
throughput / 10
throughput / 10,
)} - ${throughput} ${throughputUnit}, Target autoscale throughput: ${Math.round(
targetThroughput / 10
targetThroughput / 10,
)} - ${targetThroughput} ${throughputUnit}`
: `, Current manual throughput: ${throughput} ${throughputUnit}, Target manual throughput: ${targetThroughput}`;
} else {
@@ -366,7 +366,7 @@ export const getThroughputApplyDelayedMessage = (
throughputUnit: string,
databaseName: string,
collectionName: string,
requestedThroughput: number
requestedThroughput: number,
): JSX.Element => (
<Text styles={infoAndToolTipTextStyle}>
The request to increase the throughput has successfully been submitted. This operation will take 1-3 business days
@@ -382,7 +382,7 @@ export const getThroughputApplyShortDelayMessage = (
throughput: number,
throughputUnit: string,
databaseName: string,
collectionName: string
collectionName: string,
): JSX.Element => (
<Text styles={infoAndToolTipTextStyle} id="throughputApplyShortDelayMessage">
A request to increase the throughput is currently in progress. This operation will take some time to complete.
@@ -398,7 +398,7 @@ export const getThroughputApplyLongDelayMessage = (
throughputUnit: string,
databaseName: string,
collectionName: string,
requestedThroughput: number
requestedThroughput: number,
): JSX.Element => (
<Text styles={infoAndToolTipTextStyle} id="throughputApplyLongDelayMessage">
A request to increase the throughput is currently in progress. This operation will take 1-3 business days to
@@ -480,7 +480,7 @@ export const mongoIndexTransformationRefreshingMessage: JSX.Element = (
export const renderMongoIndexTransformationRefreshMessage = (
progress: number,
performRefresh: () => void
performRefresh: () => void,
): JSX.Element => {
if (progress === 0) {
return (
@@ -516,7 +516,7 @@ export const getTextFieldStyles = (current: isDirtyTypes, baseline: isDirtyTypes
export const getChoiceGroupStyles = (
current: isDirtyTypes,
baseline: isDirtyTypes,
isHorizontal?: boolean
isHorizontal?: boolean,
): Partial<IChoiceGroupStyles> => ({
flexContainer: [
{

View File

@@ -68,20 +68,20 @@ export class ConflictResolutionComponent extends React.Component<ConflictResolut
private onConflictResolutionPolicyModeChange = (
event?: React.FormEvent<HTMLElement | HTMLInputElement>,
option?: IChoiceGroupOption
option?: IChoiceGroupOption,
): void =>
this.props.onConflictResolutionPolicyModeChange(
DataModels.ConflictResolutionMode[option.key as keyof typeof DataModels.ConflictResolutionMode]
DataModels.ConflictResolutionMode[option.key as keyof typeof DataModels.ConflictResolutionMode],
);
private onConflictResolutionPolicyPathChange = (
event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
newValue?: string
newValue?: string,
): void => this.props.onConflictResolutionPolicyPathChange(newValue);
private onConflictResolutionPolicyProcedureChange = (
event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
newValue?: string
newValue?: string,
): void => this.props.onConflictResolutionPolicyProcedureChange(newValue);
private getConflictResolutionModeComponent = (): JSX.Element => (
@@ -92,7 +92,7 @@ export class ConflictResolutionComponent extends React.Component<ConflictResolut
onChange={this.onConflictResolutionPolicyModeChange}
styles={getChoiceGroupStyles(
this.props.conflictResolutionPolicyMode,
this.props.conflictResolutionPolicyModeBaseline
this.props.conflictResolutionPolicyModeBaseline,
)}
/>
);
@@ -108,7 +108,7 @@ export class ConflictResolutionComponent extends React.Component<ConflictResolut
onRenderLabel={this.onRenderLwwComponentTextField}
styles={getTextFieldStyles(
this.props.conflictResolutionPolicyPath,
this.props.conflictResolutionPolicyPathBaseline
this.props.conflictResolutionPolicyPathBaseline,
)}
value={this.props.conflictResolutionPolicyPath}
onChange={this.onConflictResolutionPolicyPathChange}
@@ -126,7 +126,7 @@ export class ConflictResolutionComponent extends React.Component<ConflictResolut
onRenderLabel={this.onRenderCustomComponentTextField}
styles={getTextFieldStyles(
this.props.conflictResolutionPolicyProcedure,
this.props.conflictResolutionPolicyProcedureBaseline
this.props.conflictResolutionPolicyProcedureBaseline,
)}
value={this.props.conflictResolutionPolicyProcedure}
onChange={this.onConflictResolutionPolicyProcedureChange}

View File

@@ -35,7 +35,7 @@ export class IndexingPolicyRefreshComponent extends React.Component<
} else if (isIndexTransforming(this.props.indexTransformationProgress)) {
return renderMongoIndexTransformationRefreshMessage(
this.props.indexTransformationProgress,
this.onClickRefreshIndexingTransformationLink
this.onClickRefreshIndexingTransformationLink,
);
}
return undefined;

View File

@@ -40,12 +40,12 @@ export class AddMongoIndexComponent extends React.Component<AddMongoIndexCompone
(value: MongoIndexTypes) => ({
text: getMongoIndexTypeText(value),
key: value,
})
}),
);
private onDescriptionChange = (
event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
newValue?: string
newValue?: string,
): void => {
this.props.onIndexAddOrChange(newValue, this.props.type);
};

View File

@@ -90,7 +90,7 @@ describe("MongoIndexingPolicyComponent", () => {
indexToDropIsPresent: boolean,
isMongoIndexingPolicySaveable: boolean,
isMongoIndexingPolicyDiscardable: boolean,
mongoWarningNotificationMessage: string
mongoWarningNotificationMessage: string,
) => {
const addMongoIndexProps = {
mongoIndex: { key: { keys: ["sampleKey"] } },
@@ -107,7 +107,7 @@ describe("MongoIndexingPolicyComponent", () => {
expect(mongoIndexingPolicyComponent.isMongoIndexingPolicySaveable()).toEqual(isMongoIndexingPolicySaveable);
expect(mongoIndexingPolicyComponent.isMongoIndexingPolicyDiscardable()).toEqual(
isMongoIndexingPolicyDiscardable
isMongoIndexingPolicyDiscardable,
);
if (mongoWarningNotificationMessage) {
const elementAsString = renderToString(mongoIndexingPolicyComponent.getMongoWarningNotificationMessage());
@@ -115,7 +115,7 @@ describe("MongoIndexingPolicyComponent", () => {
} else {
expect(mongoIndexingPolicyComponent.getMongoWarningNotificationMessage()).toBeUndefined();
}
}
},
);
});
});

View File

@@ -130,7 +130,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
public getMongoWarningNotificationMessage = (): JSX.Element => {
const warningMessage = this.props.indexesToAdd.find(
(addMongoIndexProps) => addMongoIndexProps.notification?.type === MongoNotificationType.Warning
(addMongoIndexProps) => addMongoIndexProps.notification?.type === MongoNotificationType.Warning,
)?.notification.message;
if (warningMessage) {
@@ -163,7 +163,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
private getMongoIndexDisplayProps = (
mongoIndex: MongoIndex,
arrayPosition: number,
isCurrentIndex: boolean
isCurrentIndex: boolean,
): MongoIndexDisplayProps => {
const keys = mongoIndex?.key?.keys;
const type = getMongoIndexType(keys);
@@ -261,7 +261,7 @@ export class MongoIndexingPolicyComponent extends React.Component<MongoIndexingP
private renderIndexesToBeDropped = (): JSX.Element => {
const indexesToBeDropped = this.props.indexesToDrop.map((dropIndex, arrayPosition) =>
this.getMongoIndexDisplayProps(this.props.mongoIndexes[dropIndex], arrayPosition, false)
this.getMongoIndexDisplayProps(this.props.mongoIndexes[dropIndex], arrayPosition, false),
);
return (

View File

@@ -113,7 +113,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
throughput,
throughputUnit,
this.databaseId,
this.collectionId
this.collectionId,
);
}
@@ -122,7 +122,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
public getLongDelayMessage = (): JSX.Element => {
const matches: string[] = this.props.initialNotification?.description.match(
`Throughput update for (.*) ${throughputUnit}`
`Throughput update for (.*) ${throughputUnit}`,
);
const throughput = this.props.throughputBaseline;
@@ -134,7 +134,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
throughputUnit,
this.databaseId,
this.collectionId,
targetThroughput
targetThroughput,
);
}
return <></>;

View File

@@ -145,7 +145,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
private onTimeToLiveSecondsChange = (
event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
newValue?: string
newValue?: string,
): void => {
const newTimeToLiveSeconds = getSanitizedInputValue(newValue, Int32.Max);
this.props.onDisplayedTtlSecondsChange(newTimeToLiveSeconds.toString());
@@ -154,18 +154,18 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
private onGeoSpatialConfigTypeChange = (
ev?: React.FormEvent<HTMLElement | HTMLInputElement>,
option?: IChoiceGroupOption
option?: IChoiceGroupOption,
): void =>
this.props.onGeoSpatialConfigTypeChange(GeospatialConfigType[option.key as keyof typeof GeospatialConfigType]);
private onAnalyticalStorageTtlSelectionChange = (
ev?: React.FormEvent<HTMLElement | HTMLInputElement>,
option?: IChoiceGroupOption
option?: IChoiceGroupOption,
): void => this.props.onAnalyticalStorageTtlSelectionChange(this.getTtlValue(option.key));
private onAnalyticalStorageTtlSecondsChange = (
event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
newValue?: string
newValue?: string,
): void => {
const newAnalyticalStorageTtlSeconds = getSanitizedInputValue(newValue, Int32.Max);
this.props.onAnalyticalStorageTtlSecondsChange(newAnalyticalStorageTtlSeconds);
@@ -173,7 +173,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
private onChangeFeedPolicyChange = (
ev?: React.FormEvent<HTMLElement | HTMLInputElement>,
option?: IChoiceGroupOption
option?: IChoiceGroupOption,
): void =>
this.props.onChangeFeedPolicyChange(ChangeFeedPolicyState[option.key as keyof typeof ChangeFeedPolicyState]);
@@ -240,7 +240,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
onChange={this.onAnalyticalStorageTtlSelectionChange}
styles={getChoiceGroupStyles(
this.props.analyticalStorageTtlSelection,
this.props.analyticalStorageTtlSelectionBaseline
this.props.analyticalStorageTtlSelectionBaseline,
)}
/>
{this.props.analyticalStorageTtlSelection === TtlType.On && (
@@ -248,7 +248,7 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
id="analyticalStorageTimeToLiveSeconds"
styles={getTextFieldStyles(
this.props.analyticalStorageTtlSeconds,
this.props.analyticalStorageTtlSecondsBaseline
this.props.analyticalStorageTtlSecondsBaseline,
)}
type="number"
required

View File

@@ -202,7 +202,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
userContext.portalEnv,
regions,
multimaster,
isDirty ? this.props.maxAutoPilotThroughput : undefined
isDirty ? this.props.maxAutoPilotThroughput : undefined,
);
} else {
estimatedSpend = this.getEstimatedManualSpendElement(
@@ -211,7 +211,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
userContext.portalEnv,
regions,
multimaster,
isDirty ? this.props.throughput : undefined
isDirty ? this.props.throughput : undefined,
);
}
return estimatedSpend;
@@ -222,7 +222,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
serverId: string,
numberOfRegions: number,
isMultimaster: boolean,
newThroughput?: number
newThroughput?: number,
): JSX.Element => {
const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, true);
@@ -232,7 +232,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
serverId,
numberOfRegions,
isMultimaster,
true
true,
);
return (
<div>
@@ -275,7 +275,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
serverId: string,
numberOfRegions: number,
isMultimaster: boolean,
newThroughput?: number
newThroughput?: number,
): JSX.Element => {
const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, false);
@@ -285,7 +285,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
serverId,
numberOfRegions,
isMultimaster,
true
true,
);
return (
<div>
@@ -331,7 +331,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
private onAutoPilotThroughputChange = (
event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
newValue?: string
newValue?: string,
): void => {
const newThroughput = getSanitizedInputValue(newValue);
this.props.onMaxAutoPilotThroughputChange(newThroughput);
@@ -339,7 +339,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
private onThroughputChange = (
event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
newValue?: string
newValue?: string,
): void => {
const newThroughput = getSanitizedInputValue(newValue);
if (this.overrideWithAutoPilotSettings()) {
@@ -354,7 +354,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
private onChoiceGroupChange = (
event?: React.FormEvent<HTMLElement | HTMLInputElement>,
option?: IChoiceGroupOption
option?: IChoiceGroupOption,
): void => {
this.props.onAutoPilotSelected(option.key === "true");
TelemetryProcessor.trace(Action.ToggleAutoscaleSetting, ActionModifiers.Mark, {
@@ -557,7 +557,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
case "requireSupport":
return getUpdateThroughputBeyondSupportLimitMessage(
this.props.instantMaximumThroughput,
this.props.softAllowedMaximumThroughput
this.props.softAllowedMaximumThroughput,
);
default:
return <></>;

View File

@@ -122,7 +122,7 @@ describe("SettingsUtils", () => {
notification = getMongoNotification(singleIndexDescription, MongoIndexTypes.Wildcard);
expect(notification.message).toEqual(
"Wildcard path is not present in the field name. Use a pattern like " + MongoWildcardPlaceHolder
"Wildcard path is not present in the field name. Use a pattern like " + MongoWildcardPlaceHolder,
);
expect(notification.type).toEqual(MongoNotificationType.Error);
});

View File

@@ -5,7 +5,7 @@ import Explorer from "../../Explorer";
export const container = new Explorer();
export const collection = ({
export const collection = {
container: container,
databaseId: "test",
id: ko.observable<string>("test"),
@@ -27,7 +27,7 @@ export const collection = ({
offerReplacePending: false,
}),
conflictResolutionPolicy: ko.observable<DataModels.ConflictResolutionPolicy>(
{} as DataModels.ConflictResolutionPolicy
{} as DataModels.ConflictResolutionPolicy,
),
changeFeedPolicy: ko.observable<DataModels.ChangeFeedPolicy>({} as DataModels.ChangeFeedPolicy),
geospatialConfig: ko.observable<DataModels.GeospatialConfig>({} as DataModels.GeospatialConfig),
@@ -43,4 +43,4 @@ export const collection = ({
readSettings: () => {
return;
},
} as unknown) as ViewModels.Collection;
} as unknown as ViewModels.Collection;