1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-02 12:47:41 +02:00

Tools: Apply eslint rule @typescript-eslint/no-inferrable-types with ignoreProperties=false

This commit is contained in:
Laurent Cozic 2023-06-30 09:07:03 +01:00
parent 667bb19765
commit 315f071337
34 changed files with 73 additions and 73 deletions

View File

@ -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',

View File

@ -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;

View File

@ -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();

View File

@ -12,8 +12,8 @@ interface Props {
export default class NoteTextViewerComponent extends React.Component<Props, any> {
private initialized_: boolean = false;
private domReady_: boolean = false;
private initialized_ = false;
private domReady_ = false;
private webviewRef_: any;
private webviewListeners_: any = null;

View File

@ -26,7 +26,7 @@ export default class PromptDialog extends React.Component<Props, any> {
private focusInput_: boolean;
private styles_: any;
private styleKey_: string;
private menuIsOpened_: boolean = false;
private menuIsOpened_ = false;
public constructor(props: Props) {
super(props);

View File

@ -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[] = [

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -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 = {};

View File

@ -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;

View File

@ -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() {

View File

@ -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;

View File

@ -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() {

View File

@ -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;

View File

@ -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);

View File

@ -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 : '';

View File

@ -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) {

View File

@ -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();

View File

@ -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<string, Function> = {};
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);

View File

@ -87,7 +87,7 @@ export default class PluginService extends BaseService {
private plugins_: Plugins = {};
private runner_: BasePluginRunner = null;
private startedPlugins_: Record<string, boolean> = {};
private isSafeMode_: boolean = false;
private isSafeMode_ = false;
public initialize(appVersion: string, platformImplementation: any, runner: BasePluginRunner, store: any) {
this.appVersion_ = appVersion;

View File

@ -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;

View File

@ -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[] = [];

View File

@ -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_;

View File

@ -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 = {};

View File

@ -68,7 +68,7 @@ export interface ItemLoadOptions extends LoadOptions {
export default class ItemModel extends BaseModel<Item> {
private updatingTotalSizes_: boolean = false;
private updatingTotalSizes_ = false;
private storageDriverConfig_: StorageDriverConfig;
private storageDriverConfigFallback_: StorageDriverConfig;

View File

@ -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;

View File

@ -67,7 +67,7 @@ export default class MustacheService {
private viewDir_: string;
private baseAssetUrl_: string;
private prefersDarkEnabled_: boolean = true;
private prefersDarkEnabled_ = true;
private partials_: Record<string, string> = {};
private fileContentCache_: Record<string, string> = {};

View File

@ -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

View File

@ -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;

View File

@ -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) {

View File

@ -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);

View File

@ -1,6 +1,6 @@
export default class FakeResponse {
public status: number = 200;
public status = 200;
public body: any = null;
private headers_: any = {};