Skip to content

Update linting rule to enforce to use semicolon #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
{
"max": 1
}
]
],
"semi": ["error", "always"]
}
}
2 changes: 1 addition & 1 deletion src/AzureAppConfigurationImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
if (index >= 0) {
this.#onRefreshListeners.splice(index, 1);
}
}
};
return new Disposable(remove);
}

Expand Down
2 changes: 1 addition & 1 deletion src/JsonKeyValueAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ function isJsonContentType(contentTypeValue: string): boolean {
}

return typeParts[1].split("+").includes("json");
}
}
2 changes: 1 addition & 1 deletion src/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getClientOptions(options?: AzureAppConfigurationOptions): AppConfigurat
const defaultRetryOptions = {
maxRetries: MaxRetries,
maxRetryDelayInMs: MaxRetryDelayInMs,
}
};
const retryOptions = Object.assign({}, defaultRetryOptions, options?.clientOptions?.retryOptions);

return Object.assign({}, options?.clientOptions, {
Expand Down
4 changes: 2 additions & 2 deletions src/requestTracing/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function listConfigurationSettingsWithTrace(
customHeaders: {
[CORRELATION_CONTEXT_HEADER_NAME]: createCorrelationContextHeader(appConfigOptions, initialLoadCompleted)
}
}
};
}

return client.listConfigurationSettings(actualListOptions);
Expand All @@ -64,7 +64,7 @@ export function getConfigurationSettingWithTrace(
customHeaders: {
[CORRELATION_CONTEXT_HEADER_NAME]: createCorrelationContextHeader(appConfigOptions, initialLoadCompleted)
}
}
};
}

return client.getConfigurationSetting(configurationSettingId, actualGetOptions);
Expand Down
10 changes: 5 additions & 5 deletions test/clientOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("custom client options", function () {

afterEach(() => {
nock.restore();
})
});

it("should retry 2 times by default", async () => {
const countPolicy = new HttpRequestCountPolicy();
Expand All @@ -49,7 +49,7 @@ describe("custom client options", function () {
position: "perRetry"
}]
}
})
});
};
let error;
try {
Expand All @@ -74,7 +74,7 @@ describe("custom client options", function () {
maxRetries
}
}
})
});
};

let error;
Expand Down Expand Up @@ -109,7 +109,7 @@ describe("custom client options", function () {
position: "perRetry"
}]
}
})
});
};
let error;
try {
Expand All @@ -120,4 +120,4 @@ describe("custom client options", function () {
expect(error).not.undefined;
expect(countPolicy.count).eq(3);
});
})
});
3 changes: 2 additions & 1 deletion test/featureFlag.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ describe("feature flags", function () {

after(() => {
restoreMocks();
})
});

it("should load feature flags if enabled", async () => {
const connectionString = createMockedConnectionString();
const settings = await load(connectionString, {
Expand Down
4 changes: 2 additions & 2 deletions test/json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("json", function () {

afterEach(() => {
restoreMocks();
})
});

it("should load and parse if content type is application/json", async () => {
mockAppConfigurationClientListConfigurationSettings([jsonKeyValue]);
Expand Down Expand Up @@ -86,4 +86,4 @@ describe("json", function () {
expect(settings.get("json.settings.emptyString")).eq("", "is empty string");
expect(settings.get("json.settings.illegalString")).eq("[unclosed", "is illegal string");
});
})
});
2 changes: 1 addition & 1 deletion test/keyvault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ describe("key vault reference", function () {
expect(settings.get("TestKey")).eq("SecretValue");
expect(settings.get("TestKey2")).eq("SecretValue2");
});
})
});
3 changes: 2 additions & 1 deletion test/load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ describe("load", function () {

after(() => {
restoreMocks();
})
});

it("should load data from config store with connection string", async () => {
const connectionString = createMockedConnectionString();
const settings = await load(connectionString);
Expand Down
8 changes: 4 additions & 4 deletions test/refresh.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ describe("dynamic refresh", function () {
{ value: "30", key: "app.settings.fontSize", label: "prod" }
].map(createMockedKeyValue);
mockAppConfigurationClientListConfigurationSettings(mockedKVs);
mockAppConfigurationClientGetConfigurationSetting(mockedKVs)
mockAppConfigurationClientGetConfigurationSetting(mockedKVs);
});

afterEach(() => {
restoreMocks();
})
});

it("should throw error when refresh is not enabled but refresh is called", async () => {
const connectionString = createMockedConnectionString();
Expand Down Expand Up @@ -331,14 +331,14 @@ describe("dynamic refresh feature flags", function () {

afterEach(() => {
restoreMocks();
})
});

it("should refresh feature flags when enabled", async () => {
mockedKVs = [
createMockedFeatureFlag("Beta", { enabled: true })
];
mockAppConfigurationClientListConfigurationSettings(mockedKVs);
mockAppConfigurationClientGetConfigurationSetting(mockedKVs)
mockAppConfigurationClientGetConfigurationSetting(mockedKVs);

const connectionString = createMockedConnectionString();
const settings = await load(connectionString, {
Expand Down
2 changes: 1 addition & 1 deletion test/requestTracing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("request tracing", function () {
});

after(() => {
})
});

it("should have correct user agent prefix", async () => {
try {
Expand Down
12 changes: 6 additions & 6 deletions test/utils/testHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function _filterKVs(unfilteredKvs: ConfigurationSetting[], listOptions: any) {
labelMatched = kv.label === labelFilter;
}
return keyMatched && labelMatched;
})
});
}

/**
Expand Down Expand Up @@ -86,7 +86,7 @@ function mockAppConfigurationClientListConfigurationSettings(...pages: Configura
});
}
}
}
};
}
};

Expand Down Expand Up @@ -126,7 +126,7 @@ function mockSecretClientGetSecret(uriValueList: [string, string][]) {
name: secretName,
value: dict.get(url.toString())
} as KeyVaultSecret;
})
});
}

function restoreMocks() {
Expand All @@ -139,11 +139,11 @@ const createMockedConnectionString = (endpoint = createMockedEndpoint(), secret
const toEncodeAsBytes = Buffer.from(secret);
const returnValue = toEncodeAsBytes.toString("base64");
return `Endpoint=${endpoint};Id=${id};Secret=${returnValue}`;
}
};

const createMockedTokenCredential = (tenantId = TEST_TENANT_ID, clientId = TEST_CLIENT_ID, clientSecret = TEST_CLIENT_SECRET) => {
return new ClientSecretCredential(tenantId, clientId, clientSecret);
}
};

const createMockedKeyVaultReference = (key: string, vaultUri: string): ConfigurationSetting => ({
// https://${vaultName}.vault.azure.net/secrets/${secretName}
Expand Down Expand Up @@ -210,4 +210,4 @@ export {
createMockedFeatureFlag,

sleepInMs
}
};
Loading