mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-16 17:25:58 +00:00
Fix Lint errors in URLUtility (#462)
This commit is contained in:
parent
65c859c835
commit
3cccbdfe81
@ -24,7 +24,6 @@ src/Common/ObjectCache.test.ts
|
|||||||
src/Common/ObjectCache.ts
|
src/Common/ObjectCache.ts
|
||||||
src/Common/QueriesClient.ts
|
src/Common/QueriesClient.ts
|
||||||
src/Common/Splitter.ts
|
src/Common/Splitter.ts
|
||||||
src/Common/UrlUtility.ts
|
|
||||||
src/Config.ts
|
src/Config.ts
|
||||||
src/Contracts/ActionContracts.ts
|
src/Contracts/ActionContracts.ts
|
||||||
src/Contracts/DataModels.ts
|
src/Contracts/DataModels.ts
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
export default class UrlUtility {
|
interface Result {
|
||||||
public static parseDocumentsPath(resourcePath: string): any {
|
type?: string;
|
||||||
|
objectBody?: {
|
||||||
|
id: string;
|
||||||
|
self: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseDocumentsPath(resourcePath: string): Result {
|
||||||
if (typeof resourcePath !== "string") {
|
if (typeof resourcePath !== "string") {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -16,9 +23,9 @@ export default class UrlUtility {
|
|||||||
resourcePath = "/" + resourcePath;
|
resourcePath = "/" + resourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
var id: string;
|
let id: string;
|
||||||
var type: string;
|
let type: string;
|
||||||
var pathParts = resourcePath.split("/");
|
const pathParts = resourcePath.split("/");
|
||||||
|
|
||||||
if (pathParts.length % 2 === 0) {
|
if (pathParts.length % 2 === 0) {
|
||||||
id = pathParts[pathParts.length - 2];
|
id = pathParts[pathParts.length - 2];
|
||||||
@ -28,7 +35,7 @@ export default class UrlUtility {
|
|||||||
type = pathParts[pathParts.length - 2];
|
type = pathParts[pathParts.length - 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = {
|
const result = {
|
||||||
type: type,
|
type: type,
|
||||||
objectBody: {
|
objectBody: {
|
||||||
id: id,
|
id: id,
|
||||||
@ -37,19 +44,18 @@ export default class UrlUtility {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createUri(baseUri: string, relativeUri: string): string {
|
export function createUri(baseUri: string, relativeUri: string): string {
|
||||||
if (!baseUri) {
|
if (!baseUri) {
|
||||||
throw new Error("baseUri is null or empty");
|
throw new Error("baseUri is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
var slashAtEndOfUriRegex = /\/$/,
|
const slashAtEndOfUriRegex = /\/$/,
|
||||||
slashAtStartOfUriRegEx = /^\//;
|
slashAtStartOfUriRegEx = /^\//;
|
||||||
|
|
||||||
var normalizedBaseUri = baseUri.replace(slashAtEndOfUriRegex, "") + "/",
|
const normalizedBaseUri = baseUri.replace(slashAtEndOfUriRegex, "") + "/",
|
||||||
normalizedRelativeUri = (relativeUri && relativeUri.replace(slashAtStartOfUriRegEx, "")) || "";
|
normalizedRelativeUri = (relativeUri && relativeUri.replace(slashAtStartOfUriRegEx, "")) || "";
|
||||||
|
|
||||||
return normalizedBaseUri + normalizedRelativeUri;
|
return normalizedBaseUri + normalizedRelativeUri;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import { ChildrenMargin } from "./GitHubStyleConstants";
|
|||||||
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
import * as GitHubUtils from "../../../Utils/GitHubUtils";
|
||||||
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
import { IGitHubRepo } from "../../../GitHub/GitHubClient";
|
||||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import UrlUtility from "../../../Common/UrlUtility";
|
import * as UrlUtility from "../../../Common/UrlUtility";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
|
||||||
export interface AddRepoComponentProps {
|
export interface AddRepoComponentProps {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Octokit } from "@octokit/rest";
|
import { Octokit } from "@octokit/rest";
|
||||||
import { HttpStatusCodes } from "../Common/Constants";
|
import { HttpStatusCodes } from "../Common/Constants";
|
||||||
import * as Logger from "../Common/Logger";
|
import * as Logger from "../Common/Logger";
|
||||||
import UrlUtility from "../Common/UrlUtility";
|
import * as UrlUtility from "../Common/UrlUtility";
|
||||||
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
||||||
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import * as Logger from "../Common/Logger";
|
|||||||
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
|
||||||
import { GitHubClient, IGitHubFile, IGitHubResponse } from "./GitHubClient";
|
import { GitHubClient, IGitHubFile, IGitHubResponse } from "./GitHubClient";
|
||||||
import * as GitHubUtils from "../Utils/GitHubUtils";
|
import * as GitHubUtils from "../Utils/GitHubUtils";
|
||||||
import UrlUtility from "../Common/UrlUtility";
|
import * as UrlUtility from "../Common/UrlUtility";
|
||||||
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
import { getErrorMessage } from "../Common/ErrorHandlingUtils";
|
||||||
|
|
||||||
export interface GitHubContentProviderParams {
|
export interface GitHubContentProviderParams {
|
||||||
|
@ -3,7 +3,7 @@ import { HttpStatusCodes } from "../Common/Constants";
|
|||||||
import { IResourceProviderClient, IResourceProviderRequestOptions } from "./IResourceProviderClient";
|
import { IResourceProviderClient, IResourceProviderRequestOptions } from "./IResourceProviderClient";
|
||||||
import { OperationStatus } from "../Contracts/DataModels";
|
import { OperationStatus } from "../Contracts/DataModels";
|
||||||
import { TokenProviderFactory } from "../TokenProviders/TokenProviderFactory";
|
import { TokenProviderFactory } from "../TokenProviders/TokenProviderFactory";
|
||||||
import UrlUtility from "../Common/UrlUtility";
|
import * as UrlUtility from "../Common/UrlUtility";
|
||||||
|
|
||||||
export class ResourceProviderClient<T> implements IResourceProviderClient<T> {
|
export class ResourceProviderClient<T> implements IResourceProviderClient<T> {
|
||||||
private httpClient: HttpClient;
|
private httpClient: HttpClient;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user