From 315f07133755091329048d56c113549db9e83834 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Fri, 30 Jun 2023 09:07:03 +0100 Subject: [PATCH] Tools: Apply eslint rule @typescript-eslint/no-inferrable-types with ignoreProperties=false --- .eslintrc.js | 2 +- packages/app-desktop/ElectronAppWrapper.ts | 2 +- packages/app-desktop/app.ts | 2 +- packages/app-desktop/gui/NoteTextViewer.tsx | 4 +-- packages/app-desktop/gui/PromptDialog.tsx | 2 +- .../NoteEditor/SelectionFormatting.ts | 26 +++++++++---------- packages/lib/BaseApplication.ts | 4 +-- packages/lib/JoplinError.ts | 2 +- packages/lib/JoplinServerApi.ts | 4 +-- packages/lib/Logger.ts | 2 +- packages/lib/PoorManIntervals.ts | 2 +- packages/lib/Synchronizer.ts | 8 +++--- packages/lib/models/Setting.ts | 2 +- packages/lib/services/DecryptionWorker.ts | 2 +- .../lib/services/ResourceEditWatcher/index.ts | 2 +- packages/lib/services/ResourceService.ts | 4 +-- packages/lib/services/UndoRedoService.ts | 4 +-- .../interop/InteropService_Exporter_Html.ts | 2 +- .../interop/InteropService_Importer_Base.ts | 2 +- .../lib/services/keychain/KeychainService.ts | 2 +- packages/lib/services/plugins/Plugin.ts | 4 +-- .../lib/services/plugins/PluginService.ts | 2 +- .../lib/services/plugins/RepositoryApi.ts | 2 +- .../services/synchronizer/syncInfoUtils.ts | 2 +- packages/lib/time.ts | 6 ++--- packages/renderer/MdToHtml.ts | 2 +- packages/server/src/models/ItemModel.ts | 2 +- packages/server/src/services/BaseService.ts | 10 +++---- .../server/src/services/MustacheService.ts | 2 +- .../src/services/UserDeletionService.ts | 2 +- packages/server/src/utils/Router.ts | 2 +- .../server/src/utils/TransactionHandler.ts | 4 +-- packages/server/src/utils/errors.ts | 24 ++++++++--------- .../src/utils/testing/koa/FakeResponse.ts | 2 +- 34 files changed, 73 insertions(+), 73 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e3b7bfc9d..5adb1c341 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -183,7 +183,7 @@ module.exports = { 'rules': { '@typescript-eslint/explicit-member-accessibility': ['error'], '@typescript-eslint/type-annotation-spacing': ['error', { 'before': false, 'after': true }], - '@typescript-eslint/no-inferrable-types': ['error', { 'ignoreParameters': true, 'ignoreProperties': true }], + '@typescript-eslint/no-inferrable-types': ['error', { 'ignoreParameters': true }], '@typescript-eslint/comma-dangle': ['error', { 'arrays': 'always-multiline', 'objects': 'always-multiline', diff --git a/packages/app-desktop/ElectronAppWrapper.ts b/packages/app-desktop/ElectronAppWrapper.ts index 4a04a33ad..4c12a8c35 100644 --- a/packages/app-desktop/ElectronAppWrapper.ts +++ b/packages/app-desktop/ElectronAppWrapper.ts @@ -26,7 +26,7 @@ export default class ElectronAppWrapper { private isDebugMode_: boolean; private profilePath_: string; private win_: BrowserWindow = null; - private willQuitApp_: boolean = false; + private willQuitApp_ = false; private tray_: any = null; private buildDir_: string = null; private rendererProcessQuitReply_: RendererProcessQuitReply = null; diff --git a/packages/app-desktop/app.ts b/packages/app-desktop/app.ts index e37afaeed..1b93df76a 100644 --- a/packages/app-desktop/app.ts +++ b/packages/app-desktop/app.ts @@ -80,7 +80,7 @@ const appDefaultState = createAppDefaultState( class Application extends BaseApplication { private checkAllPluginStartedIID_: any = null; - private initPluginServiceDone_: boolean = false; + private initPluginServiceDone_ = false; public constructor() { super(); diff --git a/packages/app-desktop/gui/NoteTextViewer.tsx b/packages/app-desktop/gui/NoteTextViewer.tsx index d8d36bd22..67a4c758a 100644 --- a/packages/app-desktop/gui/NoteTextViewer.tsx +++ b/packages/app-desktop/gui/NoteTextViewer.tsx @@ -12,8 +12,8 @@ interface Props { export default class NoteTextViewerComponent extends React.Component { - private initialized_: boolean = false; - private domReady_: boolean = false; + private initialized_ = false; + private domReady_ = false; private webviewRef_: any; private webviewListeners_: any = null; diff --git a/packages/app-desktop/gui/PromptDialog.tsx b/packages/app-desktop/gui/PromptDialog.tsx index f6d2b2297..aeb4e9d36 100644 --- a/packages/app-desktop/gui/PromptDialog.tsx +++ b/packages/app-desktop/gui/PromptDialog.tsx @@ -26,7 +26,7 @@ export default class PromptDialog extends React.Component { private focusInput_: boolean; private styles_: any; private styleKey_: string; - private menuIsOpened_: boolean = false; + private menuIsOpened_ = false; public constructor(props: Props) { super(props); diff --git a/packages/app-mobile/components/NoteEditor/SelectionFormatting.ts b/packages/app-mobile/components/NoteEditor/SelectionFormatting.ts index a5540aef2..e53b5ab53 100644 --- a/packages/app-mobile/components/NoteEditor/SelectionFormatting.ts +++ b/packages/app-mobile/components/NoteEditor/SelectionFormatting.ts @@ -1,16 +1,16 @@ // Stores information about the current content of the user's selection export default class SelectionFormatting { - public bolded: boolean = false; - public italicized: boolean = false; - public inChecklist: boolean = false; - public inCode: boolean = false; - public inUnorderedList: boolean = false; - public inOrderedList: boolean = false; - public inMath: boolean = false; - public inLink: boolean = false; - public spellChecking: boolean = false; - public unspellCheckableRegion: boolean = false; + public bolded = false; + public italicized = false; + public inChecklist = false; + public inCode = false; + public inUnorderedList = false; + public inOrderedList = false; + public inMath = false; + public inLink = false; + public spellChecking = false; + public unspellCheckableRegion = false; // Link data, both fields are null if not in a link. public linkData: { linkText?: string; linkURL?: string } = { @@ -20,11 +20,11 @@ export default class SelectionFormatting { // If [headerLevel], [listLevel], etc. are zero, then the // selection isn't in a header/list - public headerLevel: number = 0; - public listLevel: number = 0; + public headerLevel = 0; + public listLevel = 0; // Content of the selection - public selectedText: string = ''; + public selectedText = ''; // List of data properties (for serializing/deseralizing) private static propNames: string[] = [ diff --git a/packages/lib/BaseApplication.ts b/packages/lib/BaseApplication.ts index 9d73ead35..ed977d2c2 100644 --- a/packages/lib/BaseApplication.ts +++ b/packages/lib/BaseApplication.ts @@ -75,8 +75,8 @@ export default class BaseApplication { private database_: any = null; private profileConfig_: ProfileConfig = null; - protected showStackTraces_: boolean = false; - protected showPromptString_: boolean = false; + protected showStackTraces_ = false; + protected showPromptString_ = false; // Note: this is basically a cache of state.selectedFolderId. It should *only* // be derived from the state and not set directly since that would make the diff --git a/packages/lib/JoplinError.ts b/packages/lib/JoplinError.ts index 862cec143..74be7aecd 100644 --- a/packages/lib/JoplinError.ts +++ b/packages/lib/JoplinError.ts @@ -1,7 +1,7 @@ export default class JoplinError extends Error { public code: any = null; - public details: string = ''; + public details = ''; public constructor(message: string, code: any = null, details: string = null) { super(message); diff --git a/packages/lib/JoplinServerApi.ts b/packages/lib/JoplinServerApi.ts index 3cad55608..bc92482a6 100644 --- a/packages/lib/JoplinServerApi.ts +++ b/packages/lib/JoplinServerApi.ts @@ -44,8 +44,8 @@ export default class JoplinServerApi { private options_: Options; private session_: Session; - private debugRequests_: boolean = false; - private debugRequestsShowPasswords_: boolean = false; + private debugRequests_ = false; + private debugRequestsShowPasswords_ = false; public constructor(options: Options) { this.options_ = options; diff --git a/packages/lib/Logger.ts b/packages/lib/Logger.ts index b98c23f5b..3090ddaa5 100644 --- a/packages/lib/Logger.ts +++ b/packages/lib/Logger.ts @@ -61,7 +61,7 @@ class Logger { private targets_: Target[] = []; private level_: LogLevel = LogLevel.Info; private lastDbCleanup_: number = time.unixMs(); - private enabled_: boolean = true; + private enabled_ = true; public static fsDriver() { if (!Logger.fsDriver_) Logger.fsDriver_ = new FsDriverDummy(); diff --git a/packages/lib/PoorManIntervals.ts b/packages/lib/PoorManIntervals.ts index e9f1af3a8..87b2cc246 100644 --- a/packages/lib/PoorManIntervals.ts +++ b/packages/lib/PoorManIntervals.ts @@ -25,7 +25,7 @@ interface Intervals { export default class PoorManIntervals { private static maxNativeTimerDuration_ = 10 * 1000; - private static lastUpdateTime_: number = 0; + private static lastUpdateTime_ = 0; private static intervalId_: IntervalId = 0; private static intervals_: Intervals = {}; diff --git a/packages/lib/Synchronizer.ts b/packages/lib/Synchronizer.ts index c599fdbb7..d3c9412b4 100644 --- a/packages/lib/Synchronizer.ts +++ b/packages/lib/Synchronizer.ts @@ -49,14 +49,14 @@ function isCannotSyncError(error: any): boolean { export default class Synchronizer { - public static verboseMode: boolean = true; + public static verboseMode = true; private db_: JoplinDatabase; private api_: FileApi; private appType_: AppType; private logger_: Logger = new Logger(); - private state_: string = 'idle'; - private cancelling_: boolean = false; + private state_ = 'idle'; + private cancelling_ = false; public maxResourceSize_: number = null; private downloadQueue_: any = null; private clientId_: string; @@ -64,7 +64,7 @@ export default class Synchronizer { private migrationHandler_: MigrationHandler; private encryptionService_: EncryptionService = null; private resourceService_: ResourceService = null; - private syncTargetIsLocked_: boolean = false; + private syncTargetIsLocked_ = false; private shareService_: ShareService = null; private lockClientType_: LockClientType = null; diff --git a/packages/lib/models/Setting.ts b/packages/lib/models/Setting.ts index be5b71b44..537441f84 100644 --- a/packages/lib/models/Setting.ts +++ b/packages/lib/models/Setting.ts @@ -312,7 +312,7 @@ class Setting extends BaseModel { private static changedKeys_: string[] = []; private static fileHandler_: FileHandler = null; private static rootFileHandler_: FileHandler = null; - private static settingFilename_: string = 'settings.json'; + private static settingFilename_ = 'settings.json'; private static buildInMetadata_: SettingItems = null; public static tableName() { diff --git a/packages/lib/services/DecryptionWorker.ts b/packages/lib/services/DecryptionWorker.ts index 6ec4020be..7be7303c0 100644 --- a/packages/lib/services/DecryptionWorker.ts +++ b/packages/lib/services/DecryptionWorker.ts @@ -21,7 +21,7 @@ export default class DecryptionWorker { public static instance_: DecryptionWorker = null; - private state_: string = 'idle'; + private state_ = 'idle'; private logger_: Logger; public dispatch: Function = () => {}; private scheduleId_: any = null; diff --git a/packages/lib/services/ResourceEditWatcher/index.ts b/packages/lib/services/ResourceEditWatcher/index.ts index 5ee9d9820..da0553596 100644 --- a/packages/lib/services/ResourceEditWatcher/index.ts +++ b/packages/lib/services/ResourceEditWatcher/index.ts @@ -33,7 +33,7 @@ export default class ResourceEditWatcher { private chokidar_: any; private watchedItems_: WatchedItems = {}; private eventEmitter_: any; - private tempDir_: string = ''; + private tempDir_ = ''; private openItem_: OpenItemFn; public constructor() { diff --git a/packages/lib/services/ResourceService.ts b/packages/lib/services/ResourceService.ts index 97b4f4fd9..3f6ac1116 100644 --- a/packages/lib/services/ResourceService.ts +++ b/packages/lib/services/ResourceService.ts @@ -13,8 +13,8 @@ const { sprintf } = require('sprintf-js'); export default class ResourceService extends BaseService { - public static isRunningInBackground_: boolean = false; - private isIndexing_: boolean = false; + public static isRunningInBackground_ = false; + private isIndexing_ = false; private maintenanceCalls_: boolean[] = []; private maintenanceTimer1_: any = null; diff --git a/packages/lib/services/UndoRedoService.ts b/packages/lib/services/UndoRedoService.ts index 4ad1d6b0a..2ce21901a 100644 --- a/packages/lib/services/UndoRedoService.ts +++ b/packages/lib/services/UndoRedoService.ts @@ -4,7 +4,7 @@ const EventEmitter = require('events'); class UndoQueue { private inner_: any[] = []; - private size_: number = 20; + private size_ = 20; public pop() { return this.inner_.pop(); @@ -33,7 +33,7 @@ export default class UndoRedoService { private undoStates: UndoQueue = new UndoQueue(); private redoStates: UndoQueue = new UndoQueue(); private eventEmitter: any = new EventEmitter(); - private isUndoing: boolean = false; + private isUndoing = false; public constructor() { this.push = this.push.bind(this); diff --git a/packages/lib/services/interop/InteropService_Exporter_Html.ts b/packages/lib/services/interop/InteropService_Exporter_Html.ts index 3463d6e0f..75f13af52 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Html.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Html.ts @@ -24,7 +24,7 @@ export default class InteropService_Exporter_Html extends InteropService_Exporte private markupToHtml_: MarkupToHtml; private resources_: ResourceEntity[] = []; private style_: any; - private packIntoSingleFile_: boolean = false; + private packIntoSingleFile_ = false; public async init(path: string, options: any = {}) { this.customCss_ = options.customCss ? options.customCss : ''; diff --git a/packages/lib/services/interop/InteropService_Importer_Base.ts b/packages/lib/services/interop/InteropService_Importer_Base.ts index f44ac2635..c868ea3ae 100644 --- a/packages/lib/services/interop/InteropService_Importer_Base.ts +++ b/packages/lib/services/interop/InteropService_Importer_Base.ts @@ -7,7 +7,7 @@ import Setting from '../../models/Setting'; export default class InteropService_Importer_Base { private metadata_: any = null; - protected sourcePath_: string = ''; + protected sourcePath_ = ''; protected options_: any = {}; public setMetadata(md: any) { diff --git a/packages/lib/services/keychain/KeychainService.ts b/packages/lib/services/keychain/KeychainService.ts index 726d68138..873edd5ff 100644 --- a/packages/lib/services/keychain/KeychainService.ts +++ b/packages/lib/services/keychain/KeychainService.ts @@ -6,7 +6,7 @@ export default class KeychainService extends BaseService { private driver: KeychainServiceDriverBase; private static instance_: KeychainService; - private enabled_: boolean = true; + private enabled_ = true; public static instance(): KeychainService { if (!this.instance_) this.instance_ = new KeychainService(); diff --git a/packages/lib/services/plugins/Plugin.ts b/packages/lib/services/plugins/Plugin.ts index 24101d3f6..b244ece16 100644 --- a/packages/lib/services/plugins/Plugin.ts +++ b/packages/lib/services/plugins/Plugin.ts @@ -30,11 +30,11 @@ export default class Plugin { private contentScripts_: ContentScripts = {}; private dispatch_: Function; private eventEmitter_: any; - private devMode_: boolean = false; + private devMode_ = false; private messageListener_: Function = null; private contentScriptMessageListeners_: Record = {}; private dataDir_: string; - private dataDirCreated_: boolean = false; + private dataDirCreated_ = false; public constructor(baseDir: string, manifest: PluginManifest, scriptText: string, dispatch: Function, dataDir: string) { this.baseDir_ = shim.fsDriver().resolve(baseDir); diff --git a/packages/lib/services/plugins/PluginService.ts b/packages/lib/services/plugins/PluginService.ts index 9376203da..32734cba7 100644 --- a/packages/lib/services/plugins/PluginService.ts +++ b/packages/lib/services/plugins/PluginService.ts @@ -87,7 +87,7 @@ export default class PluginService extends BaseService { private plugins_: Plugins = {}; private runner_: BasePluginRunner = null; private startedPlugins_: Record = {}; - private isSafeMode_: boolean = false; + private isSafeMode_ = false; public initialize(appVersion: string, platformImplementation: any, runner: BasePluginRunner, store: any) { this.appVersion_ = appVersion; diff --git a/packages/lib/services/plugins/RepositoryApi.ts b/packages/lib/services/plugins/RepositoryApi.ts index f26bcf5aa..ff28aacaf 100644 --- a/packages/lib/services/plugins/RepositoryApi.ts +++ b/packages/lib/services/plugins/RepositoryApi.ts @@ -61,7 +61,7 @@ export default class RepositoryApi { private manifests_: PluginManifest[] = null; private githubApiUrl_: string; private contentBaseUrl_: string; - private isUsingDefaultContentUrl_: boolean = true; + private isUsingDefaultContentUrl_ = true; public constructor(baseUrl: string, tempDir: string) { this.baseUrl_ = baseUrl; diff --git a/packages/lib/services/synchronizer/syncInfoUtils.ts b/packages/lib/services/synchronizer/syncInfoUtils.ts index fb2b23815..55cec954e 100644 --- a/packages/lib/services/synchronizer/syncInfoUtils.ts +++ b/packages/lib/services/synchronizer/syncInfoUtils.ts @@ -174,7 +174,7 @@ export function syncInfoEquals(s1: SyncInfo, s2: SyncInfo): boolean { export class SyncInfo { - private version_: number = 0; + private version_ = 0; private e2ee_: SyncInfoValueBoolean; private activeMasterKeyId_: SyncInfoValueString; private masterKeys_: MasterKeyEntity[] = []; diff --git a/packages/lib/time.ts b/packages/lib/time.ts index b8ba90fb1..0443d995b 100644 --- a/packages/lib/time.ts +++ b/packages/lib/time.ts @@ -5,9 +5,9 @@ type ConditionHandler = ()=> boolean; class Time { - private dateFormat_: string = 'DD/MM/YYYY'; - private timeFormat_: string = 'HH:mm'; - private locale_: string = 'en-us'; + private dateFormat_ = 'DD/MM/YYYY'; + private timeFormat_ = 'HH:mm'; + private locale_ = 'en-us'; public locale() { return this.locale_; diff --git a/packages/renderer/MdToHtml.ts b/packages/renderer/MdToHtml.ts index 4cc447795..c6b1e8075 100644 --- a/packages/renderer/MdToHtml.ts +++ b/packages/renderer/MdToHtml.ts @@ -198,7 +198,7 @@ export default class MdToHtml { private pluginOptions_: any = {}; private extraRendererRules_: RendererRules = {}; private allProcessedAssets_: any = {}; - private customCss_: string = ''; + private customCss_ = ''; public constructor(options: Options = null) { if (!options) options = {}; diff --git a/packages/server/src/models/ItemModel.ts b/packages/server/src/models/ItemModel.ts index bcc4041fe..17f90ce76 100644 --- a/packages/server/src/models/ItemModel.ts +++ b/packages/server/src/models/ItemModel.ts @@ -68,7 +68,7 @@ export interface ItemLoadOptions extends LoadOptions { export default class ItemModel extends BaseModel { - private updatingTotalSizes_: boolean = false; + private updatingTotalSizes_ = false; private storageDriverConfig_: StorageDriverConfig; private storageDriverConfigFallback_: StorageDriverConfig; diff --git a/packages/server/src/services/BaseService.ts b/packages/server/src/services/BaseService.ts index a12d0a28f..2f8b2045c 100644 --- a/packages/server/src/services/BaseService.ts +++ b/packages/server/src/services/BaseService.ts @@ -10,12 +10,12 @@ export default class BaseService { private env_: Env; private models_: Models; private config_: Config; - protected name_: string = 'Untitled'; - protected enabled_: boolean = true; - private destroyed_: boolean = false; - protected maintenanceInterval_: number = 10000; + protected name_ = 'Untitled'; + protected enabled_ = true; + private destroyed_ = false; + protected maintenanceInterval_ = 10000; private scheduledMaintenances_: boolean[] = []; - private maintenanceInProgress_: boolean = false; + private maintenanceInProgress_ = false; public constructor(env: Env, models: Models, config: Config) { this.env_ = env; diff --git a/packages/server/src/services/MustacheService.ts b/packages/server/src/services/MustacheService.ts index 009298f93..419eb3e6f 100644 --- a/packages/server/src/services/MustacheService.ts +++ b/packages/server/src/services/MustacheService.ts @@ -67,7 +67,7 @@ export default class MustacheService { private viewDir_: string; private baseAssetUrl_: string; - private prefersDarkEnabled_: boolean = true; + private prefersDarkEnabled_ = true; private partials_: Record = {}; private fileContentCache_: Record = {}; diff --git a/packages/server/src/services/UserDeletionService.ts b/packages/server/src/services/UserDeletionService.ts index 05440bec9..b585b1049 100644 --- a/packages/server/src/services/UserDeletionService.ts +++ b/packages/server/src/services/UserDeletionService.ts @@ -12,7 +12,7 @@ export interface DeletionJobOptions { export default class UserDeletionService extends BaseService { - protected name_: string = 'UserDeletionService'; + protected name_ = 'UserDeletionService'; private async deleteUserData(userId: Uuid, options: DeletionJobOptions) { // While the "UserDeletionInProgress" flag is on, the account is diff --git a/packages/server/src/utils/Router.ts b/packages/server/src/utils/Router.ts index ba186a9f0..76fd9c9d0 100644 --- a/packages/server/src/utils/Router.ts +++ b/packages/server/src/utils/Router.ts @@ -13,7 +13,7 @@ export default class Router { // available (that ctx.joplin.owner is defined). It means by default any user, even // not logged in, can access any route of this router. End points that // should not be publicly available should call ownerRequired(ctx); - public public: boolean = false; + public public = false; public publicSchemas: string[] = []; public responseFormat: RouteResponseFormat = null; diff --git a/packages/server/src/utils/TransactionHandler.ts b/packages/server/src/utils/TransactionHandler.ts index 3d72d7b5b..448d4f7c6 100644 --- a/packages/server/src/utils/TransactionHandler.ts +++ b/packages/server/src/utils/TransactionHandler.ts @@ -17,8 +17,8 @@ export default class TransactionHandler { private transactionStack_: TransactionInfo[] = []; private activeTransaction_: Knex.Transaction = null; - private transactionIndex_: number = 0; - private logEnabled_: boolean = false; + private transactionIndex_ = 0; + private logEnabled_ = false; private db_: Knex = null; public constructor(db: DbConnection) { diff --git a/packages/server/src/utils/errors.ts b/packages/server/src/utils/errors.ts index db805c8ca..a79bac2ab 100644 --- a/packages/server/src/utils/errors.ts +++ b/packages/server/src/utils/errors.ts @@ -16,7 +16,7 @@ export interface ErrorOptions { // For explanation of the setPrototypeOf call, see: // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work export class ApiError extends Error { - public static httpCode: number = 400; + public static httpCode = 400; public httpCode: number; public code: ErrorCode; @@ -46,7 +46,7 @@ export class ErrorWithCode extends ApiError { } export class ErrorMethodNotAllowed extends ApiError { - public static httpCode: number = 400; + public static httpCode = 400; public constructor(message: string = 'Method Not Allowed', options: ErrorOptions = null) { super(message, ErrorMethodNotAllowed.httpCode, options); @@ -55,7 +55,7 @@ export class ErrorMethodNotAllowed extends ApiError { } export class ErrorNotFound extends ApiError { - public static httpCode: number = 404; + public static httpCode = 404; public constructor(message: string = 'Not Found', code: ErrorCode = undefined) { super(message, ErrorNotFound.httpCode, code); @@ -64,7 +64,7 @@ export class ErrorNotFound extends ApiError { } export class ErrorForbidden extends ApiError { - public static httpCode: number = 403; + public static httpCode = 403; public constructor(message: string = 'Forbidden', options: ErrorOptions = null) { super(message, ErrorForbidden.httpCode, options); @@ -73,7 +73,7 @@ export class ErrorForbidden extends ApiError { } export class ErrorBadRequest extends ApiError { - public static httpCode: number = 400; + public static httpCode = 400; public constructor(message: string = 'Bad Request', options: ErrorOptions = null) { super(message, ErrorBadRequest.httpCode, options); @@ -83,7 +83,7 @@ export class ErrorBadRequest extends ApiError { } export class ErrorPreconditionFailed extends ApiError { - public static httpCode: number = 412; + public static httpCode = 412; public constructor(message: string = 'Precondition Failed', options: ErrorOptions = null) { super(message, ErrorPreconditionFailed.httpCode, options); @@ -93,7 +93,7 @@ export class ErrorPreconditionFailed extends ApiError { } export class ErrorUnprocessableEntity extends ApiError { - public static httpCode: number = 422; + public static httpCode = 422; public constructor(message: string = 'Unprocessable Entity', options: ErrorOptions = null) { super(message, ErrorUnprocessableEntity.httpCode, options); @@ -102,7 +102,7 @@ export class ErrorUnprocessableEntity extends ApiError { } export class ErrorConflict extends ApiError { - public static httpCode: number = 409; + public static httpCode = 409; public constructor(message: string = 'Conflict', code: ErrorCode = undefined) { super(message, ErrorConflict.httpCode, code); @@ -111,7 +111,7 @@ export class ErrorConflict extends ApiError { } export class ErrorResyncRequired extends ApiError { - public static httpCode: number = 400; + public static httpCode = 400; public constructor(message: string = 'Delta cursor is invalid and the complete data should be resynced') { super(message, ErrorResyncRequired.httpCode, ErrorCode.ResyncRequired); @@ -120,7 +120,7 @@ export class ErrorResyncRequired extends ApiError { } export class ErrorPayloadTooLarge extends ApiError { - public static httpCode: number = 413; + public static httpCode = 413; public constructor(message: string = 'Payload Too Large', options: ErrorOptions = null) { super(message, ErrorPayloadTooLarge.httpCode, options); @@ -129,8 +129,8 @@ export class ErrorPayloadTooLarge extends ApiError { } export class ErrorTooManyRequests extends ApiError { - public static httpCode: number = 429; - public retryAfterMs: number = 0; + public static httpCode = 429; + public retryAfterMs = 0; public constructor(message: string = null, retryAfterMs: number = 0) { super(message === null ? 'Too Many Requests' : message, ErrorTooManyRequests.httpCode); diff --git a/packages/server/src/utils/testing/koa/FakeResponse.ts b/packages/server/src/utils/testing/koa/FakeResponse.ts index e48a18763..511f5e90a 100644 --- a/packages/server/src/utils/testing/koa/FakeResponse.ts +++ b/packages/server/src/utils/testing/koa/FakeResponse.ts @@ -1,6 +1,6 @@ export default class FakeResponse { - public status: number = 200; + public status = 200; public body: any = null; private headers_: any = {};