mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-20 07:16:08 +08:00
Fix auto-fixable errors identified by the new versions of Typescript + ESLint
This commit is contained in:
parent
b13bcd5c0a
commit
ba2816f469
|
@ -194,7 +194,7 @@ class SidebarSection {
|
|||
//
|
||||
const items = [];
|
||||
const seenItems = {};
|
||||
for (let category of CategoryStore.userCategories(account)) {
|
||||
for (const category of CategoryStore.userCategories(account)) {
|
||||
// https://regex101.com/r/jK8cC2/1
|
||||
var item, parentKey;
|
||||
const re = RegExpUtils.subcategorySplitRegex();
|
||||
|
|
|
@ -87,7 +87,7 @@ class SidebarStore extends MailspringStore {
|
|||
_onSetCollapsedByName = (itemName: string, collapsed: boolean) => {
|
||||
let item = this.standardSection().items.find(i => i.name === itemName);
|
||||
if (!item) {
|
||||
for (let section of this.userSections()) {
|
||||
for (const section of this.userSections()) {
|
||||
item = _.findWhere(section.items, { name: itemName });
|
||||
if (item) {
|
||||
break;
|
||||
|
|
|
@ -84,7 +84,7 @@ class RootWithTimespan extends React.Component<
|
|||
accountIds: PropTypes.arrayOf(PropTypes.string),
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -234,7 +234,7 @@ class RootWithTimespan extends React.Component<
|
|||
}
|
||||
|
||||
// Aggregate open/link tracking of outbound threads by subject line
|
||||
let bySubject: { [subject: string]: SubjectStatsEntry } = {};
|
||||
const bySubject: { [subject: string]: SubjectStatsEntry } = {};
|
||||
for (const stats of outboundThreadStats) {
|
||||
if (!stats.tracked) {
|
||||
continue;
|
||||
|
|
|
@ -40,7 +40,7 @@ function buildShareHTML(htmlEl, styleEl) {
|
|||
}
|
||||
|
||||
export default class ShareButton extends React.Component<{}, { link: string; loading: boolean }> {
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_linkEl: HTMLInputElement;
|
||||
|
||||
constructor(props) {
|
||||
|
|
|
@ -46,8 +46,8 @@ export default class CategorySelection extends React.Component<
|
|||
_itemsForCategories(): CategoryItem[] {
|
||||
return this.props.all
|
||||
.sort((a, b) => {
|
||||
var pathA = utf7.imap.decode(a.path).toUpperCase();
|
||||
var pathB = utf7.imap.decode(b.path).toUpperCase();
|
||||
const pathA = utf7.imap.decode(a.path).toUpperCase();
|
||||
const pathB = utf7.imap.decode(b.path).toUpperCase();
|
||||
if (pathA < pathB) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ export default class SignaturePhotoPicker extends React.Component<
|
|||
const img = new Image();
|
||||
img.onload = () => {
|
||||
let scale = Math.min(MAX_IMAGE_RES / img.width, MAX_IMAGE_RES / img.height, 1);
|
||||
let scaleDesired = scale;
|
||||
const scaleDesired = scale;
|
||||
let source: any = img;
|
||||
|
||||
let times = 0;
|
||||
|
|
|
@ -56,7 +56,7 @@ export default class ComposerView extends React.Component<ComposerViewProps, Com
|
|||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_mouseDownTarget: HTMLElement = null;
|
||||
|
||||
dropzone = React.createRef<DropZone>();
|
||||
|
|
|
@ -17,7 +17,7 @@ class ContactsWindowStore extends MailspringStore {
|
|||
_contactsSubscription: MutableQuerySubscription<Contact>;
|
||||
_groups: ContactGroup[] = [];
|
||||
_books: ContactBook[] = [];
|
||||
_search: string = '';
|
||||
_search = '';
|
||||
_filtered: Contact[] | null = null;
|
||||
_editing: string | 'new' | false = false;
|
||||
|
||||
|
@ -84,7 +84,7 @@ class ContactsWindowStore extends MailspringStore {
|
|||
}
|
||||
|
||||
setPerspective(perspective: ContactsPerspective) {
|
||||
let q = DatabaseStore.findAll<Contact>(Contact)
|
||||
const q = DatabaseStore.findAll<Contact>(Contact)
|
||||
.where(Contact.attributes.refs.greaterThan(0))
|
||||
.where(Contact.attributes.hidden.equal(false));
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ export class EventHeader extends React.Component<EventHeaderProps, EventHeaderSt
|
|||
inflight: undefined,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_subscription: Rx.IDisposable;
|
||||
|
||||
componentWillUnmount() {
|
||||
|
|
|
@ -9,7 +9,7 @@ export default class CalendarDataSource {
|
|||
const end = Event.attributes.recurrenceEnd;
|
||||
const start = Event.attributes.recurrenceStart;
|
||||
|
||||
let matcher = new Matcher.Or([
|
||||
const matcher = new Matcher.Or([
|
||||
new Matcher.And([start.lte(endTime), end.gte(startTime)]),
|
||||
new Matcher.And([start.lte(endTime), start.gte(startTime)]),
|
||||
new Matcher.And([end.gte(startTime), end.lte(endTime)]),
|
||||
|
|
|
@ -59,7 +59,7 @@ export default class WeekView extends React.Component<
|
|||
};
|
||||
|
||||
_waitingForShift = 0;
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_sub?: Disposable;
|
||||
_lastWrapHeight: number;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ export default class EmailFrame extends React.Component<{ content: string }> {
|
|||
content: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_unlisten?: () => void;
|
||||
_iframeComponent: EventedIFrame;
|
||||
_iframeHeightHolderEl: HTMLDivElement;
|
||||
|
|
|
@ -21,12 +21,12 @@ export default class EmailFrame extends React.Component<EmailFrameProps> {
|
|||
showQuotedText: PropTypes.bool,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_unlisten: () => void;
|
||||
_iframeComponent: EventedIFrame;
|
||||
_iframeWrapperEl: HTMLDivElement;
|
||||
_iframeDocObserver: ResizeObserver;
|
||||
_lastFitSize: string = '';
|
||||
_lastFitSize = '';
|
||||
|
||||
componentDidMount() {
|
||||
this._mounted = true;
|
||||
|
|
|
@ -5,7 +5,7 @@ import React from 'react';
|
|||
export default class ModeToggle extends React.Component<{}, { hidden: boolean }> {
|
||||
static displayName = 'ModeToggle';
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_unsubscriber: () => void;
|
||||
column = WorkspaceStore.Location.MessageListSidebar;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export default class NewsletterSignup extends React.Component<
|
|||
emailAddress: PropTypes.string,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
|
@ -47,7 +47,7 @@ export default class OAuthSignInPage extends React.Component<
|
|||
_server?: http.Server;
|
||||
_startTimer: NodeJS.Timeout;
|
||||
_warnTimer: NodeJS.Timeout;
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
state: OAuthSignInPageState = {
|
||||
authStage: 'initial',
|
||||
|
|
|
@ -237,7 +237,7 @@ export default class SidebarParticipantProfile extends React.Component<
|
|||
order: 0,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
state: SidebarParticipantProfileState = {
|
||||
trialing: !IdentityStore.hasProFeatures(),
|
||||
|
|
|
@ -28,7 +28,7 @@ export default class RelatedThreads extends React.Component<
|
|||
threads: [],
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
componentDidMount() {
|
||||
this._mounted = true;
|
||||
|
|
|
@ -53,7 +53,7 @@ class ConfigSchemaItem extends React.Component<ConfigSchemaItemProps> {
|
|||
// In the future, we may add an option to reveal "advanced settings"
|
||||
if (this.props.configSchema.advanced) return false;
|
||||
|
||||
let note = this.props.configSchema.note ? (
|
||||
const note = this.props.configSchema.note ? (
|
||||
<div className="platform-note">{this.props.configSchema.note}</div>
|
||||
) : null;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class RefreshButton extends React.Component<{}, { refreshing: boolean }> {
|
|||
this.state = { refreshing: false };
|
||||
}
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
componentDidMount() {
|
||||
this._mounted = true;
|
||||
|
|
|
@ -15,7 +15,7 @@ const helper = new DefaultClientHelper();
|
|||
const service = new SystemStartService();
|
||||
|
||||
class DefaultMailClientItem extends React.Component<{}, DefaultMailClientItemState> {
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
state: DefaultMailClientItemState = { defaultClient: helper.available() ? false : 'unknown' };
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ export async function findMessage({ accountId, headerMessageId }) {
|
|||
|
||||
export async function transferReminderMetadataFromDraftToThread({ accountId, headerMessageId }) {
|
||||
let message = await findMessage({ accountId, headerMessageId });
|
||||
let delay = [1500, 1500, 10000, 10000];
|
||||
const delay = [1500, 1500, 10000, 10000];
|
||||
|
||||
// The sent message should already be synced, but if the send taks was interrupted and completed
|
||||
// without finalizing / cleaning up, we may need to go through a sync cycle. Do this before giving up.
|
||||
|
|
|
@ -16,7 +16,7 @@ import ThreadListIcon from './thread-list-icon';
|
|||
|
||||
// Get and format either last sent or last received timestamp depending on thread-list being viewed
|
||||
const ThreadListTimestamp = function({ thread }) {
|
||||
let rawTimestamp = FocusedPerspectiveStore.current().isSent()
|
||||
const rawTimestamp = FocusedPerspectiveStore.current().isSent()
|
||||
? thread.lastMessageSentTimestamp
|
||||
: thread.lastMessageReceivedTimestamp;
|
||||
const timestamp = rawTimestamp ? DateUtils.shortTimeString(rawTimestamp) : localized('No Date');
|
||||
|
|
|
@ -108,7 +108,7 @@ class ThreadListParticipants extends React.Component<{ thread: ThreadWithMessage
|
|||
continue;
|
||||
}
|
||||
|
||||
for (let contact of message[field]) {
|
||||
for (const contact of message[field]) {
|
||||
if (tokens.length === 0) {
|
||||
tokens.push({ contact, unread: message.unread });
|
||||
} else {
|
||||
|
|
|
@ -26,7 +26,7 @@ export default class ThreadSharingPopover extends React.Component<
|
|||
accountId: PropTypes.string,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_disposable?: any;
|
||||
|
||||
constructor(props) {
|
||||
|
|
|
@ -44,7 +44,7 @@ class SnoozePopover extends Component<{
|
|||
swipeCallback: () => {},
|
||||
};
|
||||
|
||||
didSnooze: boolean = false;
|
||||
didSnooze = false;
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.swipeCallback(this.didSnooze);
|
||||
|
|
|
@ -71,8 +71,8 @@ export class TranslateMessageHeader extends React.Component<
|
|||
> {
|
||||
static displayName = 'TranslateMessageHeader';
|
||||
|
||||
_mounted: boolean = false;
|
||||
_detectionStarted: boolean = false;
|
||||
_mounted = false;
|
||||
_detectionStarted = false;
|
||||
|
||||
state: TranslateMessageHeaderState = {
|
||||
detected: null,
|
||||
|
|
|
@ -184,13 +184,13 @@ function forEachTranslatableText(doc: Document, callback: (el: Node, text: strin
|
|||
// We maintain a cache of blocks of text we've translated. Because the user may have a whole
|
||||
// mailbox of very similar or templated emails, this can cut down on the amount of text we
|
||||
// need to translate for a new email dramatically.
|
||||
let translatedSnippetCache = new LRU<string, string>({ max: 1000 });
|
||||
const translatedSnippetCache = new LRU<string, string>({ max: 1000 });
|
||||
let translatedSnippetLang = '';
|
||||
|
||||
export async function translateMessageBody(
|
||||
html: string,
|
||||
targetLang?: string,
|
||||
silent: boolean = false
|
||||
silent = false
|
||||
): Promise<string | false> {
|
||||
if (translatedSnippetLang !== targetLang) {
|
||||
translatedSnippetCache.reset();
|
||||
|
|
|
@ -52,7 +52,7 @@ class Countdown extends React.Component<{ expiration: number }, { x: number }> {
|
|||
|
||||
render() {
|
||||
// subtract a few ms so we never round up to start time + 1 by accident
|
||||
let diff = Math.min(
|
||||
const diff = Math.min(
|
||||
Math.max(0, this.props.expiration - Date.now()),
|
||||
AppEnv.config.get('core.sending.undoSend')
|
||||
);
|
||||
|
|
|
@ -401,11 +401,11 @@ export default class AppEnvConstructor {
|
|||
// Extended: Move current window to the center of the screen.
|
||||
center() {
|
||||
if (process.platform === 'linux') {
|
||||
let dimensions = this.getWindowDimensions();
|
||||
let display =
|
||||
const dimensions = this.getWindowDimensions();
|
||||
const display =
|
||||
remote.screen.getDisplayMatching(dimensions) || remote.screen.getPrimaryDisplay();
|
||||
let x = display.bounds.x + (display.bounds.width - dimensions.width) / 2;
|
||||
let y = display.bounds.y + (display.bounds.height - dimensions.height) / 2;
|
||||
const x = display.bounds.x + (display.bounds.width - dimensions.width) / 2;
|
||||
const y = display.bounds.y + (display.bounds.height - dimensions.height) / 2;
|
||||
|
||||
return this.setPosition(x, y);
|
||||
} else {
|
||||
|
@ -849,7 +849,7 @@ export default class AppEnvConstructor {
|
|||
|
||||
restoreWindowState() {
|
||||
try {
|
||||
let stateString = window.localStorage.getItem(this.getWindowStateKey());
|
||||
const stateString = window.localStorage.getItem(this.getWindowStateKey());
|
||||
if (stateString != null) {
|
||||
this.savedState = JSON.parse(stateString);
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ export default class ApplicationMenu {
|
|||
// Returns an Array of native menu items.
|
||||
flattenMenuTemplate(template) {
|
||||
let items = [];
|
||||
for (let item of template) {
|
||||
for (const item of template) {
|
||||
items.push(item);
|
||||
if (item.submenu) {
|
||||
items = items.concat(this.flattenMenuTemplate(item.submenu));
|
||||
|
@ -132,7 +132,7 @@ export default class ApplicationMenu {
|
|||
// enable - If true enables all window specific items, if false disables all
|
||||
// window specific items.
|
||||
enableWindowSpecificItems(enable) {
|
||||
for (let item of this.flattenMenuItems(this.menu)) {
|
||||
for (const item of this.flattenMenuItems(this.menu)) {
|
||||
if (item.metadata && item.metadata['windowSpecific']) {
|
||||
item.enabled = enable;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ export default class ConfigPersistenceManager {
|
|||
}
|
||||
|
||||
try {
|
||||
let stat = fs.statSync(this.configDirPath);
|
||||
let configDirPathAccessMode = (stat.mode & parseInt('777', 8)).toString(8);
|
||||
const stat = fs.statSync(this.configDirPath);
|
||||
const configDirPathAccessMode = (stat.mode & parseInt('777', 8)).toString(8);
|
||||
if (configDirPathAccessMode !== '700') {
|
||||
fs.chmodSync(this.configDirPath, '700');
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ export default class BillingModal extends React.Component<BillingModalProps, Bil
|
|||
static IntrinsicWidth = 412;
|
||||
static IntrinsicHeight = 540;
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_initialZoom: number;
|
||||
|
||||
constructor(props) {
|
||||
|
|
|
@ -15,7 +15,7 @@ function nodeIsEmpty(node: Node) {
|
|||
}
|
||||
|
||||
if (node.object !== 'text') {
|
||||
let children = ((node.nodes.toArray ? node.nodes.toArray() : node.nodes) || []) as any;
|
||||
const children = ((node.nodes.toArray ? node.nodes.toArray() : node.nodes) || []) as any;
|
||||
if (children.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ export const BLOCK_CONFIG: {
|
|||
} else {
|
||||
const value = editor.value;
|
||||
// Collect all the text fragments which are being converted to a code block
|
||||
let texts = value.document
|
||||
const texts = value.document
|
||||
.getTextsAtRange(value.selection as any)
|
||||
.toArray()
|
||||
.map(t => {
|
||||
|
@ -258,7 +258,7 @@ const rules = [
|
|||
|
||||
// div elements that are entirely empty and have no meaningful-looking styles applied
|
||||
// would probably just add extra whitespace
|
||||
let empty = !el.hasChildNodes();
|
||||
const empty = !el.hasChildNodes();
|
||||
if (tagName === 'div' && empty) {
|
||||
const s = (el.getAttribute('style') || '').toLowerCase();
|
||||
if (!s.includes('background') && !s.includes('margin') && !s.includes('padding')) {
|
||||
|
|
|
@ -16,8 +16,8 @@ export default class ComposerEditorToolbar extends React.Component<
|
|||
ComposerEditorToolbarProps,
|
||||
ComposerEditorToolbarState
|
||||
> {
|
||||
_mounted: boolean = false;
|
||||
_topClip: number = 0;
|
||||
_mounted = false;
|
||||
_topClip = 0;
|
||||
_el: HTMLElement;
|
||||
_floatingEl: HTMLElement;
|
||||
_heightObserver: ResizeObserver;
|
||||
|
@ -63,7 +63,7 @@ export default class ComposerEditorToolbar extends React.Component<
|
|||
|
||||
_onScroll = () => {
|
||||
if (!this._el) return;
|
||||
let { top, height } = this._el.getBoundingClientRect();
|
||||
const { top, height } = this._el.getBoundingClientRect();
|
||||
const max = this._el.parentElement.clientHeight - height;
|
||||
|
||||
if (top < this._topClip) {
|
||||
|
@ -78,7 +78,7 @@ export default class ComposerEditorToolbar extends React.Component<
|
|||
render() {
|
||||
const { editor, plugins, value } = this.props;
|
||||
|
||||
let sectionItems = [];
|
||||
const sectionItems = [];
|
||||
|
||||
if (!this.state.visible) {
|
||||
return (
|
||||
|
|
|
@ -261,7 +261,7 @@ on the result. */
|
|||
};
|
||||
|
||||
return mark.nodes.reduce(function(nodes, node) {
|
||||
var ret = applyMark(node);
|
||||
const ret = applyMark(node);
|
||||
if (Array.isArray(ret)) return nodes.concat(ret);
|
||||
nodes.push(ret);
|
||||
return nodes;
|
||||
|
|
|
@ -41,7 +41,7 @@ export default class EmojiToolbarPopover extends React.Component<
|
|||
static displayName = 'EmojiToolbarPopover';
|
||||
|
||||
_canvasEl: HTMLCanvasElement;
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_emojiPreloadImage = new Image();
|
||||
|
||||
constructor(props) {
|
||||
|
|
|
@ -28,7 +28,7 @@ class DateInput extends Component<DateInputProps, DateInputState> {
|
|||
onDateSubmitted: () => {},
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
|
@ -126,7 +126,7 @@ export default function HasTutorialTip(ComposedComponent, TipConfig) {
|
|||
|
||||
_workspaceTimer?: NodeJS.Timeout;
|
||||
_themesTimer?: NodeJS.Timeout;
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_disposables: Disposable[];
|
||||
_unlisteners = [];
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ class EmptyListState extends React.Component<
|
|||
static displayName = 'EmptyListState';
|
||||
static propTypes = { visible: PropTypes.bool.isRequired };
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_unlisteners = [];
|
||||
|
||||
constructor(props) {
|
||||
|
@ -163,7 +163,7 @@ class EmptyListState extends React.Component<
|
|||
|
||||
componentWillUnmount() {
|
||||
this._mounted = false;
|
||||
for (let unlisten of Array.from(this._unlisteners)) {
|
||||
for (const unlisten of Array.from(this._unlisteners)) {
|
||||
unlisten();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ export class EventedIFrame extends React.Component<
|
|||
const nodeRect = node.getBoundingClientRect();
|
||||
|
||||
const eventAttrs = {};
|
||||
for (let key of Object.keys(event)) {
|
||||
for (const key of Object.keys(event)) {
|
||||
if (['webkitMovementX', 'webkitMovementY'].includes(key)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ export class EventedIFrame extends React.Component<
|
|||
new MenuItem({
|
||||
label: localized('Copy Image'),
|
||||
click() {
|
||||
let img = new Image();
|
||||
const img = new Image();
|
||||
img.addEventListener(
|
||||
'load',
|
||||
function() {
|
||||
|
|
|
@ -87,7 +87,7 @@ export class InjectedComponentSet extends React.Component<
|
|||
containersRequired: true,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_componentUnlistener?: () => void;
|
||||
|
||||
constructor(props, context) {
|
||||
|
|
|
@ -117,11 +117,11 @@ export class KeyCommandsRegion extends React.Component<
|
|||
|
||||
_lastFocusElement: HTMLElement = null;
|
||||
_losingFocusToElement: HTMLElement = null;
|
||||
_losingFocusFrames: number = 0;
|
||||
_losingFocusFrames = 0;
|
||||
_lostFocusToElement: HTMLElement = null;
|
||||
_localDisposable?: Disposable;
|
||||
_globalDisposable?: Disposable;
|
||||
_goingout: boolean = false;
|
||||
_goingout = false;
|
||||
|
||||
state = {
|
||||
focused: false,
|
||||
|
|
|
@ -47,7 +47,7 @@ class MailImportantIcon extends React.Component<MailImportantIconProps, MailImpo
|
|||
|
||||
if (props.showIfAvailableForAnyAccount) {
|
||||
const perspective = FocusedPerspectiveStore.current();
|
||||
for (let accountId of perspective.accountIds) {
|
||||
for (const accountId of perspective.accountIds) {
|
||||
const account = AccountStore.accountForId(accountId);
|
||||
const accountImportant = CategoryStore.getCategoryByRole(account, 'important');
|
||||
if (accountImportant) {
|
||||
|
|
|
@ -202,7 +202,7 @@ export class Menu extends React.Component<MenuProps, MenuState> {
|
|||
|
||||
static defaultProps = { onEscape() {} };
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
|
@ -25,7 +25,7 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|||
width: PropTypes.number,
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
state = {
|
||||
offset: 0,
|
||||
|
|
|
@ -280,7 +280,7 @@ export class ScrollRegion extends React.Component<
|
|||
// Concept from https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITableView_Class/#//apple_ref/c/tdef/UITableViewScrollPosition
|
||||
static Scrollbar = Scrollbar;
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_scrollToTaskId = 0;
|
||||
_scrollbarComponent = null;
|
||||
_totalHeightObserver = null;
|
||||
|
|
|
@ -36,7 +36,7 @@ export default class TimePicker extends React.Component<TimePickerProps, TimePic
|
|||
onChange: () => {},
|
||||
};
|
||||
|
||||
_gotoScrollStartOnUpdate: boolean = false;
|
||||
_gotoScrollStartOnUpdate = false;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
|
@ -422,7 +422,7 @@ export class TokenizingTextField extends React.Component<
|
|||
tokenClassNames: () => '',
|
||||
};
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
|
@ -93,7 +93,7 @@ type WebviewState = {
|
|||
export default class Webview extends React.Component<WebviewProps, WebviewState> {
|
||||
static displayName = 'Webview';
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_disposable?: Disposable;
|
||||
|
||||
state: WebviewState = {
|
||||
|
|
|
@ -291,9 +291,9 @@ export default class Config {
|
|||
}
|
||||
|
||||
static addSchemaEnforcers(filters) {
|
||||
for (var typeName in filters) {
|
||||
var functions = filters[typeName];
|
||||
for (let name in functions) {
|
||||
for (const typeName in filters) {
|
||||
const functions = filters[typeName];
|
||||
for (const name in functions) {
|
||||
const enforcerFunction = functions[name];
|
||||
this.addSchemaEnforcer(typeName, enforcerFunction);
|
||||
}
|
||||
|
@ -306,10 +306,10 @@ export default class Config {
|
|||
if (!Array.isArray(types)) {
|
||||
types = [types];
|
||||
}
|
||||
for (let type of types) {
|
||||
for (const type of types) {
|
||||
try {
|
||||
const enforcerFunctions = this.schemaEnforcers[type].concat(this.schemaEnforcers['*']);
|
||||
for (let enforcer of enforcerFunctions) {
|
||||
for (const enforcer of enforcerFunctions) {
|
||||
// At some point in one's life, one must call upon an enforcer.
|
||||
value = enforcer.call(this, keyPath, value, schema);
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ export default class Config {
|
|||
getSchema(keyPath) {
|
||||
const keys = splitKeyPath(keyPath);
|
||||
let { schema } = this;
|
||||
for (let key of keys) {
|
||||
for (const key of keys) {
|
||||
if (schema == null) {
|
||||
break;
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ export default class Config {
|
|||
|
||||
let rootSchema = this.schema;
|
||||
if (keyPath) {
|
||||
for (let key of splitKeyPath(keyPath)) {
|
||||
for (const key of splitKeyPath(keyPath)) {
|
||||
rootSchema.type = 'object';
|
||||
if (rootSchema.properties == null) {
|
||||
rootSchema.properties = {};
|
||||
|
@ -650,7 +650,7 @@ export default class Config {
|
|||
setDefaults(keyPath: string, defaults) {
|
||||
if (defaults != null && isPlainObject(defaults)) {
|
||||
const keys = splitKeyPath(keyPath);
|
||||
for (let key in defaults) {
|
||||
for (const key in defaults) {
|
||||
const childValue = defaults[key];
|
||||
if (!defaults.hasOwnProperty(key)) {
|
||||
continue;
|
||||
|
@ -690,7 +690,7 @@ export default class Config {
|
|||
) {
|
||||
const defaults = {};
|
||||
const properties = schema.properties || {};
|
||||
for (let key in properties) {
|
||||
for (const key in properties) {
|
||||
const value = properties[key];
|
||||
defaults[key] = this.extractDefaultsFromSchema(value);
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ export default class Config {
|
|||
}
|
||||
|
||||
makeValueConformToSchema(keyPath, value) {
|
||||
let schema = this.getSchema(keyPath);
|
||||
const schema = this.getSchema(keyPath);
|
||||
if (schema) {
|
||||
value = Config.executeSchemaEnforcers(keyPath, value, schema);
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ Config.addSchemaEnforcers({
|
|||
}
|
||||
|
||||
const newValue = {};
|
||||
for (let prop in value) {
|
||||
for (const prop in value) {
|
||||
const propValue = value[prop];
|
||||
const childSchema = schema.properties[prop];
|
||||
if (childSchema != null) {
|
||||
|
@ -872,7 +872,7 @@ Config.addSchemaEnforcers({
|
|||
const itemSchema = schema.items;
|
||||
if (itemSchema != null) {
|
||||
const newValue = [];
|
||||
for (let item of value) {
|
||||
for (const item of value) {
|
||||
try {
|
||||
newValue.push(this.executeSchemaEnforcers(keyPath, item, itemSchema));
|
||||
} catch (error) {
|
||||
|
@ -906,7 +906,7 @@ Config.addSchemaEnforcers({
|
|||
return value;
|
||||
}
|
||||
|
||||
for (let possibleValue of possibleValues) {
|
||||
for (const possibleValue of possibleValues) {
|
||||
// Using `isEqual` for possibility of placing enums on array and object schemas
|
||||
if (_.isEqual(possibleValue, value)) {
|
||||
return value;
|
||||
|
@ -945,7 +945,7 @@ var splitKeyPath = function(keyPath) {
|
|||
var withoutEmptyObjects = function(object) {
|
||||
let resultObject = undefined;
|
||||
if (isPlainObject(object)) {
|
||||
for (let key in object) {
|
||||
for (const key in object) {
|
||||
const value = object[key];
|
||||
const newValue = withoutEmptyObjects(value);
|
||||
if (newValue != null) {
|
||||
|
|
|
@ -27,7 +27,7 @@ function InflatesDraftClientId(
|
|||
|
||||
static containerRequired = false;
|
||||
|
||||
_mounted: boolean = false;
|
||||
_mounted = false;
|
||||
_sessionUnlisten?: () => void;
|
||||
|
||||
constructor(props) {
|
||||
|
|
|
@ -28,7 +28,7 @@ var DOMUtils = {
|
|||
if (node.nodeType === Node.TEXT_NODE) {
|
||||
return node;
|
||||
}
|
||||
for (let childNode of node.childNodes) {
|
||||
for (const childNode of node.childNodes) {
|
||||
if (childNode.nodeType === Node.TEXT_NODE) {
|
||||
return childNode;
|
||||
} else if (childNode.nodeType === Node.ELEMENT_NODE) {
|
||||
|
|
|
@ -57,7 +57,7 @@ export async function postStaticAsset({ filename, blob }) {
|
|||
} else {
|
||||
body.set('file', blob, filename);
|
||||
}
|
||||
let resp = await makeRequest({
|
||||
const resp = await makeRequest({
|
||||
server: 'identity',
|
||||
method: 'POST',
|
||||
path: `/api/save-public-asset`,
|
||||
|
|
|
@ -79,7 +79,7 @@ export function convertToModel(json) {
|
|||
|
||||
export function fastOmit(props, without) {
|
||||
const otherProps = Object.assign({}, props);
|
||||
for (let w of without) {
|
||||
for (const w of without) {
|
||||
delete otherProps[w];
|
||||
}
|
||||
return otherProps;
|
||||
|
@ -94,9 +94,9 @@ export function escapeRegExp(str) {
|
|||
}
|
||||
|
||||
export function range(left, right, inclusive = true) {
|
||||
let range = [];
|
||||
let ascending = left < right;
|
||||
let end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
||||
const range = [];
|
||||
const ascending = left < right;
|
||||
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
||||
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
||||
range.push(i);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ export function deepClone(object, customizer?, stackSeen = [], stackRefs = []) {
|
|||
|
||||
// It's important to use getOwnPropertyNames instead of Object.keys to
|
||||
// get the non-enumerable items as well.
|
||||
for (let key of Object.getOwnPropertyNames(object)) {
|
||||
for (const key of Object.getOwnPropertyNames(object)) {
|
||||
const newVal = deepClone(object[key], customizer, stackSeen, stackRefs);
|
||||
if (_.isFunction(customizer)) {
|
||||
newObject[key] = customizer(key, newVal);
|
||||
|
@ -158,7 +158,7 @@ export function deepClone(object, customizer?, stackSeen = [], stackRefs = []) {
|
|||
|
||||
export function toSet(arr = []) {
|
||||
const set = {};
|
||||
for (let item of arr) {
|
||||
for (const item of arr) {
|
||||
set[item] = true;
|
||||
}
|
||||
return set;
|
||||
|
|
|
@ -80,7 +80,7 @@ class ContactStore extends MailspringStore {
|
|||
.where(Contact.attributes.hidden.equal(false))
|
||||
.order(Contact.attributes.refs.descending())
|
||||
.then(async _results => {
|
||||
let results = this._distinctByEmail(this._omitFindInMailDisabled(_results));
|
||||
const results = this._distinctByEmail(this._omitFindInMailDisabled(_results));
|
||||
if (results.length > limit) {
|
||||
results.length = limit;
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ class DatabaseStore extends MailspringStore {
|
|||
//
|
||||
// If a query is made before the database has been opened, the query will be
|
||||
// held in a queue and run / resolved when the database is ready.
|
||||
_query(query: SQLString, values: SQLValue[] = [], background: boolean = false) {
|
||||
_query(query: SQLString, values: SQLValue[] = [], background = false) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (!this._open) {
|
||||
this._waiting.push(() => this._query(query, values).then(resolve, reject));
|
||||
|
|
|
@ -180,7 +180,7 @@ export class DraftEditingSession extends MailspringStore {
|
|||
|
||||
_draft: MessageWithEditorState = null;
|
||||
_draftPromise: Promise<Message> = null;
|
||||
_destroyed: boolean = false;
|
||||
_destroyed = false;
|
||||
_mountedEditor: Editor | null = null;
|
||||
|
||||
headerMessageId: string;
|
||||
|
|
|
@ -82,7 +82,7 @@ class FeatureUsageStore extends MailspringStore {
|
|||
} else {
|
||||
headerText = headerText || localized("You've reached your quota");
|
||||
|
||||
let time = featureData.period === 'monthly' ? localized('month') : localized('week');
|
||||
const time = featureData.period === 'monthly' ? localized('month') : localized('week');
|
||||
rechargeText = rechargeText.replace('%1$@', featureData.quota).replace('%2$@', time);
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ class _IdentityStore extends MailspringStore {
|
|||
qs.utm_content = content;
|
||||
}
|
||||
|
||||
let pathWithUtm = url.parse(path, true);
|
||||
const pathWithUtm = url.parse(path, true);
|
||||
pathWithUtm.query = Object.assign({}, qs, pathWithUtm.query || {});
|
||||
|
||||
const pathWithUtmString = url.format({
|
||||
|
|
|
@ -16,7 +16,7 @@ const FolderNamesHiddenByDefault = ['spam', 'trash'];
|
|||
class _MessageStore extends MailspringStore {
|
||||
FolderNamesHiddenByDefault = FolderNamesHiddenByDefault;
|
||||
|
||||
_showingHiddenItems: boolean = false;
|
||||
_showingHiddenItems = false;
|
||||
_items?: Message[];
|
||||
_thread?: Thread;
|
||||
_itemsExpanded: { [messageId: string]: 'explicit' | 'default' };
|
||||
|
@ -200,7 +200,7 @@ class _MessageStore extends MailspringStore {
|
|||
}
|
||||
|
||||
_setWindowTitle() {
|
||||
let title = 'Mailspring' + (this._thread ? ' · ' + this._thread.subject : '');
|
||||
const title = 'Mailspring' + (this._thread ? ' · ' + this._thread.subject : '');
|
||||
electron.remote.getCurrentWindow().setTitle(title);
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ class _MessageStore extends MailspringStore {
|
|||
}
|
||||
|
||||
_fetchExpandedAttachments(items) {
|
||||
for (let item of items) {
|
||||
for (const item of items) {
|
||||
if (!this._itemsExpanded[item.id]) continue;
|
||||
item.files.map(file => Actions.fetchFile(file));
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ class WorkspaceStore extends MailspringStore {
|
|||
defineSheet(id, options: Partial<SheetDeclaration> = {}, columns = {}) {
|
||||
// Make sure all the locations have definitions so that packages
|
||||
// can register things into these locations and their toolbars.
|
||||
for (let layout in columns) {
|
||||
for (const layout in columns) {
|
||||
const cols = columns[layout];
|
||||
for (let idx = 0; idx < cols.length; idx++) {
|
||||
const col = cols[idx];
|
||||
|
|
|
@ -236,7 +236,7 @@ export function localizedReactFragment(en, ...subs) {
|
|||
// Support "%@ and %@" OR "%1$@ and %2$@" which allows for param reordering.
|
||||
// The translation may contain this format even if the original string does not.
|
||||
|
||||
let parts = [];
|
||||
const parts = [];
|
||||
let match = null;
|
||||
let used = 0;
|
||||
while ((match = /%(?:(\d)+\$)?@/g.exec(translated))) {
|
||||
|
|
|
@ -107,7 +107,7 @@ export default class KeymapManager {
|
|||
_removeTemplate?: Disposable;
|
||||
_bindingsCache: {};
|
||||
_commandsCache: {};
|
||||
_altKeyDown: boolean = false;
|
||||
_altKeyDown = false;
|
||||
_altKeyTimer: NodeJS.Timeout = null;
|
||||
|
||||
EVENT_ALT_KEY_STATE_CHANGE = 'alt-key-state-change';
|
||||
|
|
|
@ -224,7 +224,7 @@ function getIconFromTheme(
|
|||
scale: 1 | 2 = 1
|
||||
) {
|
||||
const icons = __getAllIconPaths(theme, iconName, size, contexts, scale);
|
||||
for (let path of icons) {
|
||||
for (const path of icons) {
|
||||
if (fs.existsSync(path)) {
|
||||
return fs.realpathSync(path);
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ function getIconPath(iconName: string, size: number, context: string | string[],
|
|||
}
|
||||
|
||||
// in case the icon was not found in the theme, we search the inherited themes
|
||||
for (let key of inherits) {
|
||||
for (const key of inherits) {
|
||||
const inheritsTheme = getIconTheme(inherits[key]);
|
||||
if (!inheritsTheme) continue;
|
||||
icon = getIconFromTheme(inheritsTheme, iconName, size, context);
|
||||
|
|
|
@ -530,7 +530,7 @@ class CategoryMailboxPerspective extends MailboxPerspective {
|
|||
// - if finished category === "archive" remove the label
|
||||
// - if finished category === "trash" move to trash folder, keep labels intact
|
||||
//
|
||||
tasksForRemovingItems(threads, source: string = 'Removed from list') {
|
||||
tasksForRemovingItems(threads, source = 'Removed from list') {
|
||||
ChangeLabelsTask =
|
||||
ChangeLabelsTask || require('./flux/tasks/change-labels-task').ChangeLabelsTask;
|
||||
ChangeFolderTask =
|
||||
|
|
|
@ -160,7 +160,7 @@ export class MailsyncProcess extends EventEmitter {
|
|||
// attached yet, but will be by the caller of spawnProcess.
|
||||
if (this.account && this._proc.stdout) {
|
||||
this._proc.stdout.once('data', () => {
|
||||
var rs = new Readable();
|
||||
const rs = new Readable();
|
||||
rs.push(`${JSON.stringify(this.account)}\n${JSON.stringify(this.identity)}\n`);
|
||||
rs.push(null);
|
||||
rs.pipe(this._proc.stdin, { end: false });
|
||||
|
|
|
@ -58,7 +58,7 @@ export function unmerge(menu: IMenuItem[], item: IMenuItem) {
|
|||
|
||||
if (matchingItem != null) {
|
||||
if (item.submenu != null) {
|
||||
for (let submenuItem of Array.from(item.submenu)) {
|
||||
for (const submenuItem of Array.from(item.submenu)) {
|
||||
unmerge(matchingItem.submenu, submenuItem);
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ export function cloneMenuItem(item: IMenuItem) {
|
|||
|
||||
export function forEachMenuItem(menu: IMenuItem[], callback: (item: IMenuItem) => void) {
|
||||
const result = [];
|
||||
for (let item of Array.from(menu)) {
|
||||
for (const item of Array.from(menu)) {
|
||||
if (item.submenu != null) {
|
||||
forEachMenuItem(item.submenu, callback);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { File } from 'mailspring-exports';
|
|||
|
||||
let quickPreviewWindow = null;
|
||||
let captureWindow = null;
|
||||
let captureQueue = [];
|
||||
const captureQueue = [];
|
||||
|
||||
const FileSizeLimit = 5 * 1024 * 1024;
|
||||
const ThumbnailWidth = 320 * (11 / 8.5);
|
||||
|
|
|
@ -6,7 +6,7 @@ export default class CommandRegistry {
|
|||
emitter = new Emitter();
|
||||
listenerCounts = {};
|
||||
listenerCountChanges = {};
|
||||
pendingEmit: boolean = false;
|
||||
pendingEmit = false;
|
||||
|
||||
add(
|
||||
target: Element,
|
||||
|
|
|
@ -18,7 +18,7 @@ class ComponentRegistry extends MailspringStore {
|
|||
};
|
||||
} = {};
|
||||
_cache = {};
|
||||
_showComponentRegions: boolean = false;
|
||||
_showComponentRegions = false;
|
||||
|
||||
// Public: Register a new component with the Component Registry.
|
||||
// Typically, packages call this method from their main `activate` method
|
||||
|
|
|
@ -423,7 +423,7 @@ class QuotedHTMLTransformer {
|
|||
// This traverses the DOM, walking up the tree and adding all siblings below
|
||||
// our current path to the array.
|
||||
let head = headerContainer;
|
||||
let results = [];
|
||||
const results = [];
|
||||
while (head) {
|
||||
results.push(head);
|
||||
while (head && !head.nextElementSibling) {
|
||||
|
|
|
@ -451,7 +451,7 @@ class SanitizeTransformer {
|
|||
Preset = Preset;
|
||||
|
||||
sanitizeNode(node: Element, settings) {
|
||||
let nodeName = node.nodeName.toLowerCase();
|
||||
const nodeName = node.nodeName.toLowerCase();
|
||||
if (nodeName === '#text') {
|
||||
return true; // text nodes are always safe, don't need to clone them
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ class SanitizeTransformer {
|
|||
|
||||
// Nodes with text contents / no contents: replace with a `span` with the same children.
|
||||
// This allows us to ignore things like tables / table cells and still get their contents.
|
||||
let replacementNode = document.createElement('span');
|
||||
const replacementNode = document.createElement('span');
|
||||
for (const child of Array.from(node.childNodes)) {
|
||||
replacementNode.appendChild(child);
|
||||
}
|
||||
|
@ -517,8 +517,8 @@ class SanitizeTransformer {
|
|||
|
||||
async run(body, settings) {
|
||||
if (settings.fragment) {
|
||||
var doc = document.implementation.createHTMLDocument();
|
||||
var div = doc.createElement('div');
|
||||
const doc = document.implementation.createHTMLDocument();
|
||||
const div = doc.createElement('div');
|
||||
div.innerHTML = body;
|
||||
this.sanitizeNode(div, settings);
|
||||
return div.innerHTML;
|
||||
|
|
|
@ -315,7 +315,7 @@ const parseOrQuery = (text: string) => {
|
|||
};
|
||||
|
||||
const parseAndQuery = text => {
|
||||
let [lhs, afterLhs] = parseOrQuery(text);
|
||||
const [lhs, afterLhs] = parseOrQuery(text);
|
||||
let [tok, afterTok] = nextToken(afterLhs);
|
||||
if (tok === null) {
|
||||
return [lhs, afterLhs];
|
||||
|
|
|
@ -61,7 +61,7 @@ export default class SheetContainer extends React.Component<{}, SheetContainerSt
|
|||
this.setState(this._getStateFromStores());
|
||||
};
|
||||
|
||||
_lastToolbarClickTime: number = 0;
|
||||
_lastToolbarClickTime = 0;
|
||||
|
||||
_onToolbarDoubleClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (process.platform !== 'darwin') return;
|
||||
|
|
|
@ -226,7 +226,7 @@ export default class Toolbar extends React.Component<ToolbarProps, ToolbarState>
|
|||
sheetDepth: PropTypes.number,
|
||||
};
|
||||
|
||||
mounted: boolean = false;
|
||||
mounted = false;
|
||||
unlisteners: Array<() => void> = [];
|
||||
|
||||
constructor(props) {
|
||||
|
|
|
@ -197,7 +197,7 @@ export default class ThemeManager {
|
|||
|
||||
cssContentsOfLessStylesheet(lessStylesheetPath) {
|
||||
try {
|
||||
let less = fs.readFileSync(lessStylesheetPath, 'utf8').toString();
|
||||
const less = fs.readFileSync(lessStylesheetPath, 'utf8').toString();
|
||||
return this.lessCache.cssForFile(lessStylesheetPath, less);
|
||||
} catch (error) {
|
||||
let message = `Error loading Less stylesheet: ${lessStylesheetPath}`;
|
||||
|
|
Loading…
Reference in a new issue