fix(lint): fix linter issues

This commit is contained in:
Evan Morikawa 2016-03-08 13:01:40 -05:00
parent b2db5190c8
commit 0f395b8918
10 changed files with 31 additions and 27 deletions

View file

@ -2,7 +2,7 @@ import request from 'request';
import {Actions} from 'nylas-exports';
import {PLUGIN_ID, PLUGIN_URL} from './link-tracking-constants'
export default class LinkTrackingAfterSend{
export default class LinkTrackingAfterSend {
static post = Promise.promisify(request.post, {multiArgs: true});
static afterDraftSend({message}) {
@ -34,4 +34,5 @@ export default class LinkTrackingAfterSend{
});
}
}
}
}

View file

@ -1,4 +1,3 @@
import request from 'request';
import {ComponentRegistry, ExtensionRegistry, Actions} from 'nylas-exports';
import LinkTrackingButton from './link-tracking-button';
import LinkTrackingComposerExtension from './link-tracking-composer-extension';

View file

@ -23,14 +23,13 @@ const testBody = `<body>${testContent}${quote}</body>`;
const replacedBody = (accountId, messageUid, unquoted) => `<body>${replacedContent(accountId, messageUid)}${unquoted ? "" : quote}</body>`;
describe("Open tracking composer extension", () => {
// Set up a draft, session that returns the draft, and metadata
beforeEach(()=>{
this.draft = new Message({accountId: "test"});
this.draft.body = testBody;
this.session = {
draft: () => this.draft,
changes: jasmine.createSpyObj('changes', ['add', 'commit'])
changes: jasmine.createSpyObj('changes', ['add', 'commit']),
};
});
@ -83,3 +82,4 @@ describe("Open tracking composer extension", () => {
})
});
});

View file

@ -34,4 +34,5 @@ export default class OpenTrackingAfterSend {
});
}
}
}
}

View file

@ -52,3 +52,4 @@ export default class OpenTrackingMessageStatus extends React.Component {
)
}
}

View file

@ -5,14 +5,13 @@ import {Message, QuotedHTMLTransformer} from 'nylas-exports';
const quote = `<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> On Feb 25 2016, at 3:38 pm, Drew &lt;drew@nylas.com&gt; wrote: <br> twst </blockquote>`;
describe("Open tracking composer extension", () => {
// Set up a draft, session that returns the draft, and metadata
beforeEach(()=>{
this.draft = new Message();
this.draft.body = `<body>TEST_BODY ${quote}</body>`;
this.session = {
draft: () => this.draft,
changes: jasmine.createSpyObj('changes', ['add', 'commit'])
changes: jasmine.createSpyObj('changes', ['add', 'commit']),
};
});
@ -60,5 +59,5 @@ describe("Open tracking composer extension", () => {
OpenTrackingComposerExtension.finalizeSessionBeforeSending({session: this.session});
expect(NylasEnv.reportError).toHaveBeenCalled()
});
});

View file

@ -22,7 +22,7 @@ function addOpenMetadata(obj, openCount) {
describe("Open tracking icon", () => {
beforeEach(() => {
this.thread = {metadata:[]};
this.thread = {metadata: []};
});
@ -65,7 +65,6 @@ describe("Open tracking icon", () => {
expect(icon.children.length).toEqual(1);
expect(icon.querySelector("img.unopened")).not.toBeNull();
expect(icon.querySelector("img.opened")).toBeNull();
});
it("shows an opened icon if all messages with metadata are opened", () => {
@ -77,4 +76,5 @@ describe("Open tracking icon", () => {
expect(icon.querySelector("img.opened")).not.toBeNull();
});
});
});
});

View file

@ -51,4 +51,5 @@ describe("Open tracking message status", () => {
expect(icon.querySelector("img.unopened")).toBeNull();
expect(icon.querySelector("img.opened")).not.toBeNull();
});
});
});

View file

@ -557,7 +557,6 @@ describe "ChangeMailTask", ->
b.threads = ['t3', 't4', 't7']
b.sequentialId = 1
c = new ChangeMailTask()
console.log([a,b,c].map((x) -> x.sequentialId))
c.threads = ['t0', 't7']
c.sequentialId = 2
expect(a.isDependentOnTask(b)).toEqual(false)

View file

@ -30,23 +30,26 @@ const TaskFactory = {
byAccount[accountId].threadsToUpdate.push(thread)
})
_.each(byAccount, ({categoriesToAdd, categoriesToRemove, threadsToUpdate}, accountId)=> {
const account = AccountStore.accountForId(accountId)
if (!(categoriesToAdd instanceof Array)) {
throw new Error("tasksForApplyingCategories: `categoriesToAdd` must return an array of Categories")
_.each(byAccount, (data, accountId) => {
const catToAdd = data.categoriesToAdd;
const catToRemove = data.categoriesToRemove;
const threadsToUpdate = data.threadsToUpdate;
const account = AccountStore.accountForId(accountId);
if (!(catToAdd instanceof Array)) {
throw new Error("tasksForApplyingCategories: `catToAdd` must return an array of Categories")
}
if (!(categoriesToRemove instanceof Array)) {
throw new Error("tasksForApplyingCategories: `categoriesToRemove` must return an array of Categories")
if (!(catToRemove instanceof Array)) {
throw new Error("tasksForApplyingCategories: `catToRemove` must return an array of Categories")
}
if (account.usesFolders()) {
if (categoriesToAdd.length === 0) return;
if (categoriesToAdd.length > 1) {
throw new Error("tasksForApplyingCategories: `categoriesToAdd` must return a single `Category` (folder) for Exchange accounts")
if (catToAdd.length === 0) return;
if (catToAdd.length > 1) {
throw new Error("tasksForApplyingCategories: `catToAdd` must return a single `Category` (folder) for Exchange accounts")
}
const folder = categoriesToAdd[0]
const folder = catToAdd[0]
if (!(folder instanceof Category)) {
throw new Error("tasksForApplyingCategories: `categoriesToAdd` must return a Categories")
throw new Error("tasksForApplyingCategories: `catToAdd` must return a Categories")
}
tasks.push(new ChangeFolderTask({
@ -55,8 +58,8 @@ const TaskFactory = {
taskDescription,
}))
} else {
const labelsToAdd = categoriesToAdd
const labelsToRemove = categoriesToRemove
const labelsToAdd = catToAdd
const labelsToRemove = catToRemove
if (labelsToAdd.length === 0 && labelsToRemove.length === 0) return;
tasks.push(new ChangeLabelsTask({