Skip to content

Commit 1cdb716

Browse files
committed
Fix lint errors
- Fix import order in FeatureFlagCache - Replace require() with import for driverVersion - Fix variable shadowing - Disable prefer-default-export for urlUtils
1 parent a105777 commit 1cdb716

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

lib/telemetry/FeatureFlagCache.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17+
import fetch from 'node-fetch';
1718
import IClientContext from '../contracts/IClientContext';
1819
import { LogLevel } from '../contracts/IDBSQLLogger';
19-
import fetch from 'node-fetch';
20+
import driverVersion from '../version';
2021
import { buildUrl } from './urlUtils';
2122

2223
/**
@@ -117,10 +118,10 @@ export default class FeatureFlagCache {
117118

118119
try {
119120
// Get driver version for endpoint
120-
const driverVersion = this.getDriverVersion();
121+
const version = this.getDriverVersion();
121122

122123
// Build feature flags endpoint for Node.js driver
123-
const endpoint = buildUrl(host, `/api/2.0/connector-service/feature-flags/NODEJS/${driverVersion}`);
124+
const endpoint = buildUrl(host, `/api/2.0/connector-service/feature-flags/NODEJS/${version}`);
124125

125126
// Get authentication headers
126127
const authHeaders = await this.context.getAuthHeaders();
@@ -187,14 +188,7 @@ export default class FeatureFlagCache {
187188
* Format: "1.12.0" from "1.12.0-oss"
188189
*/
189190
private getDriverVersion(): string {
190-
try {
191-
// Import version from lib/version.ts
192-
const version = require('../version').default;
193-
// Remove -oss suffix if present
194-
return version.replace(/-oss$/, '');
195-
} catch (error) {
196-
// Fallback to a default version if import fails
197-
return '1.0.0';
198-
}
191+
// Remove -oss suffix if present
192+
return driverVersion.replace(/-oss$/, '');
199193
}
200194
}

lib/telemetry/urlUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* @param path The path to append (should start with /)
2121
* @returns Full URL with protocol
2222
*/
23+
// eslint-disable-next-line import/prefer-default-export
2324
export function buildUrl(host: string, path: string): string {
2425
// Check if host already has protocol
2526
if (host.startsWith('http://') || host.startsWith('https://')) {

0 commit comments

Comments
 (0)