Skip to content

Commit 79be62c

Browse files
committed
feat(eslint): Make class member accessibility explicit
Add @typescript-eslint/explicit-member-accessibility rule to make sure class members declarations have explicit accessibility (public, private, protected).
1 parent 6c5cd37 commit 79be62c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/eslint-config-sdk/src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ module.exports = {
104104
// instead of any. This is especially important for methods that expose a public API, as users
105105
// should know exactly what they have to provide to use those methods. Turned off in tests.
106106
'@typescript-eslint/no-unsafe-member-access': 'error',
107+
108+
// Be explicit about class member accessibility (public, private, protected)
109+
'@typescript-eslint/explicit-member-accessibility': ['error'],
107110
},
108111
},
109112
{

packages/hub/src/session.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ export class Session implements SessionInterface {
1818
public ipAddress?: string;
1919
public init: boolean = true;
2020

21-
constructor(context?: Omit<SessionContext, 'started' | 'status'>) {
21+
public constructor(context?: Omit<SessionContext, 'started' | 'status'>) {
2222
if (context) {
2323
this.update(context);
2424
}
2525
}
2626

2727
/** JSDoc */
2828
// eslint-disable-next-line complexity
29-
update(context: SessionContext = {}): void {
29+
public update(context: SessionContext = {}): void {
3030
if (context.user) {
3131
if (context.user.ip_address) {
3232
this.ipAddress = context.user.ip_address;
@@ -78,7 +78,7 @@ export class Session implements SessionInterface {
7878
}
7979

8080
/** JSDoc */
81-
close(status?: Exclude<SessionStatus, SessionStatus.Ok>): void {
81+
public close(status?: Exclude<SessionStatus, SessionStatus.Ok>): void {
8282
if (status) {
8383
this.update({ status });
8484
} else if (this.status === SessionStatus.Ok) {
@@ -89,7 +89,7 @@ export class Session implements SessionInterface {
8989
}
9090

9191
/** JSDoc */
92-
toJSON(): {
92+
public toJSON(): {
9393
init: boolean;
9494
sid: string;
9595
did?: string;

0 commit comments

Comments
 (0)