1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-29 21:21:15 +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-in-parens": ["error", "never"],
"space-infix-ops": ["error"], "space-infix-ops": ["error"],
"curly": ["error", "multi-line", "consistent"],
"semi": ["error", "always"], "semi": ["error", "always"],
"eol-last": ["error", "always"], "eol-last": ["error", "always"],
"quotes": ["error", "single"], "quotes": ["error", "single"],

View File

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

View File

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

View File

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

View File

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

View File

@ -640,13 +640,14 @@ class NoteScreenComponent extends BaseScreenComponent {
this.showOnMap_onPress(); this.showOnMap_onPress();
}, },
}); });
if (note.source_url) if (note.source_url) {
output.push({ output.push({
title: _('Go to source URL'), title: _('Go to source URL'),
onPress: () => { onPress: () => {
this.showSource_onPress(); this.showSource_onPress();
}, },
}); });
}
return output; return output;
} }
@ -695,26 +696,28 @@ class NoteScreenComponent extends BaseScreenComponent {
this.share_onPress(); this.share_onPress();
}, },
}); });
if (isSaved) if (isSaved) {
output.push({ output.push({
title: _('Tags'), title: _('Tags'),
onPress: () => { onPress: () => {
this.tags_onPress(); this.tags_onPress();
}, },
}); });
}
output.push({ output.push({
title: isTodo ? _('Convert to note') : _('Convert to todo'), title: isTodo ? _('Convert to note') : _('Convert to todo'),
onPress: () => { onPress: () => {
this.toggleIsTodo_onPress(); this.toggleIsTodo_onPress();
}, },
}); });
if (isSaved) if (isSaved) {
output.push({ output.push({
title: _('Copy Markdown link'), title: _('Copy Markdown link'),
onPress: () => { onPress: () => {
this.copyMarkdownLink_onPress(); this.copyMarkdownLink_onPress();
}, },
}); });
}
output.push({ output.push({
title: _('Properties'), title: _('Properties'),
onPress: () => { 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)); items.push(this.renderSideBarButton('synchronize_button', !this.props.syncStarted ? _('Synchronise') : _('Cancel'), 'md-sync', this.synchronize_press));
if (fullReport.length) if (fullReport.length) {
items.push( items.push(
<Text key="sync_report" style={this.styles().syncStatus}> <Text key="sync_report" style={this.styles().syncStatus}>
{fullReport.join('\n')} {fullReport.join('\n')}
</Text> </Text>
); );
}
return <View style={{ flex: 0, flexDirection: 'column', paddingBottom: theme.marginBottom }}>{items}</View>; 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); this.cache_.put(cacheKey, html, 1000 * 60 * 10);
if (options.bodyOnly) return { if (options.bodyOnly) {
html: html, return {
pluginAssets: [], html: html,
}; pluginAssets: [],
};
}
let cssStrings = noteStyle(theme, options); let cssStrings = noteStyle(theme, options);

View File

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

View File

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