1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Apply "curly" eslint rule

This commit is contained in:
Laurent Cozic 2020-03-13 23:57:34 +00:00
parent e2e55b6e08
commit e399474b4e
10 changed files with 47 additions and 30 deletions

View File

@ -68,6 +68,7 @@ module.exports = {
// -------------------------------
"space-in-parens": ["error", "never"],
"space-infix-ops": ["error"],
"curly": ["error", "multi-line", "consistent"],
"semi": ["error", "always"],
"eol-last": ["error", "always"],
"quotes": ["error", "single"],

View File

@ -132,11 +132,13 @@ function checkForUpdates(inBackground, window, logFilePath, options) {
autoUpdateLogger_.info('Is Pre-release:', release.prerelease);
if (compareVersions(release.version, packageInfo.version) <= 0) {
if (!checkInBackground_) await dialog.showMessageBox({
type: 'info',
message: _('Current version is up-to-date.'),
buttons: [_('OK')],
});
if (!checkInBackground_) {
await dialog.showMessageBox({
type: 'info',
message: _('Current version is up-to-date.'),
buttons: [_('OK')],
});
}
} else {
const fullReleaseNotes = release.notes.trim() ? `\n\n${release.notes.trim()}` : '';
const MAX_RELEASE_NOTES_LENGTH = 1000;

View File

@ -36,10 +36,12 @@ class NoteTextViewerComponent extends React.Component {
const callName = event.data.name;
const args = event.data.args;
if (this.props.onIpcMessage) this.props.onIpcMessage({
channel: callName,
args: args,
});
if (this.props.onIpcMessage) {
this.props.onIpcMessage({
channel: callName,
args: args,
});
}
}
domReady() {

View File

@ -230,24 +230,27 @@ class PromptDialog extends React.Component {
}
const buttonComps = [];
if (buttonTypes.indexOf('ok') >= 0)
if (buttonTypes.indexOf('ok') >= 0) {
buttonComps.push(
<button key="ok" style={styles.button} onClick={() => onClose(true, 'ok')}>
{_('OK')}
</button>
);
if (buttonTypes.indexOf('cancel') >= 0)
}
if (buttonTypes.indexOf('cancel') >= 0) {
buttonComps.push(
<button key="cancel" style={styles.button} onClick={() => onClose(false, 'cancel')}>
{_('Cancel')}
</button>
);
if (buttonTypes.indexOf('clear') >= 0)
}
if (buttonTypes.indexOf('clear') >= 0) {
buttonComps.push(
<button key="clear" style={styles.button} onClick={() => onClose(false, 'clear')}>
{_('Clear')}
</button>
);
}
return (
<div style={styles.modalLayer}>

View File

@ -123,8 +123,9 @@ function themeStyle(theme) {
if (themeCache_[theme]) return themeCache_[theme];
const output = Object.assign({}, globalStyle);
if (theme == Setting.THEME_LIGHT) return addExtraStyles(output);
else if (theme == Setting.THEME_OLED_DARK) {
if (theme == Setting.THEME_LIGHT) {
return addExtraStyles(output);
} else if (theme == Setting.THEME_OLED_DARK) {
output.backgroundColor = '#000000';
output.color = '#dddddd';
output.colorFaded = '#777777';

View File

@ -640,13 +640,14 @@ class NoteScreenComponent extends BaseScreenComponent {
this.showOnMap_onPress();
},
});
if (note.source_url)
if (note.source_url) {
output.push({
title: _('Go to source URL'),
onPress: () => {
this.showSource_onPress();
},
});
}
return output;
}
@ -695,26 +696,28 @@ class NoteScreenComponent extends BaseScreenComponent {
this.share_onPress();
},
});
if (isSaved)
if (isSaved) {
output.push({
title: _('Tags'),
onPress: () => {
this.tags_onPress();
},
});
}
output.push({
title: isTodo ? _('Convert to note') : _('Convert to todo'),
onPress: () => {
this.toggleIsTodo_onPress();
},
});
if (isSaved)
if (isSaved) {
output.push({
title: _('Copy Markdown link'),
onPress: () => {
this.copyMarkdownLink_onPress();
},
});
}
output.push({
title: _('Properties'),
onPress: () => {

View File

@ -336,12 +336,13 @@ class SideMenuContentComponent extends Component {
items.push(this.renderSideBarButton('synchronize_button', !this.props.syncStarted ? _('Synchronise') : _('Cancel'), 'md-sync', this.synchronize_press));
if (fullReport.length)
if (fullReport.length) {
items.push(
<Text key="sync_report" style={this.styles().syncStatus}>
{fullReport.join('\n')}
</Text>
);
}
return <View style={{ flex: 0, flexDirection: 'column', paddingBottom: theme.marginBottom }}>{items}</View>;
}

View File

@ -73,10 +73,12 @@ class HtmlToHtml {
this.cache_.put(cacheKey, html, 1000 * 60 * 10);
if (options.bodyOnly) return {
html: html,
pluginAssets: [],
};
if (options.bodyOnly) {
return {
html: html,
pluginAssets: [],
};
}
let cssStrings = noteStyle(theme, options);

View File

@ -209,8 +209,7 @@ function handleItemDelete(state, action) {
function updateOneItem(state, action, keyName = '') {
let itemsKey = null;
if (keyName) itemsKey = keyName;
else {
if (keyName) { itemsKey = keyName; } else {
if (action.type === 'TAG_UPDATE_ONE') itemsKey = 'tags';
if (action.type === 'FOLDER_UPDATE_ONE') itemsKey = 'folders';
if (action.type === 'MASTERKEY_UPDATE_ONE') itemsKey = 'masterKeys';
@ -397,10 +396,11 @@ const reducer = (state = defaultState, action) => {
case 'NOTE_SELECT_ALL_TOGGLE': {
newState = Object.assign({}, state);
const allSelected = state.notes.every(n => state.selectedNoteIds.includes(n.id));
if (allSelected)
if (allSelected) {
newState.selectedNoteIds = [];
else
} else {
newState.selectedNoteIds = newState.notes.map(n => n.id);
}
break;
}

View File

@ -119,10 +119,12 @@ async function main() {
for (let j = 0; j < note.tags.length; j++) {
const tagTitle = note.tags[j];
const tagId = itemIdFromPath(tagTitle);
if (!tagIdsToTag[tagId]) tagIdsToTag[tagId] = {
id: tagId,
title: tagTitle,
};
if (!tagIdsToTag[tagId]) {
tagIdsToTag[tagId] = {
id: tagId,
title: tagTitle,
};
}
}
notes.push(note);