Skip to content

Commit fdd2ce3

Browse files
fix eslint error
1 parent fed0623 commit fdd2ce3

18 files changed

+164
-37
lines changed

eslint.config.mjs

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import globals from "globals";
4+
import tsParser from "@typescript-eslint/parser";
5+
import path from "node:path";
6+
import { fileURLToPath } from "node:url";
7+
import js from "@eslint/js";
8+
import { FlatCompat } from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all
16+
});
17+
18+
export default defineConfig([globalIgnores([
19+
"node_modules/**",
20+
"dist/**",
21+
"dist-esm/**",
22+
"types/**",
23+
"*.min.js",
24+
"coverage/**"
25+
]), {
26+
extends: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
27+
28+
plugins: {
29+
"@typescript-eslint": typescriptEslint,
30+
},
31+
32+
languageOptions: {
33+
globals: {
34+
...globals.browser,
35+
...globals.commonjs,
36+
...globals.node,
37+
...globals.mocha,
38+
},
39+
40+
parser: tsParser,
41+
ecmaVersion: "latest",
42+
sourceType: "commonjs",
43+
},
44+
45+
rules: {
46+
"keyword-spacing": ["error", {
47+
before: true,
48+
after: true,
49+
}],
50+
51+
quotes: ["error", "double", {
52+
avoidEscape: true,
53+
}],
54+
55+
"@typescript-eslint/no-explicit-any": "off",
56+
"eol-last": ["error", "always"],
57+
"no-trailing-spaces": "error",
58+
"space-before-blocks": ["error", "always"],
59+
"no-multi-spaces": "error",
60+
61+
"no-multiple-empty-lines": ["error", {
62+
max: 1,
63+
}],
64+
65+
semi: ["error", "always"],
66+
},
67+
}, {
68+
files: ["**/.eslintrc.{js,cjs}"],
69+
70+
languageOptions: {
71+
globals: {
72+
...globals.node,
73+
},
74+
75+
ecmaVersion: 5,
76+
sourceType: "commonjs",
77+
},
78+
}]);

examples/console-app/refresh.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const settings = await load(connectionString, {
3232

3333
console.log("Using Azure portal or CLI, update the `app.settings.message` value, and then update the `app.settings.sentinel` value in your App Configuration store.");
3434

35-
// eslint-disable-next-line no-constant-condition
3635
while (true) {
3736
// this is a blocking call and you can remove await to make the refresh operation asynchronous
3837
await settings.refresh();

package-lock.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "The JavaScript configuration provider for Azure App Configuration",
55
"main": "dist/index.js",
66
"module": "./dist-esm/index.js",
7+
"type": "module",
78
"types": "types/index.d.ts",
89
"files": [
910
"dist/**/*.js",
@@ -23,9 +24,9 @@
2324
"build-test": "tsc -p ./tsconfig.test.json",
2425
"clean": "rimraf dist dist-esm out types",
2526
"dev": "rollup --config --watch",
26-
"lint": "eslint src/ test/ examples/ --ext .js,.ts,.mjs,.cjs",
27-
"fix-lint": "eslint src/ test/ examples/ --fix --ext .js,.ts,.mjs,.cjs",
28-
"test": "mocha out/test/*.test.{js,cjs,mjs} --parallel"
27+
"lint": "eslint src/ test/ examples/ --ext .js,.ts,.mjs",
28+
"fix-lint": "eslint src/ test/ examples/ --fix --ext .js,.ts,.mjs",
29+
"test": "mocha out/test/*.test.js --parallel"
2930
},
3031
"repository": {
3132
"type": "git",
@@ -34,6 +35,8 @@
3435
"license": "MIT",
3536
"devDependencies": {
3637
"@rollup/plugin-typescript": "^11.1.6",
38+
"@types/chai": "^5.2.2",
39+
"@types/chai-as-promised": "8.0.2",
3740
"@types/mocha": "^10.0.10",
3841
"@types/node": "^22.18.0",
3942
"@types/sinon": "^17.0.4",

src/appConfigurationImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
424424
// get feature management package version
425425
const fmPackage = await import(FM_PACKAGE_NAME);
426426
this.#fmVersion = fmPackage?.VERSION;
427-
} catch (error) {
427+
} catch {
428428
// ignore the error
429429
}
430430
}

src/requestTracing/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
DELIMITER,
4343
AI_CONFIGURATION_TAG,
4444
AI_CHAT_COMPLETION_CONFIGURATION_TAG
45-
} from "./constants";
45+
} from "./constants.js";
4646

4747
export interface RequestTracingOptions {
4848
enabled: boolean;

test/clientOptions.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4+
/* eslint-disable @typescript-eslint/no-unused-expressions */
45
import * as chai from "chai";
56
import chaiAsPromised from "chai-as-promised";
67
chai.use(chaiAsPromised);
@@ -130,3 +131,4 @@ describe("custom client options", function () {
130131
expect(countPolicy.count).eq(3);
131132
});
132133
});
134+
/* eslint-enable @typescript-eslint/no-unused-expressions */

test/exportedApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
export { load } from "../src";
4+
export { load } from "../src/index.js";

test/failover.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4+
/* eslint-disable @typescript-eslint/no-unused-expressions */
45
import * as chai from "chai";
56
import chaiAsPromised from "chai-as-promised";
67
chai.use(chaiAsPromised);
78
const expect = chai.expect;
8-
import { load } from "./exportedApi";
9-
import { MAX_TIME_OUT, createMockedConnectionString, createMockedFeatureFlag, createMockedKeyValue, mockConfigurationManagerGetClients, restoreMocks } from "./utils/testHelper";
10-
import { getValidDomain, isValidEndpoint } from "../src/configurationClientManager";
9+
import { load } from "./exportedApi.js";
10+
import { MAX_TIME_OUT, createMockedConnectionString, createMockedFeatureFlag, createMockedKeyValue, mockConfigurationManagerGetClients, restoreMocks } from "./utils/testHelper.js";
11+
import { getValidDomain, isValidEndpoint } from "../src/configurationClientManager.js";
1112

1213
const mockedKVs = [{
1314
key: "app.settings.fontColor",
@@ -102,3 +103,4 @@ describe("failover", function () {
102103
expect(isValidEndpoint("foobar.appconfig.azure.com", validDomain4)).to.be.false;
103104
});
104105
});
106+
/* eslint-enable @typescript-eslint/no-unused-expressions */

test/featureFlag.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4+
/* eslint-disable @typescript-eslint/no-unused-expressions */
45
import * as chai from "chai";
56
import chaiAsPromised from "chai-as-promised";
67
import { featureFlagContentType } from "@azure/app-configuration";
@@ -434,3 +435,4 @@ describe("feature flags", function () {
434435
restoreMocks();
435436
});
436437
});
438+
/* eslint-enable @typescript-eslint/no-unused-expressions */

0 commit comments

Comments
 (0)