refactor: no-inferrable-types
This commit is contained in:
		
							parent
							
								
									e1aba11222
								
							
						
					
					
						commit
						e84c772916
					
				
					 14 changed files with 22 additions and 18 deletions
				
			
		|  | @ -16,7 +16,7 @@ export class Submission { | |||
|     learningObjectLanguage!: Language; | ||||
| 
 | ||||
|     @PrimaryKey({ type: 'numeric' }) | ||||
|     learningObjectVersion: number = 1; | ||||
|     learningObjectVersion = 1; | ||||
| 
 | ||||
|     @PrimaryKey({ type: 'integer', autoincrement: true }) | ||||
|     submissionNumber?: number; | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ export class LearningObject { | |||
|     language!: Language; | ||||
| 
 | ||||
|     @PrimaryKey({ type: 'number' }) | ||||
|     version: number = 1; | ||||
|     version = 1; | ||||
| 
 | ||||
|     @Property({ type: 'uuid', unique: true }) | ||||
|     uuid = v4(); | ||||
|  | @ -46,7 +46,7 @@ export class LearningObject { | |||
|     targetAges?: number[] = []; | ||||
| 
 | ||||
|     @Property({ type: 'bool' }) | ||||
|     teacherExclusive: boolean = false; | ||||
|     teacherExclusive = false; | ||||
| 
 | ||||
|     @Property({ type: 'array' }) | ||||
|     skosConcepts: string[] = []; | ||||
|  | @ -58,10 +58,10 @@ export class LearningObject { | |||
|     educationalGoals: EducationalGoal[] = []; | ||||
| 
 | ||||
|     @Property({ type: 'string' }) | ||||
|     copyright: string = ''; | ||||
|     copyright = ''; | ||||
| 
 | ||||
|     @Property({ type: 'string' }) | ||||
|     license: string = ''; | ||||
|     license = ''; | ||||
| 
 | ||||
|     @Property({ type: 'smallint', nullable: true }) | ||||
|     difficulty?: number; | ||||
|  | @ -75,7 +75,7 @@ export class LearningObject { | |||
|     returnValue!: ReturnValue; | ||||
| 
 | ||||
|     @Property({ type: 'bool' }) | ||||
|     available: boolean = true; | ||||
|     available = true; | ||||
| 
 | ||||
|     @Property({ type: 'string', nullable: true }) | ||||
|     contentLocation?: string; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ export class Question { | |||
|     learningObjectLanguage!: Language; | ||||
| 
 | ||||
|     @PrimaryKey({ type: 'number' }) | ||||
|     learningObjectVersion: number = 1; | ||||
|     learningObjectVersion = 1; | ||||
| 
 | ||||
|     @PrimaryKey({ type: 'integer', autoincrement: true }) | ||||
|     sequenceNumber?: number; | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ export abstract class User { | |||
|     username!: string; | ||||
| 
 | ||||
|     @Property() | ||||
|     firstName: string = ''; | ||||
|     firstName = ''; | ||||
| 
 | ||||
|     @Property() | ||||
|     lastName: string = ''; | ||||
|     lastName = ''; | ||||
| } | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ import { HttpException } from './httpException.js'; | |||
|  */ | ||||
| 
 | ||||
| export class BadRequestException extends HttpException { | ||||
|     constructor(message: string = 'Bad Request') { | ||||
|     constructor(message = 'Bad Request') { | ||||
|         super(400, message); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ import { HttpException } from './httpException.js'; | |||
|  * Exception for HTTP 403 Forbidden | ||||
|  */ | ||||
| export class ForbiddenException extends HttpException { | ||||
|     constructor(message: string = 'Forbidden') { | ||||
|     constructor(message = 'Forbidden') { | ||||
|         super(403, message); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ import { HttpException } from './httpException.js'; | |||
|  * Exception for HTTP 404 Not Found | ||||
|  */ | ||||
| export class NotFoundException extends HttpException { | ||||
|     constructor(message: string = 'Not Found') { | ||||
|     constructor(message = 'Not Found') { | ||||
|         super(404, message); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ import { HttpException } from './httpException.js'; | |||
|  * Exception for HTTP 401 Unauthorized | ||||
|  */ | ||||
| export class UnauthorizedException extends HttpException { | ||||
|     constructor(message: string = 'Unauthorized') { | ||||
|     constructor(message = 'Unauthorized') { | ||||
|         super(401, message); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -43,7 +43,7 @@ const entities = [ | |||
|     Question, | ||||
| ]; | ||||
| 
 | ||||
| function config(testingMode: boolean = false): Options { | ||||
| function config(testingMode = false): Options { | ||||
|     if (testingMode) { | ||||
|         return { | ||||
|             driver: SqliteDriver, | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ import { envVars, getEnvVar } from './util/envVars.js'; | |||
| import { getLogger, Logger } from './logging/initalize.js'; | ||||
| 
 | ||||
| let orm: MikroORM | undefined; | ||||
| export async function initORM(testingMode: boolean = false): Promise<void> { | ||||
| export async function initORM(testingMode = false): Promise<void> { | ||||
|     const logger: Logger = getLogger(); | ||||
| 
 | ||||
|     logger.info('Initializing ORM'); | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ import { EntityProperty, EventArgs, EventSubscriber } from '@mikro-orm/core'; | |||
|  *   the sequence number will not be filled in. | ||||
|  */ | ||||
| export class SqliteAutoincrementSubscriber implements EventSubscriber { | ||||
|     private sequenceNumbersForEntityType: Map<string, number> = new Map(); | ||||
|     private sequenceNumbersForEntityType = new Map<string, number>(); | ||||
| 
 | ||||
|     /** | ||||
|      * When an entity with an autoincremented property which is part of the composite private key is created, | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ interface EnvVar { | |||
|     defaultValue?: number | string | boolean; | ||||
| } | ||||
| 
 | ||||
| export const envVars: { [key: string]: EnvVar } = { | ||||
| export const envVars: Record<string, EnvVar> = { | ||||
|     Port: { key: PREFIX + 'PORT', defaultValue: 3000 }, | ||||
|     DbHost: { key: DB_PREFIX + 'HOST', required: true }, | ||||
|     DbPort: { key: DB_PREFIX + 'PORT', defaultValue: 5432 }, | ||||
|  |  | |||
|  | @ -3,6 +3,6 @@ import { Attachment } from '../../../src/entities/content/attachment.entity'; | |||
| 
 | ||||
| interface LearningObjectExample { | ||||
|     createLearningObject: () => LearningObject; | ||||
|     createAttachment: { [key: string]: (owner: LearningObject) => Attachment }; | ||||
|     createAttachment: Record<string, (owner: LearningObject) => Attachment>; | ||||
|     getHTMLRendering: () => string; | ||||
| } | ||||
|  |  | |||
|  | @ -82,6 +82,10 @@ export default [ | |||
|             // 'no-empty-function': 'off',
 | ||||
|             '@typescript-eslint/no-empty-function': 'error', | ||||
| 
 | ||||
|             '@typescript-eslint/no-for-in-array': 'error', | ||||
| 
 | ||||
|             '@typescript-eslint/no-inferrable-types': 'warn', | ||||
| 
 | ||||
|             'no-loop-func': 'off', | ||||
|             '@typescript-eslint/no-loop-func': 'error', | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue