Skip to content

Commit

Permalink
[app-configuration] Fixing some lint issues (Azure#13055)
Browse files Browse the repository at this point in the history
- Make eslint run clean for typedoc (still has other warnings/errors that I need to get back to)
- Ran eslint auto fix, which got some simple stuff like being able to use 'const' and the copyright header.

Fixes Azure#12948
  • Loading branch information
richardpark-msft authored Jan 5, 2021
1 parent ab74cfa commit 90f9d8e
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { sha256Digest, sha256Hmac } from "./internal/cryptoHelpers";

/**
* @internal
* @ignore
* @hidden
*/
export class AppConfigCredential implements ServiceClientCredentials {
private credential: string;
Expand All @@ -20,8 +20,8 @@ export class AppConfigCredential implements ServiceClientCredentials {
/**
* Signs a request with the values provided in the credential and secret parameter.
*
* @param {WebResource} webResource The WebResource to be signed.
* @returns {Promise<WebResource>} The signed request object.
* @param webResource - The WebResource to be signed.
* @returns The signed request object.
*/
async signRequest(webResource: WebResource): Promise<WebResource> {
const verb = webResource.method.toUpperCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const packageName = "azsdk-js-app-configuration";
* This constant should always be the same as the package.json's version - we use it when forming the
* User - Agent header. There's a unit test that makes sure it always stays in sync.
* @internal
* @ignore
* @hidden
*/
export const packageVersion = "1.1.1";
const apiVersion = "1.0";
Expand Down Expand Up @@ -102,7 +102,7 @@ export interface AppConfigurationClientOptions {
/**
* Provides internal configuration options for AppConfigurationClient.
* @internal
* @ignore
* @hidden
*/
export interface InternalAppConfigurationClientOptions extends AppConfigurationClientOptions {
/**
Expand All @@ -121,16 +121,16 @@ export class AppConfigurationClient {

/**
* Initializes a new instance of the AppConfigurationClient class.
* @param connectionString Connection string needed for a client to connect to Azure.
* @param options Options for the AppConfigurationClient.
* @param connectionString - Connection string needed for a client to connect to Azure.
* @param options - Options for the AppConfigurationClient.
*/
constructor(connectionString: string, options?: AppConfigurationClientOptions);
/**
* Initializes a new instance of the AppConfigurationClient class using
* a TokenCredential.
* @param endpoint The endpoint of the App Configuration service (ex: https://sample.azconfig.io).
* @param tokenCredential An object that implements the `TokenCredential` interface used to authenticate requests to the service. Use the @azure/identity package to create a credential that suits your needs.
* @param options Options for the AppConfigurationClient.
* @param endpoint - The endpoint of the App Configuration service (ex: https://sample.azconfig.io).
* @param tokenCredential - An object that implements the `TokenCredential` interface used to authenticate requests to the service. Use the \@azure/identity package to create a credential that suits your needs.
* @param options - Options for the AppConfigurationClient.
*/
constructor(
endpoint: string,
Expand Down Expand Up @@ -184,8 +184,8 @@ export class AppConfigurationClient {
* ```ts
* const result = await client.addConfigurationSetting({ key: "MyKey", label: "MyLabel", value: "MyValue" });
* ```
* @param configurationSetting A configuration setting.
* @param options Optional parameters for the request.
* @param configurationSetting - A configuration setting.
* @param options - Optional parameters for the request.
*/
addConfigurationSetting(
configurationSetting: AddConfigurationSettingParam,
Expand All @@ -211,8 +211,8 @@ export class AppConfigurationClient {
* ```ts
* const deletedSetting = await client.deleteConfigurationSetting({ key: "MyKey", label: "MyLabel" });
* ```
* @param id The id of the configuration setting to delete.
* @param options Optional parameters for the request (ex: etag, label)
* @param id - The id of the configuration setting to delete.
* @param options - Optional parameters for the request (ex: etag, label)
*/
deleteConfigurationSetting(
id: ConfigurationSettingId,
Expand All @@ -237,8 +237,8 @@ export class AppConfigurationClient {
* ```ts
* const setting = await client.getConfigurationSetting({ key: "MyKey", label: "MyLabel" });
* ```
* @param id The id of the configuration setting to get.
* @param options Optional parameters for the request.
* @param id - The id of the configuration setting to get.
* @param options - Optional parameters for the request.
*/
async getConfigurationSetting(
id: ConfigurationSettingId,
Expand Down Expand Up @@ -281,7 +281,7 @@ export class AppConfigurationClient {
* ```ts
* const allSettingsWithLabel = client.listConfigurationSettings({ labels: [ "MyLabel" ] });
* ```
* @param options Optional parameters for the request.
* @param options - Optional parameters for the request.
*/
listConfigurationSettings(
options: ListConfigurationSettingsOptions = {}
Expand Down Expand Up @@ -372,7 +372,7 @@ export class AppConfigurationClient {
* ```ts
* const revisionsIterator = client.listRevisions({ keys: ["MyKey"] });
* ```
* @param options Optional parameters for the request.
* @param options - Optional parameters for the request.
*/
listRevisions(
options?: ListRevisionsOptions
Expand Down Expand Up @@ -446,9 +446,9 @@ export class AppConfigurationClient {

/**
* Sets the value of a key in the Azure App Configuration service, allowing for an optional etag.
* @param key The name of the key.
* @param configurationSetting A configuration value.
* @param options Optional parameters for the request.
* @param key - The name of the key.
* @param configurationSetting - A configuration value.
* @param options - Optional parameters for the request.
*
* Example code:
* ```ts
Expand All @@ -475,7 +475,7 @@ export class AppConfigurationClient {

/**
* Sets or clears a key's read-only status.
* @param id The id of the configuration setting to modify.
* @param id - The id of the configuration setting to modify.
*/
async setReadOnly(
id: ConfigurationSettingId,
Expand Down Expand Up @@ -509,7 +509,7 @@ export class AppConfigurationClient {
/**
* Gets the options for the generated AppConfigurationClient
* @internal
* @ignore
* @hidden
*/
export function getGeneratedClientOptions(
baseUri: string,
Expand Down Expand Up @@ -545,7 +545,7 @@ export function getGeneratedClientOptions(

/**
* @internal
* @ignore
* @hidden
*/
export function getUserAgentPrefix(userSuppliedUserAgent: string | undefined): string {
const appConfigDefaultUserAgent = `${packageName}/${packageVersion} ${getCoreHttpDefaultUserAgentValue()}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @internal
* @ignore
* @hidden
*/
export async function sha256Digest(body: string | undefined): Promise<string> {
const digest = await self.crypto.subtle.digest("SHA-256", new TextEncoder().encode(body || ""));
Expand All @@ -17,7 +17,7 @@ export async function sha256Digest(body: string | undefined): Promise<string> {

/**
* @internal
* @ignore
* @hidden
*/
export async function sha256Hmac(secret: string, stringToSign: string): Promise<string> {
const key = await self.crypto.subtle.importKey(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createHash, createHmac } from "crypto";

/**
* @internal
* @ignore
* @hidden
*/
export async function sha256Digest(body: string | undefined): Promise<string> {
return createHash("sha256")
Expand All @@ -15,7 +15,7 @@ export async function sha256Digest(body: string | undefined): Promise<string> {

/**
* @internal
* @ignore
* @hidden
*/
export async function sha256Hmac(secret: string, stringToSign: string): Promise<string> {
const decodedSecret = Buffer.from(secret, "base64");
Expand Down
26 changes: 13 additions & 13 deletions sdk/appconfiguration/app-configuration/src/internal/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AppConfigurationGetKeyValuesOptionalParams, KeyValue } from "../generat
/**
* Formats the etag so it can be used with a If-Match/If-None-Match header
* @internal
* @ignore
* @hidden
*/
export function quoteETag(etag: string | undefined): string | undefined {
// https://tools.ietf.org/html/rfc7232#section-3.1
Expand All @@ -39,9 +39,9 @@ export function quoteETag(etag: string | undefined): string | undefined {
/**
* Checks the onlyIfChanged/onlyIfUnchanged properties to make sure we haven't specified both
* and throws an Error. Otherwise, returns the properties properly quoted.
* @param options An options object with onlyIfChanged/onlyIfUnchanged fields
* @param options - An options object with onlyIfChanged/onlyIfUnchanged fields
* @internal
* @ignore
* @hidden
*/
export function checkAndFormatIfAndIfNoneMatch(
configurationSetting: ConfigurationSettingId,
Expand Down Expand Up @@ -73,7 +73,7 @@ export function checkAndFormatIfAndIfNoneMatch(
* into the format the REST call will need.
*
* @internal
* @ignore
* @hidden
*/
export function formatWildcards(
listConfigOptions: ListConfigurationSettingsOptions | ListRevisionsOptions
Expand Down Expand Up @@ -106,9 +106,9 @@ export function formatWildcards(

/**
* Handles translating a Date acceptDateTime into a string as needed by the API
* @param newOptions A newer style options with acceptDateTime as a date (and with proper casing!)
* @param newOptions - A newer style options with acceptDateTime as a date (and with proper casing!)
* @internal
* @ignore
* @hidden
*/
export function formatAcceptDateTime(newOptions: {
acceptDateTime?: Date;
Expand All @@ -122,11 +122,11 @@ export function formatAcceptDateTime(newOptions: {
* Take the URL that gets returned from next link and extract the 'after' token needed
* to get the next page of results.
* @internal
* @ignore
* @hidden
*/
export function extractAfterTokenFromNextLink(nextLink: string) {
let parsedLink = URLBuilder.parse(nextLink);
let afterToken = parsedLink.getQueryParameterValue("after");
const parsedLink = URLBuilder.parse(nextLink);
const afterToken = parsedLink.getQueryParameterValue("after");

if (afterToken == null || Array.isArray(afterToken)) {
throw new Error("Invalid nextLink - invalid after token");
Expand All @@ -140,7 +140,7 @@ export function extractAfterTokenFromNextLink(nextLink: string) {
* to prevent possible errors by the user in accessing a model that is uninitialized. This can happen
* in cases like HTTP status code 204 or 304, which return an empty response body.
*
* @param configurationSetting The configuration setting to alter
* @param configurationSetting - The configuration setting to alter
*/
export function makeConfigurationSettingEmpty(
configurationSetting: Partial<Record<Exclude<keyof ConfigurationSetting, "key">, any>>
Expand All @@ -161,8 +161,8 @@ export function makeConfigurationSettingEmpty(
}

/**
* @ignore
* @internal
* @hidden
*/
export function transformKeyValue(kvp: KeyValue): ConfigurationSetting {
const obj: ConfigurationSetting & KeyValue = {
Expand All @@ -175,8 +175,8 @@ export function transformKeyValue(kvp: KeyValue): ConfigurationSetting {
}

/**
* @ignore
* @internal
* @hidden
*/
export function transformKeyValueResponseWithStatusCode<
T extends KeyValue & HttpResponseField<any>
Expand All @@ -190,8 +190,8 @@ export function transformKeyValueResponseWithStatusCode<
}

/**
* @ignore
* @internal
* @hidden
*/
export function transformKeyValueResponse<
T extends KeyValue & { eTag?: string } & HttpResponseField<any>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Licensed under the MIT license.

import {
RequestPolicy,
Expand All @@ -14,15 +14,15 @@ import {
* The sync token header, as described here:
* https://github.com/Azure/AppConfiguration/blob/master/docs/REST/consistency.md
* @internal
* @ignore
* @hidden
*/
export const SyncTokenHeaderName = "sync-token";

/**
* A policy factory for injecting sync tokens properly into outgoing requests.
* @param syncTokens
* @param syncTokens - the sync tokens store to be used across requests.
* @internal
* @ignore
* @hidden
*/
export function syncTokenPolicy(syncTokens: SyncTokens): RequestPolicyFactory {
return {
Expand Down Expand Up @@ -62,7 +62,7 @@ class SyncTokenPolicy extends BaseRequestPolicy {
* https://github.com/Azure/AppConfiguration/blob/master/docs/REST/consistency.md
*
* @internal
* @ignore
* @hidden
*/
export class SyncTokens {
private _currentSyncTokens = new Map<string, SyncToken>();
Expand All @@ -76,7 +76,7 @@ export class SyncTokens {
* If given an empty value (or undefined) it clears the current list of sync tokens.
* (indicates the service has properly absorbed values into the cluster).
*
* @param syncTokenHeaderValue The full value of the sync token header.
* @param syncTokenHeaderValue - The full value of the sync token header.
*/
addSyncTokenFromHeaderValue(syncTokenHeaderValue: string | undefined) {
if (syncTokenHeaderValue == null || syncTokenHeaderValue === "") {
Expand Down Expand Up @@ -137,10 +137,10 @@ interface SyncToken {
/**
* Parses a single sync token into it's constituent parts.
*
* @param syncToken A single sync token.
* @param syncToken - A single sync token.
*
* @internal
* @ignore
* @hidden
*/
export function parseSyncToken(syncToken: string): SyncToken {
const matches = syncToken.match(syncTokenRegex);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Licensed under the MIT license.

import { getTracer } from "@azure/core-tracing";
import { Span, SpanKind, CanonicalCode } from "@opentelemetry/api";
Expand All @@ -9,26 +9,26 @@ import { RestError } from "@azure/core-http";

/**
* @internal
* @ignore
* @hidden
*/
export interface Spannable {
spanOptions?: SpanOptions;
}

/**
* @internal
* @ignore
* @hidden
*/
export class Spanner<TClient> {
constructor(private baseOperationName: string) {}

/**
* Traces an operation and properly handles reporting start, end and errors for a given span
*
* @param operationName Name of a method in the TClient type
* @param options An options class, typically derived from @azure/core-http/RequestOptionsBase
* @param fn The function to call with an options class that properly propagates the span context
* @param translateToCanonicalCodeFn An optional function to translate thrown errors into a CanonicalCode for the span
* @param operationName - Name of a method in the TClient type
* @param options - An options class, typically derived from \@azure/core-http/RequestOptionsBase
* @param fn - The function to call with an options class that properly propagates the span context
* @param translateToCanonicalCodeFn - An optional function to translate thrown errors into a CanonicalCode for the span
*/
async trace<OptionsT extends Spannable, ReturnT>(
operationName: keyof TClient,
Expand Down
4 changes: 2 additions & 2 deletions sdk/appconfiguration/app-configuration/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export interface ListSettingsOptions extends OptionalFields {
* | abc* | Matches key names that start with abc |
*
* These characters are reserved and must be prefixed with backslash in order
* to be specified: * or \ or ,
* to be specified: * or \\ or ,
*/
keyFilter?: string;

Expand All @@ -262,7 +262,7 @@ export interface ListSettingsOptions extends OptionalFields {
* | prod* | Matches key with label names that start with prod |
*
* These characters are reserved and must be prefixed with backslash in order
* to be specified: * or \ or ,
* to be specified: * or \\ or ,
*/
labelFilter?: string;
}
Expand Down
Loading

0 comments on commit 90f9d8e

Please sign in to comment.