Skip to content

Commit 0435fc9

Browse files
committed
Fix lint issues
1 parent dc40447 commit 0435fc9

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

example/src/App.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
Pusher,
1616
PusherMember,
1717
PusherChannel,
18-
PusherEvent
18+
PusherEvent,
1919
} from 'pusher-websocket-react-native';
2020

2121
export default function App() {
@@ -44,6 +44,8 @@ export default function App() {
4444
onChangeEventData((await AsyncStorage.getItem('DATA')) || '');
4545
};
4646
getFromStorage().catch((e) => log('ERROR: ' + e));
47+
48+
// eslint-disable-next-line react-hooks/exhaustive-deps
4749
}, []);
4850

4951
const connect = async () => {
@@ -80,7 +82,9 @@ export default function App() {
8082
currentState: string,
8183
previousState: string
8284
) => {
83-
log(`onConnectionStateChange. previousState=${previousState} newState=${currentState}`);
85+
log(
86+
`onConnectionStateChange. previousState=${previousState} newState=${currentState}`
87+
);
8488
};
8589

8690
const onError = (message: string, code: Number, error: any) => {
@@ -101,7 +105,11 @@ export default function App() {
101105
log(`Me: ${me}`);
102106
};
103107

104-
const onSubscriptionError = (channelName: string, message: string, e: any) => {
108+
const onSubscriptionError = (
109+
channelName: string,
110+
message: string,
111+
e: any
112+
) => {
105113
log(`onSubscriptionError: ${message}, channelName: ${channelName} e: ${e}`);
106114
};
107115

@@ -174,7 +182,7 @@ export default function App() {
174182
<Button
175183
title="Connect"
176184
onPress={connect}
177-
disabled={!Boolean(apiKey && cluster && channelName)}
185+
disabled={!(apiKey && cluster && channelName)}
178186
/>
179187
</>
180188
) : (
@@ -207,7 +215,7 @@ export default function App() {
207215
<Button
208216
title="Trigger Event"
209217
onPress={trigger}
210-
disabled={!Boolean(eventName)}
218+
disabled={!eventName}
211219
/>
212220
</>
213221
)}

scripts/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const options = {
1212
};
1313

1414
if (os.type() === 'Windows_NT') {
15-
options.shell = true
15+
options.shell = true;
1616
}
1717

1818
let result;

src/index.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class PusherChannel {
8484
}
8585

8686
async trigger(event: PusherEvent) {
87-
if (event.channelName != this.channelName) {
87+
if (event.channelName !== this.channelName) {
8888
throw 'Event is not for this channel';
8989
}
9090
return Pusher.getInstance().trigger(event);
@@ -129,7 +129,11 @@ export class Pusher {
129129
onError?: (message: string, code: Number, e: any) => void;
130130
onEvent?: (event: PusherEvent) => void;
131131
onSubscriptionSucceeded?: (channelName: string, data: any) => void;
132-
onSubscriptionError?: (channelName: string, message: string, e: any) => void;
132+
onSubscriptionError?: (
133+
channelName: string,
134+
message: string,
135+
e: any
136+
) => void;
133137
onDecryptionFailure?: (eventName: string, reason: string) => void;
134138
onMemberAdded?: (channelName: string, member: PusherMember) => void;
135139
onMemberRemoved?: (channelName: string, member: PusherMember) => void;
@@ -161,7 +165,7 @@ export class Pusher {
161165
const userInfo = decodedData?.presence?.hash[_userId];
162166
var member = new PusherMember(_userId, userInfo);
163167
channel?.members.set(member.userId, member);
164-
if (_userId == userId) {
168+
if (_userId === userId) {
165169
channel!.me = member;
166170
}
167171
}
@@ -207,9 +211,12 @@ export class Pusher {
207211
}
208212
});
209213

210-
this.addListener('onSubscriptionError', async ({ channelName, message, type }) => {
211-
args.onSubscriptionError?.(channelName, message, type);
212-
});
214+
this.addListener(
215+
'onSubscriptionError',
216+
async ({ channelName, message, type }) => {
217+
args.onSubscriptionError?.(channelName, message, type);
218+
}
219+
);
213220

214221
return PusherWebsocketReactNative.initialize({
215222
apiKey: args.apiKey,
@@ -236,7 +243,11 @@ export class Pusher {
236243
async subscribe(args: {
237244
channelName: string;
238245
onSubscriptionSucceeded?: (data: any) => void;
239-
onSubscriptionError?: (channelName: string, message: string, e: any) => void;
246+
onSubscriptionError?: (
247+
channelName: string,
248+
message: string,
249+
e: any
250+
) => void;
240251
onMemberAdded?: (member: PusherMember) => void;
241252
onMemberRemoved?: (member: PusherMember) => void;
242253
onEvent?: (event: PusherEvent) => void;

0 commit comments

Comments
 (0)