Skip to content

Commit ab3e8ce

Browse files
committed
lint
1 parent c78cc26 commit ab3e8ce

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/catcher.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export default class Catcher {
242242

243243
if (!validation.isValid) {
244244
logValidationErrors('setUser', validation.errors);
245+
245246
return;
246247
}
247248

@@ -265,6 +266,7 @@ export default class Catcher {
265266

266267
if (!validation.isValid) {
267268
logValidationErrors('setContext', validation.errors);
269+
268270
return;
269271
}
270272

src/utils/validation.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@ interface ValidationResult<T> {
1212

1313
/**
1414
* Validates user data - basic security checks
15+
*
16+
* @param user
1517
*/
1618
export function validateUser(user: AffectedUser): ValidationResult<AffectedUser> {
1719
const errors: string[] = [];
1820

1921
if (!user || !Sanitizer.isObject(user)) {
2022
errors.push('User must be an object');
21-
return { isValid: false, errors };
23+
24+
return { isValid: false,
25+
errors };
2226
}
2327

2428
// Validate required ID
2529
if (!user.id || typeof user.id !== 'string' || user.id.trim() === '') {
2630
errors.push('User ID is required and must be a non-empty string');
27-
return { isValid: false, errors };
31+
32+
return { isValid: false,
33+
errors };
2834
}
2935

3036
const validatedUser: AffectedUser = {
@@ -53,13 +59,17 @@ export function validateUser(user: AffectedUser): ValidationResult<AffectedUser>
5359

5460
/**
5561
* Validates context data - basic security checks
62+
*
63+
* @param context
5664
*/
5765
export function validateContext(context: EventContext): ValidationResult<EventContext> {
5866
const errors: string[] = [];
5967

6068
if (!context || !Sanitizer.isObject(context)) {
6169
errors.push('Context must be an object');
62-
return { isValid: false, errors };
70+
71+
return { isValid: false,
72+
errors };
6373
}
6474

6575
return {
@@ -71,6 +81,9 @@ export function validateContext(context: EventContext): ValidationResult<EventCo
7181

7282
/**
7383
* Logs validation errors
84+
*
85+
* @param prefix
86+
* @param errors
7487
*/
7588
export function logValidationErrors(prefix: string, errors: string[]): void {
7689
errors.forEach((error) => {

0 commit comments

Comments
 (0)