mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-09 09:59:40 -06:00
refactor(eslint): update TypeScript object type usage and adjust linting rules
- Change usage of `Object` to `object` in various files for better type safety. - Update ESLint configuration to change `@typescript-eslint/no-unused-vars` from 'error' to 'warn' and disable certain rules related to object types.
This commit is contained in:
parent
e4da6a1763
commit
9d42ad3495
15
.eslintrc.js
15
.eslintrc.js
@ -26,21 +26,14 @@ module.exports = {
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'@typescript-eslint/no-unused-vars': 'warn',
|
||||
'import/first': 'error',
|
||||
'import/no-duplicates': 'error',
|
||||
'simple-import-sort/imports': 'error',
|
||||
'simple-import-sort/exports': 'error',
|
||||
'@typescript-eslint/ban-types': [
|
||||
'error',
|
||||
{
|
||||
extendDefaults: true,
|
||||
types: {
|
||||
'{}': false,
|
||||
Object: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
||||
},
|
||||
};
|
||||
|
||||
@ -105,7 +105,7 @@ export class EventManager {
|
||||
instanceName: string;
|
||||
origin: string;
|
||||
event: string;
|
||||
data: Object;
|
||||
data: object;
|
||||
serverUrl: string;
|
||||
dateTime: string;
|
||||
sender: string;
|
||||
|
||||
@ -431,7 +431,7 @@ export class ChannelStartupService {
|
||||
return data;
|
||||
}
|
||||
|
||||
public async sendDataWebhook<T = any>(event: Events, data: T, local = true, integration?: string[]) {
|
||||
public async sendDataWebhook<T extends object = any>(event: Events, data: T, local = true, integration?: string[]) {
|
||||
const serverUrl = this.configService.get<HttpServer>('SERVER').URL;
|
||||
const tzoffset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds
|
||||
const localISOTime = new Date(Date.now() - tzoffset).toISOString();
|
||||
|
||||
4
src/cache/localcache.ts
vendored
4
src/cache/localcache.ts
vendored
@ -53,7 +53,7 @@ export class LocalCache implements ICache {
|
||||
|
||||
async hGet(key: string, field: string) {
|
||||
try {
|
||||
const data = LocalCache.localCache.get(this.buildKey(key)) as Object;
|
||||
const data = LocalCache.localCache.get(this.buildKey(key)) as object;
|
||||
|
||||
if (data && field in data) {
|
||||
return JSON.parse(data[field], BufferJSON.reviver);
|
||||
@ -84,7 +84,7 @@ export class LocalCache implements ICache {
|
||||
|
||||
async hDelete(key: string, field: string) {
|
||||
try {
|
||||
const data = LocalCache.localCache.get(this.buildKey(key)) as Object;
|
||||
const data = LocalCache.localCache.get(this.buildKey(key)) as object;
|
||||
|
||||
if (data && field in data) {
|
||||
delete data[field];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user