From 737c3f62dbbee4c5cef74713ba59135f2b8776a7 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 4 Feb 2020 22:09:34 +0000 Subject: [PATCH] Tools: Linter: Enforce object-curly-spacing - always --- .eslintrc.js | 1 + CliClient/app/command-server.js | 2 +- CliClient/tests/models_Note.js | 8 +-- CliClient/tests/models_Tag.js | 2 +- CliClient/tests/reducer.js | 50 +++++++++---------- CliClient/tests/services_rest_Api.js | 2 +- Clipper/joplin-webclipper/popup/src/App.js | 10 ++-- ElectronClient/app/InteropServiceHelper.js | 2 +- ElectronClient/app/app.js | 2 +- ElectronClient/app/bridge.js | 6 +-- ElectronClient/app/compile-package-info.js | 4 +- .../app/gui/ClipperConfigScreen.jsx | 4 +- ElectronClient/app/gui/ConfigScreen.jsx | 4 +- ElectronClient/app/gui/MainScreen.jsx | 2 +- ElectronClient/app/gui/NoteText.jsx | 2 +- .../app/gui/OneDriveLoginScreen.jsx | 2 +- ElectronClient/app/plugins/GotoAnything.jsx | 6 +-- ReactNativeClient/lib/CssUtils.js | 2 +- ReactNativeClient/lib/JoplinServerApi.ts | 2 +- ReactNativeClient/lib/TemplateUtils.js | 2 +- .../lib/components/CameraView.js | 4 +- .../lib/components/screen-header.js | 2 +- .../lib/components/screens/config.js | 2 +- .../lib/components/select-date-time-dialog.js | 4 +- ReactNativeClient/lib/import-enex-html-gen.js | 6 +-- .../lib/joplin-renderer/Tools/buildAssets.js | 2 +- ReactNativeClient/lib/models/Setting.js | 8 +-- ReactNativeClient/lib/resourceUtils.js | 6 +-- .../lib/services/InteropService.js | 2 +- .../InteropService_Importer_EnexToHtml.js | 2 +- .../services/InteropService_Importer_Md.js | 4 +- ReactNativeClient/main.js | 2 +- ReactNativeClient/root.js | 10 ++-- Tools/tool-utils.js | 2 +- Tools/update-readme-contributors.js | 2 +- Tools/update-readme-download.js | 2 +- 36 files changed, 88 insertions(+), 87 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 465696394..96d54b5a5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -68,6 +68,7 @@ module.exports = { "linebreak-style": ["error", "unix"], "prefer-template": ["error"], "template-curly-spacing": ["error", "never"], + "object-curly-spacing": ["error", "always"], "key-spacing": ["error", { "beforeColon": false, "afterColon": true, diff --git a/CliClient/app/command-server.js b/CliClient/app/command-server.js index eb1478b97..70501e53e 100644 --- a/CliClient/app/command-server.js +++ b/CliClient/app/command-server.js @@ -25,7 +25,7 @@ class Command extends BaseCommand { info: stdoutFn, warn: stdoutFn, error: stdoutFn, - }}); + } }); ClipperServer.instance().setDispatch(() => {}); ClipperServer.instance().setLogger(clipperLogger); diff --git a/CliClient/tests/models_Note.js b/CliClient/tests/models_Note.js index d382b70ed..535f3e21d 100644 --- a/CliClient/tests/models_Note.js +++ b/CliClient/tests/models_Note.js @@ -90,13 +90,13 @@ describe('models_Note', function() { })); it('should serialize and unserialize without modifying data', asyncTest(async () => { - let folder1 = await Folder.save({ title: 'folder1'}); + let folder1 = await Folder.save({ title: 'folder1' }); const testCases = [ - [ {title: '', body: 'Body and no title\nSecond line\nThird Line', parent_id: folder1.id}, + [ { title: '', body: 'Body and no title\nSecond line\nThird Line', parent_id: folder1.id }, '', 'Body and no title\nSecond line\nThird Line'], - [ {title: 'Note title', body: 'Body and title', parent_id: folder1.id}, + [ { title: 'Note title', body: 'Body and title', parent_id: folder1.id }, 'Note title', 'Body and title'], - [ {title: 'Title and no body', body: '', parent_id: folder1.id}, + [ { title: 'Title and no body', body: '', parent_id: folder1.id }, 'Title and no body', ''], ]; diff --git a/CliClient/tests/models_Tag.js b/CliClient/tests/models_Tag.js index 3a8c5c93a..6060939a7 100644 --- a/CliClient/tests/models_Tag.js +++ b/CliClient/tests/models_Tag.js @@ -86,7 +86,7 @@ describe('models_Tag', function() { let folder1 = await Folder.save({ title: 'folder1' }); let note1 = await Note.save({ title: 'ma note', parent_id: folder1.id }); let note2 = await Note.save({ title: 'ma 2nd note', parent_id: folder1.id }); - let tag = await Tag.save({ title: 'mytag'}); + let tag = await Tag.save({ title: 'mytag' }); await Tag.addNote(tag.id, note1.id); let tagWithCount = await Tag.loadWithCount(tag.id); diff --git a/CliClient/tests/reducer.js b/CliClient/tests/reducer.js index 1bfae7eba..84136fe3d 100644 --- a/CliClient/tests/reducer.js +++ b/CliClient/tests/reducer.js @@ -1,11 +1,11 @@ /* eslint-disable no-unused-vars */ require('app-module-path').addPath(__dirname); -const {setupDatabaseAndSynchronizer, switchClient, asyncTest } = require('test-utils.js'); +const { setupDatabaseAndSynchronizer, switchClient, asyncTest } = require('test-utils.js'); const Folder = require('lib/models/Folder.js'); const Note = require('lib/models/Note.js'); const Tag = require('lib/models/Tag.js'); -const { reducer, defaultState, stateUtils} = require('lib/reducer.js'); +const { reducer, defaultState, stateUtils } = require('lib/reducer.js'); async function createNTestFolders(n) { let folders = []; @@ -64,7 +64,7 @@ function initTestState(folders, selectedFolderIndex, notes, selectedIndexes, tag } function createExpectedState(items, keepIndexes, selectedIndexes) { - let expected = { items: [], selectedIds: []}; + let expected = { items: [], selectedIds: [] }; for (let i = 0; i < selectedIndexes.length; i++) { expected.selectedIds.push(items[selectedIndexes[i]].id); @@ -111,7 +111,7 @@ describe('Reducer', function() { // test action // delete the third note - state = reducer(state, {type: 'NOTE_DELETE', id: notes[2].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[2].id }); // expect that the third note is missing, and the 4th note is now selected let expected = createExpectedState(notes, [0,1,3,4], [3]); @@ -128,7 +128,7 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [1]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[0].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[0].id }); let expected = createExpectedState(notes, [1,2,3,4], [1]); @@ -142,7 +142,7 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [0]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[0].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[0].id }); let expected = createExpectedState(notes, [], []); @@ -156,7 +156,7 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [4]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[4].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[4].id }); let expected = createExpectedState(notes, [0,1,2,3], [3]); @@ -170,7 +170,7 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [3]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[1].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id }); let expected = createExpectedState(notes, [0,2,3,4], [3]); @@ -184,7 +184,7 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [1]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[3].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id }); let expected = createExpectedState(notes, [0,1,2,4], [1]); @@ -198,8 +198,8 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [1,2]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[1].id}); - state = reducer(state, {type: 'NOTE_DELETE', id: notes[2].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id }); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[2].id }); let expected = createExpectedState(notes, [0,3,4], [3]); @@ -213,7 +213,7 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [3,4]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[1].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id }); let expected = createExpectedState(notes, [0,2,3,4], [3,4]); @@ -227,7 +227,7 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [1,2]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[3].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id }); let expected = createExpectedState(notes, [0,1,2,4], [1,2]); @@ -241,8 +241,8 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [3,4]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[3].id}); - state = reducer(state, {type: 'NOTE_DELETE', id: notes[4].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id }); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[4].id }); let expected = createExpectedState(notes, [0,1,2], [2]); @@ -256,9 +256,9 @@ describe('Reducer', function() { let state = initTestState(folders, 0, notes, [0,2,4]); // test action - state = reducer(state, {type: 'NOTE_DELETE', id: notes[0].id}); - state = reducer(state, {type: 'NOTE_DELETE', id: notes[2].id}); - state = reducer(state, {type: 'NOTE_DELETE', id: notes[4].id}); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[0].id }); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[2].id }); + state = reducer(state, { type: 'NOTE_DELETE', id: notes[4].id }); let expected = createExpectedState(notes, [1,3], [1]); @@ -273,7 +273,7 @@ describe('Reducer', function() { let state = initTestState(folders, 2, notes, [2]); // test action - state = reducer(state, {type: 'FOLDER_DELETE', id: folders[2].id}); + state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id }); let expected = createExpectedState(folders, [0,1,3,4], [3]); @@ -287,7 +287,7 @@ describe('Reducer', function() { let state = initTestState(folders, 1, notes, [2]); // test action - state = reducer(state, {type: 'FOLDER_DELETE', id: folders[2].id}); + state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id }); let expected = createExpectedState(folders, [0,1,3,4], [1]); @@ -301,7 +301,7 @@ describe('Reducer', function() { let state = initTestState(folders, 4, notes, [2]); // test action - state = reducer(state, {type: 'FOLDER_DELETE', id: folders[2].id}); + state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id }); let expected = createExpectedState(folders, [0,1,3,4], [4]); @@ -315,7 +315,7 @@ describe('Reducer', function() { let state = initTestState(null, null, null, null, tags, [2]); // test action - state = reducer(state, {type: 'TAG_DELETE', id: tags[2].id}); + state = reducer(state, { type: 'TAG_DELETE', id: tags[2].id }); let expected = createExpectedState(tags, [0,1,3,4], [3]); @@ -328,7 +328,7 @@ describe('Reducer', function() { let state = initTestState(null, null, null, null, tags, [2]); // test action - state = reducer(state, {type: 'TAG_DELETE', id: tags[4].id}); + state = reducer(state, { type: 'TAG_DELETE', id: tags[4].id }); let expected = createExpectedState(tags, [0,1,2,3], [2]); @@ -341,7 +341,7 @@ describe('Reducer', function() { let state = initTestState(null, null, null, null, tags, [2]); // test action - state = reducer(state, {type: 'TAG_DELETE', id: tags[0].id}); + state = reducer(state, { type: 'TAG_DELETE', id: tags[0].id }); let expected = createExpectedState(tags, [1,2,3,4], [2]); @@ -365,7 +365,7 @@ describe('Reducer', function() { expect(state.selectedNoteIds).toEqual(expected.selectedIds); // test action - state = reducer(state, {type: 'NOTE_SELECT_ALL'}); + state = reducer(state, { type: 'NOTE_SELECT_ALL' }); expected = createExpectedState(notes.slice(0,3), [0,1,2], [0,1,2]); expect(getIds(state.notes)).toEqual(getIds(expected.items)); diff --git a/CliClient/tests/services_rest_Api.js b/CliClient/tests/services_rest_Api.js index e2db88449..867c1b63a 100644 --- a/CliClient/tests/services_rest_Api.js +++ b/CliClient/tests/services_rest_Api.js @@ -279,7 +279,7 @@ describe('services_rest_Api', function() { const response = await api.route('GET', 'notes', { token: 'mytoken' }); expect(response.length).toBe(0); - hasThrown = await checkThrowAsync(async () => await api.route('POST', 'notes', null, JSON.stringify({title: 'testing'}))); + hasThrown = await checkThrowAsync(async () => await api.route('POST', 'notes', null, JSON.stringify({ title: 'testing' }))); expect(hasThrown).toBe(true); })); diff --git a/Clipper/joplin-webclipper/popup/src/App.js b/Clipper/joplin-webclipper/popup/src/App.js index 3b70f476c..9e2bb277b 100644 --- a/Clipper/joplin-webclipper/popup/src/App.js +++ b/Clipper/joplin-webclipper/popup/src/App.js @@ -189,10 +189,10 @@ class AppComponent extends Component { } async loadContentScripts() { - await bridge().tabsExecuteScript({file: '/content_scripts/JSDOMParser.js'}); - await bridge().tabsExecuteScript({file: '/content_scripts/Readability.js'}); - await bridge().tabsExecuteScript({file: '/content_scripts/Readability-readerable.js'}); - await bridge().tabsExecuteScript({file: '/content_scripts/index.js'}); + await bridge().tabsExecuteScript({ file: '/content_scripts/JSDOMParser.js' }); + await bridge().tabsExecuteScript({ file: '/content_scripts/Readability.js' }); + await bridge().tabsExecuteScript({ file: '/content_scripts/Readability-readerable.js' }); + await bridge().tabsExecuteScript({ file: '/content_scripts/index.js' }); } async componentDidMount() { @@ -248,7 +248,7 @@ class AppComponent extends Component { if (!this.state.contentScriptLoaded) { let msg = 'Loading...'; if (this.state.contentScriptError) msg = `The Joplin extension is not available on this tab due to: ${this.state.contentScriptError}`; - return
{msg}
; + return
{msg}
; } const warningComponent = !this.props.warning ? null :
{ this.props.warning }
; diff --git a/ElectronClient/app/InteropServiceHelper.js b/ElectronClient/app/InteropServiceHelper.js index 6686d3f76..70b3c1239 100644 --- a/ElectronClient/app/InteropServiceHelper.js +++ b/ElectronClient/app/InteropServiceHelper.js @@ -99,7 +99,7 @@ class InteropServiceHelper { if (module.target === 'file') { path = bridge().showSaveDialog({ - filters: [{ name: module.description, extensions: module.fileExtensions}], + filters: [{ name: module.description, extensions: module.fileExtensions }], }); } else { path = bridge().showOpenDialog({ diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index 07b5a1919..ead42feb4 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -408,7 +408,7 @@ class Application extends BaseApplication { if (moduleSource === 'file') { path = bridge().showOpenDialog({ - filters: [{ name: module.description, extensions: module.fileExtensions}], + filters: [{ name: module.description, extensions: module.fileExtensions }], }); } else { path = bridge().showOpenDialog({ diff --git a/ElectronClient/app/bridge.js b/ElectronClient/app/bridge.js index 1d540fbde..79523aaad 100644 --- a/ElectronClient/app/bridge.js +++ b/ElectronClient/app/bridge.js @@ -56,7 +56,7 @@ class Bridge { } showSaveDialog(options) { - const {dialog} = require('electron'); + const { dialog } = require('electron'); if (!options) options = {}; if (!('defaultPath' in options) && this.lastSelectedPath_) options.defaultPath = this.lastSelectedPath_; const filePath = dialog.showSaveDialogSync(this.window(), options); @@ -67,7 +67,7 @@ class Bridge { } showOpenDialog(options) { - const {dialog} = require('electron'); + const { dialog } = require('electron'); if (!options) options = {}; if (!('defaultPath' in options) && this.lastSelectedPath_) options.defaultPath = this.lastSelectedPath_; if (!('createDirectory' in options)) options.createDirectory = true; @@ -80,7 +80,7 @@ class Bridge { // Don't use this directly - call one of the showXxxxxxxMessageBox() instead showMessageBox_(window, options) { - const {dialog} = require('electron'); + const { dialog } = require('electron'); if (!window) window = this.window(); return dialog.showMessageBoxSync(window, options); } diff --git a/ElectronClient/app/compile-package-info.js b/ElectronClient/app/compile-package-info.js index 885b0ed88..8b0fc8aeb 100644 --- a/ElectronClient/app/compile-package-info.js +++ b/ElectronClient/app/compile-package-info.js @@ -21,8 +21,8 @@ let branch; let hash; try { // Use stdio: 'pipe' so that execSync doesn't print error directly to stdout - branch = execSync('git rev-parse --abbrev-ref HEAD', {stdio: 'pipe' }).toString().trim(); - hash = execSync('git log --pretty="%h" -1', {stdio: 'pipe' }).toString().trim(); + branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim(); + hash = execSync('git log --pretty="%h" -1', { stdio: 'pipe' }).toString().trim(); } catch (err) { // Don't display error object as it's a "fatal" error, but // not for us, since is it not critical information diff --git a/ElectronClient/app/gui/ClipperConfigScreen.jsx b/ElectronClient/app/gui/ClipperConfigScreen.jsx index f0ac52ca1..3a435b19d 100644 --- a/ElectronClient/app/gui/ClipperConfigScreen.jsx +++ b/ElectronClient/app/gui/ClipperConfigScreen.jsx @@ -121,9 +121,9 @@ class ClipperConfigScreenComponent extends React.Component {

{_('Step 2: Install the extension')}

{_('Download and install the relevant extension for your browser:')}

-
+
- +
diff --git a/ElectronClient/app/gui/ConfigScreen.jsx b/ElectronClient/app/gui/ConfigScreen.jsx index 28b31d47f..b72726bde 100644 --- a/ElectronClient/app/gui/ConfigScreen.jsx +++ b/ElectronClient/app/gui/ConfigScreen.jsx @@ -212,7 +212,7 @@ class ConfigScreenComponent extends React.Component { if (advancedSettingComps.length) { const iconName = this.state.showAdvancedSettings ? 'fa fa-toggle-up' : 'fa fa-toggle-down'; const advancedSettingsButtonStyle = Object.assign({}, theme.buttonStyle, { marginBottom: 10 }); - advancedSettingsButton = ; + advancedSettingsButton = ; advancedSettingsSectionStyle.display = this.state.showAdvancedSettings ? 'block' : 'none'; } @@ -575,7 +575,7 @@ class ConfigScreenComponent extends React.Component { borderTopColor: theme.dividerColor, }; - const screenComp = this.state.screenName ?
{this.screenFromName(this.state.screenName)}
: null; + const screenComp = this.state.screenName ?
{this.screenFromName(this.state.screenName)}
: null; if (screenComp) containerStyle.display = 'none'; diff --git a/ElectronClient/app/gui/MainScreen.jsx b/ElectronClient/app/gui/MainScreen.jsx index 47bc370af..bf2f6f600 100644 --- a/ElectronClient/app/gui/MainScreen.jsx +++ b/ElectronClient/app/gui/MainScreen.jsx @@ -152,7 +152,7 @@ class MainScreenComponent extends React.Component { .sort((a, b) => { // sensitivity accent will treat accented characters as differemt // but treats caps as equal - return a.label.localeCompare(b.label, undefined, {sensitivity: 'accent'}); + return a.label.localeCompare(b.label, undefined, { sensitivity: 'accent' }); }); const allTags = await Tag.allWithNotes(); const tagSuggestions = allTags.map(a => { diff --git a/ElectronClient/app/gui/NoteText.jsx b/ElectronClient/app/gui/NoteText.jsx index 33fbe53a6..01fffc74c 100644 --- a/ElectronClient/app/gui/NoteText.jsx +++ b/ElectronClient/app/gui/NoteText.jsx @@ -1117,7 +1117,7 @@ class NoteTextComponent extends React.Component { if (command.name === 'exportPdf') { fn = this.commandSavePdf; - args = {noteId: command.noteId}; + args = { noteId: command.noteId }; } else if (command.name === 'print') { fn = this.commandPrint; } diff --git a/ElectronClient/app/gui/OneDriveLoginScreen.jsx b/ElectronClient/app/gui/OneDriveLoginScreen.jsx index 3fc6a7cc5..48bc3a4f9 100644 --- a/ElectronClient/app/gui/OneDriveLoginScreen.jsx +++ b/ElectronClient/app/gui/OneDriveLoginScreen.jsx @@ -70,7 +70,7 @@ class OneDriveLoginScreenComponent extends React.Component { return (
-
+
{logComps}
diff --git a/ElectronClient/app/plugins/GotoAnything.jsx b/ElectronClient/app/plugins/GotoAnything.jsx index 3d9ab98ef..68d8b305c 100644 --- a/ElectronClient/app/plugins/GotoAnything.jsx +++ b/ElectronClient/app/plugins/GotoAnything.jsx @@ -62,9 +62,9 @@ class Dialog extends React.PureComponent { this.styles_[this.props.theme] = { dialogBox: Object.assign({}, theme.dialogBox, { minWidth: '50%', maxWidth: '50%' }), input: Object.assign({}, theme.inputStyle, { flex: 1 }), - row: {overflow: 'hidden', height: itemHeight, display: 'flex', justifyContent: 'center', flexDirection: 'column', paddingLeft: 10, paddingRight: 10}, + row: { overflow: 'hidden', height: itemHeight, display: 'flex', justifyContent: 'center', flexDirection: 'column', paddingLeft: 10, paddingRight: 10 }, help: Object.assign({}, theme.textStyle, { marginBottom: 10 }), - inputHelpWrapper: {display: 'flex', flexDirection: 'row', alignItems: 'center'}, + inputHelpWrapper: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, }; const rowTextStyle = { @@ -254,7 +254,7 @@ class Dialog extends React.PureComponent { return (
-
+
{pathComp}
); diff --git a/ReactNativeClient/lib/CssUtils.js b/ReactNativeClient/lib/CssUtils.js index bbe2e3698..9f97a3706 100644 --- a/ReactNativeClient/lib/CssUtils.js +++ b/ReactNativeClient/lib/CssUtils.js @@ -24,4 +24,4 @@ const injectCustomStyles = async cssFilePath => { document.head.appendChild(styleTag); }; -module.exports = {loadCustomCss, injectCustomStyles}; +module.exports = { loadCustomCss, injectCustomStyles }; diff --git a/ReactNativeClient/lib/JoplinServerApi.ts b/ReactNativeClient/lib/JoplinServerApi.ts index 5c3c077aa..3926ce168 100644 --- a/ReactNativeClient/lib/JoplinServerApi.ts +++ b/ReactNativeClient/lib/JoplinServerApi.ts @@ -3,7 +3,7 @@ const { shim } = require('lib/shim.js'); const JoplinError = require('lib/JoplinError'); const { rtrimSlashes } = require('lib/path-utils.js'); const base64 = require('base-64'); -const {_ } = require('lib/locale'); +const { _ } = require('lib/locale'); interface JoplinServerApiOptions { username: Function, diff --git a/ReactNativeClient/lib/TemplateUtils.js b/ReactNativeClient/lib/TemplateUtils.js index 2537c2306..46177476c 100644 --- a/ReactNativeClient/lib/TemplateUtils.js +++ b/ReactNativeClient/lib/TemplateUtils.js @@ -45,7 +45,7 @@ TemplateUtils.loadTemplates = async function(filePath) { // Make sure templates are always in the same order // sensitivity ensures that the sort will ignore case - files.sort((a, b) => { return a.path.localeCompare(b.path, undefined, {sensitivity: 'accent'}); }); + files.sort((a, b) => { return a.path.localeCompare(b.path, undefined, { sensitivity: 'accent' }); }); files.forEach(async file => { if (file.path.endsWith('.md')) { diff --git a/ReactNativeClient/lib/components/CameraView.js b/ReactNativeClient/lib/components/CameraView.js index 40b0f63e3..9daf881ad 100644 --- a/ReactNativeClient/lib/components/CameraView.js +++ b/ReactNativeClient/lib/components/CameraView.js @@ -99,7 +99,7 @@ class CameraView extends Component { return ( - + { icon } @@ -152,7 +152,7 @@ class CameraView extends Component { const displayRatios = shim.mobilePlatform() === 'android' && this.state.ratios.length > 1; const reverseCameraButton = this.renderButton(this.reverse_onPress, 'md-reverse-camera', { flex: 1, flexDirection: 'row', justifyContent: 'flex-start', marginLeft: 20 }); - const ratioButton = !displayRatios ? : this.renderButton(this.ratio_onPress, {Setting.value('camera.ratio')}, { flex: 1, flexDirection: 'row', justifyContent: 'flex-end', marginRight: 20 }); + const ratioButton = !displayRatios ? : this.renderButton(this.ratio_onPress, {Setting.value('camera.ratio')}, { flex: 1, flexDirection: 'row', justifyContent: 'flex-end', marginRight: 20 }); let cameraRatio = '4:3'; const cameraProps = {}; diff --git a/ReactNativeClient/lib/components/screen-header.js b/ReactNativeClient/lib/components/screen-header.js index ce39ab9f4..74bec9986 100644 --- a/ReactNativeClient/lib/components/screen-header.js +++ b/ReactNativeClient/lib/components/screen-header.js @@ -170,7 +170,7 @@ class ScreenHeaderComponent extends React.PureComponent { // Duplicate all selected notes. ensureUniqueTitle is set to true to use the // original note's name as a root for the new unique identifier. - await Note.duplicateMultipleNotes(noteIds, {ensureUniqueTitle: true}); + await Note.duplicateMultipleNotes(noteIds, { ensureUniqueTitle: true }); this.props.dispatch({ type: 'NOTE_SELECTION_END' }); } diff --git a/ReactNativeClient/lib/components/screens/config.js b/ReactNativeClient/lib/components/screens/config.js index 2da7130ce..07b9891ab 100644 --- a/ReactNativeClient/lib/components/screens/config.js +++ b/ReactNativeClient/lib/components/screens/config.js @@ -443,7 +443,7 @@ class ConfigScreenComponent extends BaseScreenComponent { const profileExportPrompt = ( Path: - this.setState({profileExportPath: event.nativeEvent.text })} value={this.state.profileExportPath} placeholder="/path/to/sdcard"> + this.setState({ profileExportPath: event.nativeEvent.text })} value={this.state.profileExportPath} placeholder="/path/to/sdcard"> ); diff --git a/ReactNativeClient/lib/components/select-date-time-dialog.js b/ReactNativeClient/lib/components/select-date-time-dialog.js index 4947f12c2..527ac227e 100644 --- a/ReactNativeClient/lib/components/select-date-time-dialog.js +++ b/ReactNativeClient/lib/components/select-date-time-dialog.js @@ -81,7 +81,7 @@ class SelectDateTimeDialog extends React.PureComponent { width={0.9} height={350} > - + { this.setState({ date: this.stringToDate(date) }); }} - style={{width: 300}} + style={{ width: 300 }} customStyles={{ btnConfirm: { paddingVertical: 0, diff --git a/ReactNativeClient/lib/import-enex-html-gen.js b/ReactNativeClient/lib/import-enex-html-gen.js index 6fbcd0c24..d185a189c 100644 --- a/ReactNativeClient/lib/import-enex-html-gen.js +++ b/ReactNativeClient/lib/import-enex-html-gen.js @@ -11,7 +11,7 @@ function addResourceTag(lines, resource, attributes) { const src = `:/${resource.id}`; if (resourceUtils.isImageMimeType(resource.mime)) { - lines.push(resourceUtils.imgElement({src, attributes})); + lines.push(resourceUtils.imgElement({ src, attributes })); } else if (resource.mime === 'audio/x-m4a') { /** * TODO: once https://github.com/laurent22/joplin/issues/1794 is resolved, @@ -162,9 +162,9 @@ async function enexXmlToHtml(xmlString, resources, options = {}) { const beautifyHtml = (html) => { return new Promise((resolve) => { - const options = {wrap: 0}; + const options = { wrap: 0 }; cleanHtml.clean(html, options, (...cleanedHtml) => resolve(cleanedHtml)); }); }; -module.exports = {enexXmlToHtml}; +module.exports = { enexXmlToHtml }; diff --git a/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js b/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js index adacead38..742c5246a 100644 --- a/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js +++ b/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js @@ -1,5 +1,5 @@ const fs = require('fs-extra'); -const {dirname } = require('../pathUtils'); +const { dirname } = require('../pathUtils'); const rootDir = dirname(__dirname); const assetsDir = `${rootDir}/assets`; diff --git a/ReactNativeClient/lib/models/Setting.js b/ReactNativeClient/lib/models/Setting.js index f46c0809b..ebf9a29c6 100644 --- a/ReactNativeClient/lib/models/Setting.js +++ b/ReactNativeClient/lib/models/Setting.js @@ -345,8 +345,8 @@ class Setting extends BaseModel { }, // Deprecated - use markdown.plugin.* - 'markdown.softbreaks': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop']}, - 'markdown.typographer': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop']}, + 'markdown.softbreaks': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop'] }, + 'markdown.typographer': { value: false, type: Setting.TYPE_BOOL, public: false, appTypes: ['mobile', 'desktop'] }, // Deprecated 'markdown.plugin.softbreaks': { value: false, type: Setting.TYPE_BOOL, section: 'plugins', public: true, appTypes: ['mobile', 'desktop'], label: () => _('Enable soft breaks') }, @@ -502,13 +502,13 @@ class Setting extends BaseModel { 'Tabloid': _('Tabloid'), 'Legal': _('Legal'), }; - }}, + } }, 'export.pdfPageOrientation': { value: 'portrait', type: Setting.TYPE_STRING, isEnum: true, public: true, appTypes: ['desktop'], label: () => _('Page orientation for PDF export'), options: () => { return { 'portrait': _('Portrait'), 'landscape': _('Landscape'), }; - }}, + } }, 'net.customCertificates': { diff --git a/ReactNativeClient/lib/resourceUtils.js b/ReactNativeClient/lib/resourceUtils.js index b9137cb63..4f59c123a 100644 --- a/ReactNativeClient/lib/resourceUtils.js +++ b/ReactNativeClient/lib/resourceUtils.js @@ -45,17 +45,17 @@ const attributesToStr = (attributes) => .map(([key, value]) => ` ${key}="${escapeQuotes(value)}"`) .join(''); -const attachmentElement = ({src, attributes, id}) => +const attachmentElement = ({ src, attributes, id }) => [ ``, ` ${attributes.alt || src}`, '', ].join(''); -const imgElement = ({src, attributes}) => +const imgElement = ({ src, attributes }) => ``; -const audioElement = ({src, alt, id}) => +const audioElement = ({ src, alt, id }) => [ '