diff --git a/.eslintrc.js b/.eslintrc.js index 598e5ffc3..b47e5a4a2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -44,7 +44,7 @@ module.exports = { // This error is always a false positive so far since it detects // possible race conditions in contexts where we know it cannot happen. "require-atomic-updates": 0, - "no-lonely-if": "error", + // "no-lonely-if": "error", // ------------------------------- // Formatting @@ -65,11 +65,14 @@ module.exports = { "mode": "strict" }], "block-spacing": ["error"], - "brace-style": ["error", "1tbs"], + "brace-style": ["error", "1tbs", { "allowSingleLine": true }], "no-spaced-func": ["error"], "func-call-spacing": ["error"], - "space-before-function-paren": ["error", "never"], - "object-property-newline": ["error"] + "space-before-function-paren": ["error", { + "anonymous": "never", + "named": "never", + "asyncArrow": "always" + }] }, "plugins": [ "react", diff --git a/CliClient/tests/models_Note.js b/CliClient/tests/models_Note.js index 906d9c3f2..d382b70ed 100644 --- a/CliClient/tests/models_Note.js +++ b/CliClient/tests/models_Note.js @@ -92,11 +92,11 @@ describe('models_Note', function() { it('should serialize and unserialize without modifying data', asyncTest(async () => { 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/services_rest_Api.js b/CliClient/tests/services_rest_Api.js index 56e891a6c..e2db88449 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/CliClient/tests/synchronizer.js b/CliClient/tests/synchronizer.js index 707208d78..f002f524d 100644 --- a/CliClient/tests/synchronizer.js +++ b/CliClient/tests/synchronizer.js @@ -892,10 +892,12 @@ describe('Synchronizer', function() { await synchronizer().start(); - const fetcher = new ResourceFetcher(() => { return { + const fetcher = new ResourceFetcher(() => { + return { // Simulate a failed download - get: () => { return new Promise((resolve, reject) => { reject(new Error('did not work')); }); }, - }; }); + get: () => { return new Promise((resolve, reject) => { reject(new Error('did not work')); }); }, + }; + }); fetcher.queueDownload_(resource1.id); await fetcher.waitForAllFinished(); diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index 87a5e0544..dd0658b5c 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -898,13 +898,13 @@ class Application extends BaseApplication { submenu: [{ label: _('Website and documentation'), accelerator: 'F1', - click () { bridge().openExternal('https://joplinapp.org'); }, + click() { bridge().openExternal('https://joplinapp.org'); }, }, { label: _('Joplin Forum'), - click () { bridge().openExternal('https://discourse.joplinapp.org'); }, + click() { bridge().openExternal('https://discourse.joplinapp.org'); }, }, { label: _('Make a donation'), - click () { bridge().openExternal('https://joplinapp.org/donate/'); }, + click() { bridge().openExternal('https://joplinapp.org/donate/'); }, }, { label: _('Check for updates...'), visible: shim.isMac() ? false : true, diff --git a/ElectronClient/app/compile-package-info.js b/ElectronClient/app/compile-package-info.js index fbe9a6e3e..06617fc58 100644 --- a/ElectronClient/app/compile-package-info.js +++ b/ElectronClient/app/compile-package-info.js @@ -22,8 +22,7 @@ let hash; try { branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim(); hash = execSync('git log --pretty="%h" -1').toString().trim(); -} -catch(err) { +} catch(err) { console.warn('Could not get git info', err); } if (typeof branch !== 'undefined' && typeof hash !== 'undefined') { diff --git a/ElectronClient/app/gui/ConfigMenuBar.jsx b/ElectronClient/app/gui/ConfigMenuBar.jsx index 5a974f852..49fb2e0c8 100644 --- a/ElectronClient/app/gui/ConfigMenuBar.jsx +++ b/ElectronClient/app/gui/ConfigMenuBar.jsx @@ -28,7 +28,7 @@ function ConfigMenuBar(props) { key={section.name} iconName={Setting.sectionNameToIcon(section.name)} label={Setting.sectionNameToLabel(section.name)} - onClick={() => { props.onSelectionChange({ section: section });}} + onClick={() => { props.onSelectionChange({ section: section }); }} />); } diff --git a/ElectronClient/app/gui/ConfigScreen.jsx b/ElectronClient/app/gui/ConfigScreen.jsx index 71c592269..ca635a83e 100644 --- a/ElectronClient/app/gui/ConfigScreen.jsx +++ b/ElectronClient/app/gui/ConfigScreen.jsx @@ -478,7 +478,7 @@ class ConfigScreenComponent extends React.Component { borderTopColor: theme.dividerColor, }; - const screenComp = this.state.screenName ?