Skip to content

Commit

Permalink
fix pr
Browse files Browse the repository at this point in the history
  • Loading branch information
lionralfs committed Oct 23, 2023
1 parent fd8f46e commit 20560aa
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 288 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ module.exports = {
es2021: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
// 'plugin:@typescript-eslint/stylistic-type-checked',
],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
},
plugins: ['@typescript-eslint'],
rules: {
Expand Down
2 changes: 1 addition & 1 deletion lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class DiscogsClient {
}
callback(err, data, rateLimit);
})
.catch(err => {
.catch((err: Error) => {
callback(err);
});
}
Expand Down
15 changes: 12 additions & 3 deletions lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,20 @@ export function escape(str: string): string {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function merge(target: Record<any, any>, source: Record<any, any>): Record<any, any> {
for (const key in source) {
if (source[key] && typeof source[key] === 'object') {
target[key] = merge(Array.isArray(source[key]) ? [] : {}, source[key]);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const value = source[key];
if (isObject(value)) {
target[key] = merge(Array.isArray(value) ? [] : {}, value);
} else {
target[key] = source[key];
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
target[key] = value;
}
}
return target;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isObject(value: any): value is object {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return value && typeof value === 'object';
}
Loading

0 comments on commit 20560aa

Please sign in to comment.