[QRQC_2] No explicit any in twenty-server (#12068)
# Introduction Added a no-explicit-any rule to the twenty-server, not applicable to tests and integration tests folder Related to https://github.com/twentyhq/core-team-issues/issues/975 Discussed with Charles ## In case of conflicts Until this is approved I won't rebased and handle conflict, just need to drop two latest commits and re run the scripts etc ## Legacy We decided not to handle the existing lint error occurrences and programmatically ignored them through a disable next line rule comment ## Open question We might wanna activate the [no-explicit-any](https://typescript-eslint.io/rules/no-explicit-any/) `ignoreRestArgs` for our use case ? ``` ignoreRestArgs?: boolean; ``` --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
@@ -179,6 +179,7 @@ export class UserService extends TypeOrmQueryService<User> {
|
||||
userId,
|
||||
workspaceId: userWorkspace.workspaceId,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
if (
|
||||
error instanceof PermissionsException &&
|
||||
|
||||
+7
@@ -6,6 +6,8 @@ import { mergeUserVars } from 'src/engine/core-modules/user/user-vars/utils/merg
|
||||
|
||||
@Injectable()
|
||||
export class UserVarsService<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
KeyValueTypesMap extends Record<string, any> = Record<string, any>,
|
||||
> {
|
||||
constructor(private readonly keyValuePairService: KeyValuePairService) {}
|
||||
@@ -19,6 +21,7 @@ export class UserVarsService<
|
||||
workspaceId?: string;
|
||||
key: Extract<K, string>;
|
||||
}): Promise<KeyValueTypesMap[K]> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let userVarWorkspaceLevel: any[] = [];
|
||||
|
||||
if (workspaceId) {
|
||||
@@ -36,6 +39,7 @@ export class UserVarsService<
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let userVarUserLevel: any[] = [];
|
||||
|
||||
if (userId) {
|
||||
@@ -51,6 +55,7 @@ export class UserVarsService<
|
||||
throw new Error(`Multiple values found for key ${key} at user level`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let userVarWorkspaceAndUserLevel: any[] = [];
|
||||
|
||||
if (userId && workspaceId) {
|
||||
@@ -81,7 +86,9 @@ export class UserVarsService<
|
||||
}: {
|
||||
userId?: string;
|
||||
workspaceId?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
}): Promise<Map<Extract<keyof KeyValueTypesMap, string>, any>> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let result: any[] = [];
|
||||
|
||||
if (userId) {
|
||||
|
||||
@@ -8,10 +8,13 @@ import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
|
||||
|
||||
export const userAutoResolverOpts: AutoResolverOpts<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
unknown,
|
||||
unknown,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ReadResolverOpts<any>,
|
||||
PagingStrategies
|
||||
>[] = [
|
||||
|
||||
@@ -150,6 +150,7 @@ export class UserResolver {
|
||||
async userVars(
|
||||
@Parent() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Promise<Record<string, any>> {
|
||||
const userVars = await this.userVarService.getAll({
|
||||
userId: user.id,
|
||||
|
||||
Reference in New Issue
Block a user