Add operator-linebreak ESLint rule

Based on the following discussion:
https://github.com/signalapp/Signal-Desktop/pull/2040#discussion_r168029106
This commit is contained in:
Daniel Gasienica
2018-02-14 11:11:50 -05:00
parent 462defbe55
commit 41b92c0a31
5 changed files with 19 additions and 17 deletions

View File

@@ -37,5 +37,7 @@ module.exports = {
// though we have a logger, we still remap console to log to disk // though we have a logger, we still remap console to log to disk
'no-console': 'off', 'no-console': 'off',
'operator-linebreak': ["error", "after", { "overrides": { '?': 'before', ':': 'before' } }]
} }
}; };

View File

@@ -117,8 +117,8 @@ function eliminateOutOfDateFiles(logPath, date) {
const file = { const file = {
path: target, path: target,
start: isLineAfterDate(start, date), start: isLineAfterDate(start, date),
end: isLineAfterDate(end[end.length - 1], date) end: isLineAfterDate(end[end.length - 1], date) ||
|| isLineAfterDate(end[end.length - 2], date), isLineAfterDate(end[end.length - 2], date),
}; };
if (!file.start && !file.end) { if (!file.start && !file.end) {

View File

@@ -518,9 +518,9 @@
return ev.confirm(); return ev.confirm();
} }
const { type, id } = data.message.group ? const { type, id } = data.message.group
{ type: 'group', id: data.message.group.id } : ? { type: 'group', id: data.message.group.id }
{ type: 'private', id: data.source }; : { type: 'private', id: data.source };
const processedMessage = await Message.process(data.message); const processedMessage = await Message.process(data.message);

View File

@@ -206,9 +206,9 @@
if (file === undefined) { if (file === undefined) {
return Promise.resolve(); return Promise.resolve();
} }
const attachmentFlags = this.isVoiceNote ? const attachmentFlags = this.isVoiceNote
textsecure.protobuf.AttachmentPointer.Flags.VOICE_MESSAGE : ? textsecure.protobuf.AttachmentPointer.Flags.VOICE_MESSAGE
null; : null;
const setFlags = flags => (attachment) => { const setFlags = flags => (attachment) => {
const newAttachment = Object.assign({}, attachment); const newAttachment = Object.assign({}, attachment);

18
main.js
View File

@@ -157,10 +157,10 @@ function isVisible(window, bounds) {
const topClearOfUpperBound = window.y >= boundsY; const topClearOfUpperBound = window.y >= boundsY;
const topClearOfLowerBound = (window.y <= (boundsY + boundsHeight) - BOUNDS_BUFFER); const topClearOfLowerBound = (window.y <= (boundsY + boundsHeight) - BOUNDS_BUFFER);
return rightSideClearOfLeftBound return rightSideClearOfLeftBound &&
&& leftSideClearOfRightBound leftSideClearOfRightBound &&
&& topClearOfUpperBound topClearOfUpperBound &&
&& topClearOfLowerBound; topClearOfLowerBound;
} }
function createWindow() { function createWindow() {
@@ -277,8 +277,8 @@ function createWindow() {
// Emitted when the window is about to be closed. // Emitted when the window is about to be closed.
mainWindow.on('close', (e) => { mainWindow.on('close', (e) => {
// If the application is terminating, just do the default // If the application is terminating, just do the default
if (windowState.shouldQuit() if (windowState.shouldQuit() ||
|| config.environment === 'test' || config.environment === 'test-lib') { config.environment === 'test' || config.environment === 'test-lib') {
return; return;
} }
@@ -422,9 +422,9 @@ app.on('before-quit', () => {
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar // On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q // to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin' if (process.platform !== 'darwin' ||
|| config.environment === 'test' config.environment === 'test' ||
|| config.environment === 'test-lib') { config.environment === 'test-lib') {
app.quit(); app.quit();
} }
}); });