diff --git a/build/config/eslint.json b/build/config/eslint.json
index aacf276d0..a031f8aa6 100644
--- a/build/config/eslint.json
+++ b/build/config/eslint.json
@@ -8,6 +8,7 @@
"advanceClock": false,
"TEST_ACCOUNT_ID": false,
"TEST_ACCOUNT_NAME": false,
+ "TEST_ACCOUNT_EMAIL": false,
"TEST_ACCOUNT_ALIAS_EMAIL": false
},
"env": {
@@ -17,6 +18,7 @@
},
"rules": {
"arrow-body-style": "off",
+ "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}],
"eqeqeq": ["error", "smart"],
"id-length": "off",
"object-curly-spacing": "off",
@@ -30,6 +32,7 @@
"object-shorthand": "off",
"quotes": "off",
"quote-props": ["error", "consistent-as-needed", { "keywords": true }],
+ "no-param-reassign": ["error", { "props": false }],
"semi": "off",
"import/no-unresolved": ["error", {"ignore": ["nylas-exports", "nylas-component-kit", "electron", "nylas-store", "react-dom/server"]}],
"react/no-multi-comp": "off",
diff --git a/spec/components/date-input-spec.jsx b/spec/components/date-input-spec.jsx
index 6b8ea6177..c42b1ba83 100644
--- a/spec/components/date-input-spec.jsx
+++ b/spec/components/date-input-spec.jsx
@@ -23,22 +23,22 @@ describe('DateInput', function dateInput() {
describe('onInputKeyDown', () => {
it('should submit the input if Enter or Escape pressed', () => {
const onSubmitDate = jasmine.createSpy('onSubmitDate')
- const dateInput = makeInput({onSubmitDate: onSubmitDate})
- const inputNode = ReactDOM.findDOMNode(dateInput).querySelector('input')
+ const component = makeInput({onSubmitDate: onSubmitDate})
+ const inputNode = ReactDOM.findDOMNode(component).querySelector('input')
const stopPropagation = jasmine.createSpy('stopPropagation')
const keys = ['Enter', 'Return']
inputNode.value = 'tomorrow'
spyOn(DateUtils, 'futureDateFromString').andReturn('someday')
- spyOn(dateInput, 'setState')
+ spyOn(component, 'setState')
keys.forEach((key) => {
Simulate.keyDown(inputNode, {key, stopPropagation})
expect(stopPropagation).toHaveBeenCalled()
expect(onSubmitDate).toHaveBeenCalledWith('someday', 'tomorrow')
- expect(dateInput.setState).toHaveBeenCalledWith({inputDate: null})
+ expect(component.setState).toHaveBeenCalledWith({inputDate: null})
stopPropagation.reset()
onSubmitDate.reset()
- dateInput.setState.reset()
+ component.setState.reset()
})
});
});
@@ -49,18 +49,18 @@ describe('DateInput', function dateInput() {
});
it('should render a date interpretation if a date has been inputted', () => {
- const dateInput = makeInput({initialState: {inputDate: 'something!'}})
- spyOn(dateInput, 'setState')
- const dateInterpretation = findDOMNode(findRenderedDOMComponentWithClass(dateInput, 'date-interpretation'))
+ const component = makeInput({initialState: {inputDate: 'something!'}})
+ spyOn(component, 'setState')
+ const dateInterpretation = findDOMNode(findRenderedDOMComponentWithClass(component, 'date-interpretation'))
expect(dateInterpretation.textContent).toEqual('formatted')
});
it('should not render a date interpretation if no input date available', () => {
- const dateInput = makeInput({initialState: {inputDate: null}})
- spyOn(dateInput, 'setState')
+ const component = makeInput({initialState: {inputDate: null}})
+ spyOn(component, 'setState')
expect(() => {
- findRenderedDOMComponentWithClass(dateInput, 'date-interpretation')
+ findRenderedDOMComponentWithClass(component, 'date-interpretation')
}).toThrow()
});
});
diff --git a/spec/components/fixed-popover-spec.jsx b/spec/components/fixed-popover-spec.jsx
index 57fbfbd7f..bdde30275 100644
--- a/spec/components/fixed-popover-spec.jsx
+++ b/spec/components/fixed-popover-spec.jsx
@@ -6,8 +6,13 @@ import {renderIntoDocument} from '../nylas-test-utils'
const {Directions: {Up, Down, Left, Right}} = FixedPopover
const makePopover = (props = {}) => {
- props.originRect = props.originRect ? props.originRect : {};
- const popover = renderIntoDocument();
+ const originRect = props.originRect ? props.originRect : {};
+ const popover = renderIntoDocument(
+
+ );
if (props.initialState) {
popover.setState(props.initialState)
}
diff --git a/spec/components/injected-component-set-spec.jsx b/spec/components/injected-component-set-spec.jsx
index ee7d3749a..0a52e0316 100644
--- a/spec/components/injected-component-set-spec.jsx
+++ b/spec/components/injected-component-set-spec.jsx
@@ -3,10 +3,7 @@ import {InjectedComponentSet} from 'nylas-component-kit';
const {renderIntoDocument} = NylasTestUtils;
const reactStub = (displayName) => {
- return React.createClass({
- displayName,
- render() { return
; },
- });
+ return ;
};
@@ -26,7 +23,8 @@ describe('InjectedComponentSet', function injectedComponentSet() {
renderIntoDocument(
+ onComponentsDidRender={onComponentsDidRender}
+ />
);
});
diff --git a/spec/components/nylas-calendar/week-view-extended-spec.jsx b/spec/components/nylas-calendar/week-view-extended-spec.jsx
index 86ae04039..a99696844 100644
--- a/spec/components/nylas-calendar/week-view-extended-spec.jsx
+++ b/spec/components/nylas-calendar/week-view-extended-spec.jsx
@@ -1,5 +1,5 @@
-import {events} from './fixtures/events'
-import {NylasCalendar} from 'nylas-component-kit'
-
-describe('Extended Nylas Calendar Week View', function extendedNylasCalendarWeekView() {
-});
+// import {events} from './fixtures/events'
+// import {NylasCalendar} from 'nylas-component-kit'
+//
+// describe('Extended Nylas Calendar Week View', function extendedNylasCalendarWeekView() {
+// });
diff --git a/spec/components/nylas-calendar/week-view-spec.jsx b/spec/components/nylas-calendar/week-view-spec.jsx
index 37b0d051f..30df3074d 100644
--- a/spec/components/nylas-calendar/week-view-spec.jsx
+++ b/spec/components/nylas-calendar/week-view-spec.jsx
@@ -121,10 +121,8 @@ describe("Nylas Calendar Week View", function weekViewSpec() {
// See fixtures/events
expect(eventsByDay.allDay.length).toBe(numAllDayEvents);
- for (const day in numByDay) {
- if (numByDay.hasOwnProperty(day)) {
- expect(eventsByDay[day].length).toBe(numByDay[day])
- }
+ for (const day of Object.keys(numByDay)) {
+ expect(eventsByDay[day].length).toBe(numByDay[day])
}
});
diff --git a/spec/stores/draft-store-spec.es6 b/spec/stores/draft-store-spec.es6
index 89aef9e01..be60964c1 100644
--- a/spec/stores/draft-store-spec.es6
+++ b/spec/stores/draft-store-spec.es6
@@ -16,11 +16,12 @@ import {
SyncbackDraftFilesTask,
} from 'nylas-exports';
+import {remote} from 'electron';
import DraftFactory from '../../src/flux/stores/draft-factory';
class TestExtension extends ComposerExtension {
static prepareNewDraft({draft}) {
- draft.body = "Edited by TestExtension!" + draft.body;
+ draft.body = `Edited by TestExtension! ${draft.body}`;
}
}
@@ -180,7 +181,7 @@ describe('DraftStore', function draftStore() {
},
teardown: this.draftSessionTeardown,
};
- DraftStore._draftSessions = {"abc": this.session};
+ DraftStore._draftSessions = {abc: this.session};
spyOn(Actions, 'queueTask');
});
@@ -222,12 +223,14 @@ describe('DraftStore', function draftStore() {
describe("before unloading", () => {
it("should destroy pristine drafts", () => {
- DraftStore._draftSessions = {"abc": {
- changes: {},
- draft() {
- return {pristine: true};
+ DraftStore._draftSessions = {
+ abc: {
+ changes: {},
+ draft() {
+ return {pristine: true};
+ },
},
- }};
+ };
spyOn(Actions, 'queueTask');
DraftStore._onBeforeUnload();
@@ -239,9 +242,9 @@ describe('DraftStore', function draftStore() {
beforeEach(() => {
this.resolve = null;
DraftStore._draftSessions = {
- "abc": {
+ abc: {
changes: {
- commit: () => new Promise((resolve) => this.resolve = resolve),
+ commit: () => new Promise((resolve) => { this.resolve = resolve }),
},
draft() {
return {pristine: false};
@@ -262,13 +265,15 @@ describe('DraftStore', function draftStore() {
describe("when drafts return immediately fulfilled commit promises", () => {
beforeEach(() => {
- DraftStore._draftSessions = {"abc": {
- changes:
- {commit: () => Promise.resolve()},
- draft() {
- return {pristine: false};
+ DraftStore._draftSessions = {
+ abc: {
+ changes:
+ {commit: () => Promise.resolve()},
+ draft() {
+ return {pristine: false};
+ },
},
- }};
+ };
});
it("should still wait one tick before firing NylasEnv.close again", () => {
@@ -429,7 +434,6 @@ describe('DraftStore', function draftStore() {
it("displays a popup in the main window if there's an error", () => {
spyOn(NylasEnv, "isMainWindow").andReturn(true);
spyOn(FocusedContentStore, "focused").andReturn({id: "t1"});
- const {remote} = require('electron');
spyOn(remote.dialog, "showMessageBox");
spyOn(Actions, "composePopoutDraft");
DraftStore._draftsSending[this.draft.clientId] = true;
@@ -485,7 +489,7 @@ describe('DraftStore', function draftStore() {
},
teardown: this.draftTeardown,
};
- DraftStore._draftSessions = {"abc": this.session};
+ DraftStore._draftSessions = {abc: this.session};
DraftStore._doneWithSession(this.session);
});
diff --git a/spec/stores/nylas-sync-status-store-spec.es6 b/spec/stores/nylas-sync-status-store-spec.es6
index cbb920f84..11ba0a70e 100644
--- a/spec/stores/nylas-sync-status-store-spec.es6
+++ b/spec/stores/nylas-sync-status-store-spec.es6
@@ -65,7 +65,7 @@ describe('NylasSyncStatusStore', function nylasSyncStatusStore() {
});
it('returns false otherwise', () => {
- spyOn(store, 'isSyncCompleteForAccount').andCallFake((acctId) => acctId === 'a1' ? true : false)
+ spyOn(store, 'isSyncCompleteForAccount').andCallFake(acctId => acctId === 'a1')
store._statesByAccount = {
a1: {},
a2: {},
diff --git a/spec/stores/task-subclass.es6 b/spec/stores/task-subclass.es6
index 2d63581e0..7c3fd5061 100644
--- a/spec/stores/task-subclass.es6
+++ b/spec/stores/task-subclass.es6
@@ -22,7 +22,7 @@ export class APITestTask extends Task {
}
export class KillsTaskA extends Task {
- shouldDequeueOtherTask(other) {return other instanceof TaskSubclassA}
+ shouldDequeueOtherTask(other) { return other instanceof TaskSubclassA }
performRemote() { return new Promise(() => {}) }
}
@@ -50,10 +50,9 @@ export class TaskBB extends Task {
}
export class OKTask extends Task {
- performRemote() {return Promise.resolve(Task.Status.Retry)}
+ performRemote() { return Promise.resolve(Task.Status.Retry) }
}
export class BadTask extends Task {
- performRemote() {return Promise.resolve('lalal')}
+ performRemote() { return Promise.resolve('lalal') }
}
-
diff --git a/spec/task-factory-spec.es6 b/spec/task-factory-spec.es6
index eb98aa5e9..fa7a89525 100644
--- a/spec/task-factory-spec.es6
+++ b/spec/task-factory-spec.es6
@@ -13,14 +13,14 @@ describe('TaskFactory', function taskFactory() {
beforeEach(() => {
this.categories = {
'ac-1': {
- 'archive': new Category({name: 'archive'}),
- 'inbox': new Category({name: 'inbox1'}),
- 'trash': new Category({name: 'trash1'}),
+ archive: new Category({name: 'archive'}),
+ inbox: new Category({name: 'inbox1'}),
+ trash: new Category({name: 'trash1'}),
},
'ac-2': {
- 'archive': new Category({name: 'all'}),
- 'inbox': new Category({name: 'inbox2'}),
- 'trash': new Category({name: 'trash2'}),
+ archive: new Category({name: 'all'}),
+ inbox: new Category({name: 'inbox2'}),
+ trash: new Category({name: 'trash2'}),
},
}
this.accounts = {
diff --git a/spec/tasks/send-draft-task-spec.es6 b/spec/tasks/send-draft-task-spec.es6
index d55e3bd65..940b2d8dd 100644
--- a/spec/tasks/send-draft-task-spec.es6
+++ b/spec/tasks/send-draft-task-spec.es6
@@ -248,10 +248,9 @@ describe('SendDraftTask', function sendDraftTask() {
if (options.body.reply_to_message_id) {
const err = new APIError({body: "Invalid message public id"});
return Promise.reject(err);
- } else {
- if (options.success) { options.success(this.response) }
- return Promise.resolve(this.response);
}
+ if (options.success) { options.success(this.response) }
+ return Promise.resolve(this.response);
});
this.draft.replyToMessageId = "reply-123";
@@ -273,10 +272,9 @@ describe('SendDraftTask', function sendDraftTask() {
spyOn(NylasAPI, 'makeRequest').andCallFake((options) => {
if (options.body.reply_to_message_id) {
return Promise.reject(new APIError({body: "Invalid thread"}));
- } else {
- if (options.success) { options.success(this.response) }
- return Promise.resolve(this.response);
}
+ if (options.success) { options.success(this.response) }
+ return Promise.resolve(this.response);
});
this.draft.replyToMessageId = "reply-123";
@@ -356,7 +354,7 @@ describe('SendDraftTask', function sendDraftTask() {
body: {
message: "Sending to at least one recipient failed.",
server_error: "<>",
- type: "api_error"
+ type: "api_error",
},
})
diff --git a/spec/tasks/syncback-draft-files-task-spec.es6 b/spec/tasks/syncback-draft-files-task-spec.es6
index 7206887c9..4d2dca0f9 100644
--- a/spec/tasks/syncback-draft-files-task-spec.es6
+++ b/spec/tasks/syncback-draft-files-task-spec.es6
@@ -67,8 +67,8 @@ describe('SyncbackDraftFilesTask', function syncbackDraftFilesTask() {
// uploads should be queued, but not the send
expect(NylasAPI.makeRequest.callCount).toEqual(2);
- expect(NylasAPI.makeRequest.calls[0].args[0].formData).toEqual({ file : { value : 'stub', options : { filename : 'test-file-1.png' } } });
- expect(NylasAPI.makeRequest.calls[1].args[0].formData).toEqual({ file : { value : 'stub', options : { filename : 'test-file-2.png' } } });
+ expect(NylasAPI.makeRequest.calls[0].args[0].formData).toEqual({file: {value: 'stub', options: { filename: 'test-file-1.png' } } });
+ expect(NylasAPI.makeRequest.calls[1].args[0].formData).toEqual({file: {value: 'stub', options: { filename: 'test-file-2.png' } } });
// finish all uploads
expect(taskPromise.isFulfilled()).toBe(false);
diff --git a/src/components/time-picker.jsx b/src/components/time-picker.jsx
index a21ad8ca4..624680772 100644
--- a/src/components/time-picker.jsx
+++ b/src/components/time-picker.jsx
@@ -165,8 +165,8 @@ export default class TimePicker extends React.Component {
while (timeIter.isSameOrBefore(endMoment)) {
const val = timeIter.valueOf();
const className = classnames({
- option: true,
- selected: timeIter.isSame(enteredMoment),
+ "option": true,
+ "selected": timeIter.isSame(enteredMoment),
"scroll-start": timeIter.isSame(firstVisibleMoment),
})
@@ -180,7 +180,8 @@ export default class TimePicker extends React.Component {
}
opts.push(
-