mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-26 10:00:50 +08:00
Fix remaining lint errors, make travis run tests and linters
This commit is contained in:
parent
24e4c5d591
commit
97e36cb1d9
21 changed files with 58 additions and 107 deletions
|
@ -78,6 +78,8 @@ before_install:
|
|||
|
||||
script:
|
||||
- npm run ci-setup-mac-keychain
|
||||
- npm run lint
|
||||
- npm test
|
||||
- mailsync/build.sh
|
||||
- mv ./mailsync ./mailsync-src
|
||||
- DEBUG=electron-packager,electron-osx-sign npm run build
|
||||
|
|
|
@ -64,14 +64,6 @@ module.exports = grunt => {
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: Comment me in if you want to fix these files.
|
||||
// _str = require('underscore.string')
|
||||
// replacer = (match, describeName) ->
|
||||
// fnName = _str.camelize(describeName, true)
|
||||
// return "\ndescribe('#{describeName}', function #{fnName}() "
|
||||
// newContent = content.replace(describeRe, replacer)
|
||||
// fs.writeFileSync(f, newContent, encoding:'utf8')
|
||||
|
||||
// Build the list of ES6 files that export things and categorize
|
||||
for (const f of fileset.src) {
|
||||
if (!esExtensions[path.extname(f)]) {
|
||||
|
@ -80,12 +72,6 @@ module.exports = grunt => {
|
|||
const lookupPath = `${path.dirname(f)}/${path.basename(f, path.extname(f))}`;
|
||||
const content = fs.readFileSync(f, { encoding: 'utf8' });
|
||||
|
||||
if (/module.exports\s?=\s?.+/gim.test(content)) {
|
||||
if (!f.endsWith('mailspring-exports.es6')) {
|
||||
errors.push(`${f}: Don't use module.exports in ES6`);
|
||||
}
|
||||
}
|
||||
|
||||
if (/^export/gim.test(content)) {
|
||||
if (/^export default/gim.test(content)) {
|
||||
esExportDefault[lookupPath] = true;
|
||||
|
@ -97,26 +83,6 @@ module.exports = grunt => {
|
|||
}
|
||||
}
|
||||
|
||||
// Now look again through all ES6 files, this time to check imports
|
||||
// instead of exports.
|
||||
for (const f of fileset.src) {
|
||||
let result = null;
|
||||
if (!esExtensions[path.extname(f)]) {
|
||||
continue;
|
||||
}
|
||||
const content = fs.readFileSync(f, { encoding: 'utf8' });
|
||||
const importRe = /import \{.*\} from ['"](.*?)['"]/gim;
|
||||
|
||||
while ((result = importRe.exec(content))) {
|
||||
for (const requirePath of result.slice(1)) {
|
||||
const lookupPath = normalizeRequirePath(requirePath, f);
|
||||
if (esExportDefault[lookupPath] || esNoExport[lookupPath]) {
|
||||
errors.push(`${f}: Don't destructure default export ${requirePath}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now look through all coffeescript files
|
||||
// If they require things from ES6 files, ensure they're using the
|
||||
// proper syntax.
|
||||
|
|
|
@ -25,7 +25,7 @@ describe 'MovePickerPopover', ->
|
|||
beforeEach ->
|
||||
CategoryStore._categoryCache = {}
|
||||
|
||||
setupFor = () ->
|
||||
setupFor = ->
|
||||
@account = {
|
||||
id: TEST_ACCOUNT_ID
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ describe 'MovePickerPopover', ->
|
|||
spyOn(FocusedPerspectiveStore, 'current').andCallFake =>
|
||||
MailboxPerspective.forCategory(@inboxCategory)
|
||||
|
||||
setupForCreateNew = () ->
|
||||
setupForCreateNew = ->
|
||||
setupFor.call(@)
|
||||
|
||||
@testThread = new Thread(id: 't1', subject: "fake", accountId: TEST_ACCOUNT_ID, categories: [])
|
||||
|
|
|
@ -381,9 +381,9 @@ class PreferencesTemplates extends React.Component {
|
|||
</p>
|
||||
<p>
|
||||
Reply templates are saved as HTML files in the{' '}
|
||||
<strong>{`${AppEnv.getConfigDirPath()}/templates`}</strong> directory on your
|
||||
computer. In raw HTML, variables are defined as HTML <code> tags with class
|
||||
"var empty".
|
||||
<strong>{`${AppEnv.getConfigDirPath()}/templates`}</strong> directory on your computer.
|
||||
In raw HTML, variables are defined as HTML <code> tags with class "var
|
||||
empty".
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import React, { Component } from 'react';
|
||||
import { ListensToObservable, MultiselectToolbar, InjectedComponentSet } from 'mailspring-component-kit';
|
||||
import {
|
||||
ListensToObservable,
|
||||
MultiselectToolbar,
|
||||
InjectedComponentSet,
|
||||
} from 'mailspring-component-kit';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import DraftListStore from './draft-list-store';
|
||||
|
|
|
@ -2,11 +2,11 @@ import React, { Component } from 'react';
|
|||
import PropTypes from 'prop-types';
|
||||
import ReactDOM from 'react-dom';
|
||||
import moment from 'moment';
|
||||
import { Actions, NylasAPIHelpers, FeatureUsageStore } from 'mailspring-exports';
|
||||
import { Actions, FeatureUsageStore } from 'mailspring-exports';
|
||||
import { RetinaImg } from 'mailspring-component-kit';
|
||||
|
||||
import SendLaterPopover from './send-later-popover';
|
||||
import { PLUGIN_ID, PLUGIN_NAME } from './send-later-constants';
|
||||
import { PLUGIN_ID } from './send-later-constants';
|
||||
|
||||
function sendLaterDateForDraft(draft) {
|
||||
return ((draft && draft.metadataForPluginId(PLUGIN_ID)) || {}).expiration;
|
||||
|
@ -82,41 +82,16 @@ class SendLaterButton extends Component {
|
|||
label: dateLabel,
|
||||
});
|
||||
}
|
||||
this.onSetMetadata({ expiration: sendLaterDate });
|
||||
this.props.session.changes.addPluginMetadata(PLUGIN_ID, {
|
||||
expiration: sendLaterDate,
|
||||
});
|
||||
};
|
||||
|
||||
onCancelSendLater = () => {
|
||||
Actions.closePopover();
|
||||
this.onSetMetadata({ expiration: null });
|
||||
};
|
||||
|
||||
onSetMetadata = async ({ expiration }) => {
|
||||
const { draft, session } = this.props;
|
||||
|
||||
if (!this.mounted) {
|
||||
return;
|
||||
}
|
||||
this.setState({ saving: true });
|
||||
|
||||
try {
|
||||
if (!this.mounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
session.changes.addPluginMetadata(PLUGIN_ID, { expiration });
|
||||
|
||||
if (expiration && AppEnv.isComposerWindow()) {
|
||||
AppEnv.close();
|
||||
}
|
||||
} catch (error) {
|
||||
AppEnv.reportError(error);
|
||||
AppEnv.showErrorDialog(`Sorry, we were unable to schedule this message. ${error.message}`);
|
||||
}
|
||||
|
||||
if (!this.mounted) {
|
||||
return;
|
||||
}
|
||||
this.setState({ saving: false });
|
||||
this.props.session.changes.addPluginMetadata(PLUGIN_ID, {
|
||||
expiration: null,
|
||||
});
|
||||
};
|
||||
|
||||
onClick = () => {
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import moment from 'moment';
|
||||
import { DateUtils, Actions, SyncbackMetadataTask, TaskQueue, SendDraftTask } from 'mailspring-exports';
|
||||
import {
|
||||
DateUtils,
|
||||
Actions,
|
||||
SyncbackMetadataTask,
|
||||
TaskQueue,
|
||||
SendDraftTask,
|
||||
} from 'mailspring-exports';
|
||||
import { RetinaImg } from 'mailspring-component-kit';
|
||||
import { PLUGIN_ID } from './send-later-constants';
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
import { Thread, MailboxPerspective, MutableQuerySubscription, DatabaseStore } from 'mailspring-exports';
|
||||
import {
|
||||
Thread,
|
||||
MailboxPerspective,
|
||||
MutableQuerySubscription,
|
||||
DatabaseStore,
|
||||
} from 'mailspring-exports';
|
||||
|
||||
import { PLUGIN_ID } from './send-reminders-constants';
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ class ThreadList extends React.Component
|
|||
return unless threads
|
||||
return unless AppEnv.config.get('core.workspace.showImportant')
|
||||
|
||||
Actions.queueTasks(TaskFactory.tasksForThreadsByAccountId(threads, (accountThreads, accountId) =>
|
||||
Actions.queueTasks(TaskFactory.tasksForThreadsByAccountId(threads, (accountThreads, accountId) =>
|
||||
return new ChangeLabelsTask({
|
||||
threads: accountThreads,
|
||||
source: "Keyboard Shortcut"
|
||||
|
|
|
@ -2,7 +2,12 @@ import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { RetinaImg } from 'mailspring-component-kit';
|
||||
import { Actions, TaskFactory, FocusedContentStore, FocusedPerspectiveStore } from 'mailspring-exports';
|
||||
import {
|
||||
Actions,
|
||||
TaskFactory,
|
||||
FocusedContentStore,
|
||||
FocusedPerspectiveStore,
|
||||
} from 'mailspring-exports';
|
||||
|
||||
import ThreadListStore from './thread-list-store';
|
||||
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
import {
|
||||
AccountStore,
|
||||
CategoryStore,
|
||||
NylasAPIHelpers,
|
||||
Thread,
|
||||
Actions,
|
||||
Folder,
|
||||
} from 'mailspring-exports';
|
||||
import { AccountStore, CategoryStore, Thread, Actions, Folder } from 'mailspring-exports';
|
||||
import * as SnoozeUtils from '../lib/snooze-utils';
|
||||
import SnoozeStore from '../lib/snooze-store';
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ describe "AutoUpdateManager", ->
|
|||
it "should update the feed URL", ->
|
||||
m = new AutoUpdateManager("3.222.1", @config, @specMode)
|
||||
spyOn(m, "setupAutoUpdater")
|
||||
expect(m.feedURL.includes('anonymous')).toEqual(true);
|
||||
expect(m.feedURL.includes('anonymous')).toEqual(true)
|
||||
@nylasIdentityId = 'test-nylas-id'
|
||||
m.updateFeedURL()
|
||||
expect(m.feedURL.includes(@nylasIdentityId)).toEqual(true);
|
||||
expect(m.feedURL.includes(@nylasIdentityId)).toEqual(true)
|
||||
|
|
|
@ -17,7 +17,7 @@ describe "QuotedHTMLTransformer", ->
|
|||
html.match(re)?.length ? 0
|
||||
|
||||
[1..28].forEach (n) ->
|
||||
fit "properly parses email_#{n}", ->
|
||||
it "properly parses email_#{n}", ->
|
||||
opts = keepIfWholeBodyIsQuote: true
|
||||
actual = removeQuotedHTML("email_#{n}.html", opts).trim()
|
||||
expected = readFile("email_#{n}_stripped.html").trim()
|
||||
|
|
|
@ -38,7 +38,7 @@ describe 'Utils', ->
|
|||
expect(revived).toEqual([@testThread])
|
||||
|
||||
it "should re-inflate Models in places they're not explicitly declared types", ->
|
||||
b = {id: "ThreadsToProcess", json: [@testThread]};
|
||||
b = {id: "ThreadsToProcess", json: [@testThread]}
|
||||
jsonString = JSON.stringify(b)
|
||||
expectedString = '{"id":"ThreadsToProcess","json":[{"id":"local-1","aid":"1","metadata":[],"subject":"Test 1234","categories":[],"participants":[{"id":"local-a","aid":"1","name":"Juan","email":"juan@nylas.com","thirdPartyData":{},"__cls":"Contact"},{"id":"local-b","aid":"1","name":"Ben","email":"ben@nylas.com","thirdPartyData":{},"__cls":"Contact"}],"__cls":"Thread"}]}'
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class MailspringWindow
|
|||
|
||||
loadSettings = Object.assign({}, settings)
|
||||
loadSettings.windowState ?= '{}'
|
||||
loadSettings.appVersion = global.application.version;
|
||||
loadSettings.appVersion = global.application.version
|
||||
loadSettings.resourcePath = @resourcePath
|
||||
loadSettings.devMode ?= false
|
||||
loadSettings.safeMode ?= false
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
/* eslint global-require: 0 */
|
||||
import { InlineStyleTransformer, SanitizeTransformer, RegExpUtils, Utils } from 'mailspring-exports';
|
||||
import {
|
||||
InlineStyleTransformer,
|
||||
SanitizeTransformer,
|
||||
RegExpUtils,
|
||||
Utils,
|
||||
} from 'mailspring-exports';
|
||||
|
||||
import ContenteditableService from './contenteditable-service';
|
||||
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
import {
|
||||
React,
|
||||
PropTypes,
|
||||
Actions,
|
||||
MailspringAPIRequest,
|
||||
NylasAPIHelpers,
|
||||
APIError,
|
||||
} from 'mailspring-exports';
|
||||
import { React, PropTypes, Actions, MailspringAPIRequest, APIError } from 'mailspring-exports';
|
||||
import { RetinaImg } from 'mailspring-component-kit';
|
||||
import classnames from 'classnames';
|
||||
import _ from 'underscore';
|
||||
|
@ -60,7 +53,7 @@ export default class MetadataComposerToggleButton extends React.Component {
|
|||
}
|
||||
|
||||
async _setEnabled(enabled) {
|
||||
const { pluginId, pluginName, draft, session, metadataEnabledValue } = this.props;
|
||||
const { pluginId, session, metadataEnabledValue } = this.props;
|
||||
|
||||
const metadataValue = enabled ? metadataEnabledValue : null;
|
||||
this.setState({ pending: true });
|
||||
|
|
|
@ -103,8 +103,7 @@ export default class Notification extends React.Component {
|
|||
actions.push({
|
||||
label: 'Dismiss',
|
||||
fn: () => {
|
||||
AppEnv.savedState.dismissedNotificationAsks[this.props.displayName] =
|
||||
this._numAsks() + 1;
|
||||
AppEnv.savedState.dismissedNotificationAsks[this.props.displayName] = this._numAsks() + 1;
|
||||
this.setState({ isDismissed: true });
|
||||
},
|
||||
});
|
||||
|
|
|
@ -252,7 +252,7 @@ class MessageStore extends MailspringStore
|
|||
@trigger(@)
|
||||
|
||||
_fetchMissingBodies: (items) ->
|
||||
missing = items.filter((i) -> i.body == null);
|
||||
missing = items.filter((i) -> i.body == null)
|
||||
if missing.length > 0
|
||||
Actions.fetchBodies(missing)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
_ = require('underscore')
|
||||
|
||||
EmojiData = null;
|
||||
EmojiData = null
|
||||
|
||||
UnicodeEmailChars = '\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF'
|
||||
|
||||
|
|
|
@ -34,9 +34,7 @@ class WindowTitle extends React.Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.disposable = AppEnv.onWindowPropsReceived(() =>
|
||||
this.setState(AppEnv.getLoadSettings())
|
||||
);
|
||||
this.disposable = AppEnv.onWindowPropsReceived(() => this.setState(AppEnv.getLoadSettings()));
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
|
Loading…
Reference in a new issue