fix: add prefer-readonly rule (#5122)

This commit is contained in:
LongYinan
2023-11-29 04:44:25 +00:00
parent e9ea67bd38
commit 7a7cbc45d7
21 changed files with 39 additions and 36 deletions

View File

@@ -14,7 +14,7 @@ const TrivialExceptions = [NotFoundException];
@Catch()
export class ExceptionLogger implements ExceptionFilter {
private logger = new Logger('ExceptionLogger');
private readonly logger = new Logger('ExceptionLogger');
catch(exception: Error, host: ArgumentsHost) {
// with useGlobalFilters, the context is always HTTP

View File

@@ -53,8 +53,8 @@ class AuthGuard implements CanActivate {
constructor(
@Inject(NextAuthOptionsProvide)
private readonly nextAuthOptions: NextAuthOptions,
private auth: AuthService,
private prisma: PrismaService,
private readonly auth: AuthService,
private readonly prisma: PrismaService,
private readonly reflector: Reflector
) {}

View File

@@ -28,9 +28,9 @@ export const getUtcTimestamp = () => Math.floor(Date.now() / 1000);
@Injectable()
export class AuthService {
constructor(
private config: Config,
private prisma: PrismaService,
private mailer: MailService
private readonly config: Config,
private readonly prisma: PrismaService,
private readonly mailer: MailService
) {}
sign(user: UserClaim) {

View File

@@ -60,9 +60,9 @@ const MAX_SEQ_NUM = 0x3fffffff; // u31
*/
@Injectable()
export class DocManager implements OnModuleInit, OnModuleDestroy {
private logger = new Logger(DocManager.name);
private readonly logger = new Logger(DocManager.name);
private job: NodeJS.Timeout | null = null;
private seqMap = new Map<string, number>();
private readonly seqMap = new Map<string, number>();
private busy = false;
constructor(

View File

@@ -16,7 +16,7 @@ export class DocID {
raw: string;
workspace: string;
variant: DocVariant;
private sub: string | null;
private readonly sub: string | null;
static parse(raw: string): DocID | null {
try {