Skip to content

chore: enable some eslint rules #426

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 1 commit into from
Aug 6, 2025
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
4 changes: 4 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default defineConfig([
rules: {
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/no-non-null-assertion": "error",
eqeqeq: "error",
"no-self-compare": "error",
"no-unassigned-vars": "error",
Copy link
Preview

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ESLint rule name has a typo. It should be "no-unused-vars" instead of "no-unassigned-vars".

Suggested change
"no-unassigned-vars": "error",
"no-unused-vars": "error",

Copilot uses AI. Check for mistakes.

"@typescript-eslint/await-thenable": "error",
},
},
globalIgnores([
Expand Down
5 changes: 4 additions & 1 deletion src/common/atlas/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ApiClient {
private isAccessTokenValid(): boolean {
return !!(
this.accessToken &&
this.accessToken.expires_at != undefined &&
this.accessToken.expires_at !== undefined &&
this.accessToken.expires_at > Date.now()
);
}
Expand Down Expand Up @@ -89,6 +89,7 @@ export class ApiClient {
return request;
} catch {
// ignore not availble tokens, API will return 401
return undefined;
}
},
};
Expand Down Expand Up @@ -183,6 +184,8 @@ export class ApiClient {
}
return this.accessToken;
}

return undefined;
}

public async validateAccessToken(): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions src/common/atlas/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export function formatCluster(cluster: ClusterDescription20240805): Cluster {
});

const instanceSize = regionConfigs[0]?.instanceSize ?? "UNKNOWN";
const clusterInstanceType = instanceSize == "M0" ? "FREE" : "DEDICATED";
const clusterInstanceType = instanceSize === "M0" ? "FREE" : "DEDICATED";

return {
name: cluster.name,
instanceType: clusterInstanceType,
instanceSize: clusterInstanceType == "DEDICATED" ? instanceSize : undefined,
instanceSize: clusterInstanceType === "DEDICATED" ? instanceSize : undefined,
state: cluster.stateName,
mongoDBVersion: cluster.mongoDBVersion,
connectionString: cluster.connectionStrings?.standardSrv || cluster.connectionStrings?.standard,
Expand Down
8 changes: 4 additions & 4 deletions src/tools/atlas/connect/connectCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export class ConnectClusterTool extends AtlasToolBase {
for (let i = 0; i < 600; i++) {
if (
!this.session.connectedAtlasCluster ||
this.session.connectedAtlasCluster.projectId != projectId ||
this.session.connectedAtlasCluster.clusterName != clusterName
this.session.connectedAtlasCluster.projectId !== projectId ||
this.session.connectedAtlasCluster.clusterName !== clusterName
) {
throw new Error("Cluster connection aborted");
}
Expand All @@ -164,8 +164,8 @@ export class ConnectClusterTool extends AtlasToolBase {

if (lastError) {
if (
this.session.connectedAtlasCluster?.projectId == projectId &&
this.session.connectedAtlasCluster?.clusterName == clusterName &&
this.session.connectedAtlasCluster?.projectId === projectId &&
this.session.connectedAtlasCluster?.clusterName === clusterName &&
this.session.connectedAtlasCluster?.username
) {
void this.session.apiClient
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"skipLibCheck": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"typeRoots": ["./node_modules/@types", "./src/types"]
"typeRoots": ["./node_modules/@types", "./src/types"],
"noImplicitReturns": true
},
"include": ["src/**/*.ts"]
}
Loading