Skip to content

Commit 6dc9330

Browse files
committed
fix: lint
1 parent 86bbcb6 commit 6dc9330

9 files changed

Lines changed: 9480 additions & 13187 deletions

File tree

example/src/App.tsx

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import * as React from 'react';
22

3-
import {Button, Linking, StyleSheet, Text, View} from 'react-native';
4-
import {Bugfender, LogLevel, SDKOptionsBuilder} from '@bugfender/rn-bugfender';
3+
import { Button, Linking, StyleSheet, Text, View } from 'react-native';
4+
import {
5+
Bugfender,
6+
LogLevel,
7+
SDKOptionsBuilder,
8+
} from '@bugfender/rn-bugfender';
59

610
export default function App() {
7-
811
// Add a "bugfenderKey.json" containing { "bugfenderKey : "YOUR_APP_KEY" }
912
// Or delete this line and hardcode your key in Bugfender.init("YOUR_APP_KEY")
1013
const key = require('./bugfenderKey.json').bugfenderKey;
@@ -36,34 +39,29 @@ export default function App() {
3639

3740
return (
3841
<View style={styles.container}>
39-
<Text style={styles.welcome}>
40-
Welcome to RN Bugfender Example!
41-
</Text>
42+
<Text style={styles.welcome}>Welcome to RN Bugfender Example!</Text>
4243
<Text style={styles.instructions}>
43-
This application sends directly logs to the server if you push "Send Logs" button.
44+
This application sends directly logs to the server if you push "Send
45+
Logs" button.
4446
</Text>
4547
<Text style={styles.instructions}>
46-
Pressing "Generate JS Crash" the application will crash due to a JavaScript error and the crash information
47-
will be sent to the server. This won't work on debug builds as LogBox will capture the error.
48+
Pressing "Generate JS Crash" the application will crash due to a
49+
JavaScript error and the crash information will be sent to the server.
50+
This won't work on debug builds as LogBox will capture the error.
4851
</Text>
4952
<Text style={styles.instructions}>
50-
Pressing "Show Native User Feedback" a native screen for sending feedback will be shown.
53+
Pressing "Show Native User Feedback" a native screen for sending
54+
feedback will be shown.
5155
</Text>
5256
<Text style={styles.instructions}>
5357
Double tap R on your keyboard to reload,{'\n'}
5458
Shake or press menu button for dev menu
5559
</Text>
5660
<View style={styles.button}>
57-
<Button
58-
onPress={_onPressButton}
59-
title="Send logs"
60-
/>
61+
<Button onPress={_onPressButton} title="Send logs" />
6162
</View>
6263
<View style={styles.button}>
63-
<Button
64-
onPress={_generateError}
65-
title="Generate JS crash"
66-
/>
64+
<Button onPress={_generateError} title="Generate JS crash" />
6765
</View>
6866
<View style={styles.button}>
6967
<Button
@@ -78,16 +76,10 @@ export default function App() {
7876
/>
7977
</View>
8078
<View style={styles.button}>
81-
<Button
82-
onPress={_openDeviceURL}
83-
title="Open Device URL"
84-
/>
79+
<Button onPress={_openDeviceURL} title="Open Device URL" />
8580
</View>
8681
<View style={styles.button}>
87-
<Button
88-
onPress={_openSessionURL}
89-
title="Open Session URL"
90-
/>
82+
<Button onPress={_openSessionURL} title="Open Session URL" />
9183
</View>
9284
</View>
9385
);
@@ -103,16 +95,15 @@ export default function App() {
10395

10496
function _sendLogConsoleStyle(): void {
10597
Bugfender.sendLog({
106-
text: ['This is a console.* template: %s', 'value']
98+
text: ['This is a console.* template: %s', 'value'],
10799
});
108100

109101
Bugfender.sendLog({
110-
text: ['Just handles array of mixed values', true, 42, { foo: 'bar' }]
102+
text: ['Just handles array of mixed values', true, 42, { foo: 'bar' }],
111103
});
112104
}
113105

114106
async function _onPressButton(): Promise<void> {
115-
116107
Bugfender.sendLog({
117108
level: LogLevel.Debug,
118109
tag: 'REACT',
@@ -207,11 +198,13 @@ export default function App() {
207198
Bugfender.sendCrash('Crash title', 'Crash text').then((url) =>
208199
console.log('Crash url: %s', url)
209200
);
210-
Bugfender.sendUserFeedback('User feedback', 'User feedback message').then((url) =>
211-
console.log('Feedback url: %s', url)
201+
Bugfender.sendUserFeedback('User feedback', 'User feedback message').then(
202+
(url) => console.log('Feedback url: %s', url)
212203
);
213204
Bugfender.getDeviceURL().then((url) => console.log('Device url: %s', url));
214-
Bugfender.getSessionURL().then((url) => console.log('Session url: %s', url));
205+
Bugfender.getSessionURL().then((url) =>
206+
console.log('Session url: %s', url)
207+
);
215208

216209
Bugfender.forceSendOnce();
217210

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@
6060
"@react-native-community/eslint-config": "^3.2.0",
6161
"@release-it/conventional-changelog": "^5.1.1",
6262
"@types/jest": "^29.2.2",
63-
"@types/react": "~18.0.25",
64-
"@types/react-native": "0.70.6",
63+
"@types/react": "^18.2.19",
64+
"@types/react-native": "^0.72.2",
6565
"commitlint": "^17.2.0",
6666
"eslint": "^8.27.0",
6767
"eslint-config-prettier": "^8.5.0",
6868
"eslint-plugin-prettier": "^4.2.1",
6969
"jest": "^29.3.1",
7070
"pod-install": "^0.1.38",
7171
"prettier": "^2.7.1",
72-
"react": "18.1.0",
73-
"react-native": "0.70.6",
74-
"react-native-builder-bob": "^0.20.1",
72+
"react": "^18.2.0",
73+
"react-native": "^0.72.3",
74+
"react-native-builder-bob": "^0.21.3",
7575
"release-it": "^15.5.0",
7676
"typescript": "^4.8.4"
7777
},
@@ -115,7 +115,7 @@
115115
},
116116
"eslintConfig": {
117117
"root": true,
118-
"parser": "@babel/eslint-parser",
118+
"parser": "@typescript-eslint/parser",
119119
"extends": [
120120
"@react-native-community",
121121
"prettier"

src/NativeRnBugfender.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
2-
import {TurboModuleRegistry} from 'react-native';
3-
import type {Float,Int32} from 'react-native/Libraries/Types/CodegenTypes';
1+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
2+
import { TurboModuleRegistry } from 'react-native';
3+
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
44

55
export interface Spec extends TurboModule {
66
activateLogger(key: string): void;
@@ -25,14 +25,19 @@ export interface Spec extends TurboModule {
2525
debug(tag: string, text: string): void;
2626
warning(tag: string, text: string): void;
2727
error(tag: string, text: string): void;
28-
log(lineNumber: Int32, method: string, file: string, logLevel: Int32, tag: string, message: string): void;
28+
log(
29+
lineNumber: Int32,
30+
method: string,
31+
file: string,
32+
logLevel: Int32,
33+
tag: string,
34+
message: string
35+
): void;
2936
sendIssue(tag: string, text: string): Promise<string>;
3037
sendCrash(tag: string, text: string): Promise<string>;
3138
forceSendOnce(): void;
3239
sendUserFeedback(title: string, text: string): Promise<string>;
3340
showUserFeedback(title: string, text: string): Promise<string>;
3441
}
3542

36-
export default TurboModuleRegistry.get<Spec>(
37-
'RnBugfender',
38-
) as Spec | null;
43+
export default TurboModuleRegistry.get<Spec>('RnBugfender') as Spec | null;

src/bugfender.ts

Lines changed: 22 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import { NativeModules, Platform } from 'react-native';
2-
import { BugfenderFacade, DeviceKeyValue, LogEntry, LogLevel, PrintToConsole, UserFeedbackResult, format, formatLogEntryText } from '@bugfender/common';
2+
import {
3+
BugfenderFacade,
4+
DeviceKeyValue,
5+
LogEntry,
6+
LogLevel,
7+
PrintToConsole,
8+
UserFeedbackResult,
9+
format,
10+
formatLogEntryText,
11+
} from '@bugfender/common';
312
import type { ISDKOptions } from './types/sdk-options';
413
import type { UserFeedbackOptions } from './user-feedback';
514
import { DefaultUserFeedbackOptions } from './user-feedback';
@@ -14,13 +23,13 @@ const LINKING_ERROR =
1423
const RnBugfender = NativeModules.RnBugfender
1524
? NativeModules.RnBugfender
1625
: new Proxy(
17-
{},
18-
{
19-
get() {
20-
throw new Error(LINKING_ERROR);
21-
},
22-
}
23-
);
26+
{},
27+
{
28+
get() {
29+
throw new Error(LINKING_ERROR);
30+
},
31+
}
32+
);
2433

2534
class BugfenderClass implements BugfenderFacade {
2635
private overrideConsoleMethods =
@@ -48,7 +57,10 @@ class BugfenderClass implements BugfenderFacade {
4857
// region init
4958
Platform.OS === 'ios'
5059
? RnBugfender.activateLogger(validatedOptions.appKey)
51-
: RnBugfender.init(validatedOptions.appKey, validatedOptions.printToConsole ?? false);
60+
: RnBugfender.init(
61+
validatedOptions.appKey,
62+
validatedOptions.printToConsole ?? false
63+
);
5264

5365
if (validatedOptions.overrideConsoleMethods) {
5466
this.overrideConsoleMethods.init();
@@ -140,113 +152,41 @@ class BugfenderClass implements BugfenderFacade {
140152
});
141153
}
142154

143-
/**
144-
* @param obj A JavaScript value to output
145-
* @param objs List of optional JavaScript values to output
146-
*/
147-
public log(obj: unknown, ...objs: unknown[]): void;
148-
/**
149-
* String message with optional substitutions. This mimicks que the `window.console` template messages. [Learn more in MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
150-
*
151-
* @param msg Message with optional `%` placeholders
152-
* @param subst Optional substitutions list
153-
*/
154-
public log(msg: string, ...subst: unknown[]): void;
155155
public log(...parameters: unknown[]): void {
156156
this.printToConsole.log(...parameters);
157157

158158
let message = format([...parameters]);
159159
RnBugfender.debug('', message);
160160
}
161161

162-
/**
163-
* @param obj A JavaScript value to output
164-
* @param objs List of optional JavaScript values to output
165-
*/
166-
public warn(obj: unknown, ...objs: unknown[]): void;
167-
/**
168-
* String message with optional substitutions. This mimicks que the `window.console` template messages. [Learn more in MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
169-
*
170-
* @param msg Message with optional `%` placeholders
171-
* @param subst Optional substitutions list
172-
*/
173-
public warn(msg: string, ...subst: unknown[]): void;
174162
public warn(...parameters: unknown[]): void {
175163
this.printToConsole.warn(...parameters);
176164

177165
let message = format([...parameters]);
178166
RnBugfender.warning('', message);
179167
}
180168

181-
/**
182-
* @param obj A JavaScript value to output
183-
* @param objs List of optional JavaScript values to output
184-
*/
185-
public error(obj: unknown, ...objs: unknown[]): void;
186-
/**
187-
* String message with optional substitutions. This mimicks que the `window.console` template messages. [Learn more in MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
188-
*
189-
* @param msg Message with optional `%` placeholders
190-
* @param subst Optional substitutions list
191-
*/
192-
public error(msg: string, ...subst: unknown[]): void;
193169
public error(...parameters: unknown[]): void {
194170
this.printToConsole.error(...parameters);
195171

196172
let message = format([...parameters]);
197173
RnBugfender.error('', message);
198174
}
199175

200-
/**
201-
* @param obj A JavaScript value to output
202-
* @param objs List of optional JavaScript values to output
203-
*/
204-
public trace(obj: unknown, ...objs: unknown[]): void;
205-
/**
206-
* String message with optional substitutions. This mimicks que the `window.console` template messages. [Learn more in MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
207-
*
208-
* @param msg Message with optional `%` placeholders
209-
* @param subst Optional substitutions list
210-
*/
211-
public trace(msg: string, ...subst: unknown[]): void;
212176
public trace(...parameters: unknown[]): void {
213177
this.printToConsole.trace(...parameters);
214178

215179
let message = format([...parameters]);
216180
RnBugfender.trace('', message);
217181
}
218182

219-
/**
220-
* @param obj A JavaScript value to output
221-
* @param objs List of optional JavaScript values to output
222-
*/
223-
public info(obj: unknown, ...objs: unknown[]): void;
224-
/**
225-
* String message with optional substitutions. This mimicks que the `window.console` template messages. [Learn more in MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
226-
*
227-
* @param msg Message with optional `%` placeholders
228-
* @param subst Optional substitutions list
229-
*/
230-
public info(msg: string, ...subst: unknown[]): void;
231183
public info(...parameters: unknown[]): void {
232184
this.printToConsole.info(...parameters);
233185

234186
let message = format([...parameters]);
235187
RnBugfender.info('', message);
236188
}
237189

238-
/**
239-
* @param obj A JavaScript value to output
240-
* @param objs List of optional JavaScript values to output
241-
*/
242-
public fatal(obj: unknown, ...objs: unknown[]): void;
243-
/**
244-
* String message with optional substitutions. This mimicks que the `window.console` template messages. [Learn more in MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
245-
*
246-
* @param msg Message with optional `%` placeholders
247-
* @param subst Optional substitutions list
248-
*/
249-
public fatal(msg: string, ...subst: unknown[]): void;
250190
public fatal(...parameters: unknown[]): void {
251191
this.printToConsole.error(...parameters);
252192

@@ -358,6 +298,4 @@ class BugfenderClass implements BugfenderFacade {
358298
}
359299
}
360300

361-
export {
362-
BugfenderClass, RnBugfender
363-
}
301+
export { BugfenderClass, RnBugfender };

src/override-console-methods.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import {format} from '@bugfender/common';
2-
import {RnBugfender} from "./bugfender";
1+
import { format } from '@bugfender/common';
2+
import { RnBugfender } from './bugfender';
33

44
/**
55
* Overrides the `window.console` methods in order to execute the Bugfender equivalent logging
66
* methods while keeping the original browser functionality.
77
*/
88
export class OverrideConsoleMethods {
9-
constructor(
10-
protected window: Window,
11-
) {
12-
}
9+
constructor(protected window: Window) {}
1310

1411
public init(): void {
15-
16-
(this.window as any).console = function (console: Console) {
12+
(this.window as any).console = (function (console: Console) {
1713
return {
1814
...console,
1915
log: function (...parameters: unknown[]) {
@@ -47,6 +43,6 @@ export class OverrideConsoleMethods {
4743
RnBugfender.error('', message);
4844
},
4945
};
50-
}((this.window as any).console);
46+
})((this.window as any).console);
5147
}
5248
}

src/sdk-options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {ISDKOptions} from "./types/sdk-options";
2-
import {prepareOptions, validate, ValidationRules} from "@bugfender/common";
1+
import type { ISDKOptions } from './types/sdk-options';
2+
import { prepareOptions, validate, ValidationRules } from '@bugfender/common';
33

44
export class SDKOptions {
55
protected rules: ValidationRules = {

0 commit comments

Comments
 (0)