From 4888b4bd145d10907918e056fe55d58dd804447f Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 11 Jan 2023 18:37:22 +0000 Subject: [PATCH] Tools: Enable eslint rule "comma-spacing" --- .eslintrc.js | 1 + packages/app-cli/app/command-mv.js | 2 +- packages/app-cli/app/gui/FolderListWidget.js | 2 +- packages/app-desktop/checkForUpdates.ts | 2 +- .../CodeMirror/utils/useCursorUtils.test.ts | 4 +- .../CodeMirror/utils/useCursorUtils.ts | 2 +- .../NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx | 2 +- .../gui/NoteEditor/styles/index.ts | 2 +- .../app-desktop/gui/NoteList/NoteList.tsx | 4 +- .../components/SelectDateTimeDialog.tsx | 2 +- packages/lib/SyncTargetAmazonS3.js | 2 +- packages/lib/file-api-driver-amazon-s3.js | 2 +- packages/lib/markdownUtils.ts | 2 +- packages/lib/models/Setting.ts | 4 +- packages/lib/onedrive-api.ts | 4 +- packages/lib/reducer.test.js | 64 +++++++++---------- packages/lib/services/UndoRedoService.ts | 2 +- .../services/e2ee/EncryptionService.test.ts | 6 +- .../lib/services/plugins/PluginService.ts | 2 +- .../defaultPlugins/defaultPluginsUtils.ts | 2 +- .../searchengine/SearchFilter.test.ts | 2 +- .../lib/services/searchengine/queryBuilder.ts | 6 +- .../synchronizer/Synchronizer.e2ee.test.ts | 2 +- packages/lib/testing/test-utils.ts | 2 +- packages/lib/theme.ts | 2 +- packages/pdf-viewer/hooks/useScrollSaver.ts | 2 +- .../pdf-viewer/hooks/useVisibleOnSelect.ts | 2 +- packages/pdf-viewer/ui/GotoPage.tsx | 4 +- packages/server/src/routes/api/items.test.ts | 2 +- packages/server/src/utils/prettycron.ts | 2 +- packages/tools/bundleDefaultPlugins.test.ts | 6 +- packages/tools/bundleDefaultPlugins.ts | 10 +-- packages/tools/website/updateNews.ts | 2 +- 33 files changed, 79 insertions(+), 78 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9000a76c5..be23b2373 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -109,6 +109,7 @@ module.exports = { 'exports': 'always-multiline', 'functions': 'never', }], + 'comma-spacing': ['error', { 'before': false, 'after': true }], 'no-trailing-spaces': 'error', 'linebreak-style': ['error', 'unix'], 'prefer-template': ['error'], diff --git a/packages/app-cli/app/command-mv.js b/packages/app-cli/app/command-mv.js index 999033eb9..0e5dd089b 100644 --- a/packages/app-cli/app/command-mv.js +++ b/packages/app-cli/app/command-mv.js @@ -26,7 +26,7 @@ class Command extends BaseCommand { const destinationDuplicates = await Folder.search({ titlePattern: destination, limit: 2 }); if (destinationDuplicates.length > 1) { - throw new Error(_('Ambiguous notebook "%s". Please use short notebook id instead - press "ti" to see the short notebook id' , destination)); + throw new Error(_('Ambiguous notebook "%s". Please use short notebook id instead - press "ti" to see the short notebook id', destination)); } const itemFolder = await app().loadItem(BaseModel.TYPE_FOLDER, pattern); diff --git a/packages/app-cli/app/gui/FolderListWidget.js b/packages/app-cli/app/gui/FolderListWidget.js index c9a694a26..bd6cb960a 100644 --- a/packages/app-cli/app/gui/FolderListWidget.js +++ b/packages/app-cli/app/gui/FolderListWidget.js @@ -36,7 +36,7 @@ class FolderListWidget extends ListWidget { if (Setting.value('showNoteCounts')) { let noteCount = item.note_count; // Subtract children note_count from parent folder. - if (this.folderHasChildren_(this.folders,item.id)) { + if (this.folderHasChildren_(this.folders, item.id)) { for (let i = 0; i < this.folders.length; i++) { if (this.folders[i].parent_id === item.id) { noteCount -= this.folders[i].note_count; diff --git a/packages/app-desktop/checkForUpdates.ts b/packages/app-desktop/checkForUpdates.ts index 5f6100d37..3d5c3087f 100644 --- a/packages/app-desktop/checkForUpdates.ts +++ b/packages/app-desktop/checkForUpdates.ts @@ -40,7 +40,7 @@ async function fetchLatestRelease(options: CheckForUpdateOptions) { if (!response.ok) { const responseText = await response.text(); - throw new Error(`Cannot get latest release info: ${responseText.substr(0,500)}`); + throw new Error(`Cannot get latest release info: ${responseText.substr(0, 500)}`); } const releases = await response.json(); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.test.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.test.ts index 70a4c9d02..8a8b6d595 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.test.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.test.ts @@ -35,14 +35,14 @@ describe('useCursorUtils', () => { const numberedListWithEmptyLines = [ '1. item1', '2. item2', - '3. ' , + '3. ', '4. item3', ]; const noPrefixListWithEmptyLines = [ 'item1', 'item2', - '' , + '', 'item3', ]; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.ts index f55636325..d8019d737 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.ts @@ -111,7 +111,7 @@ export default function useCursorUtils(CodeMirror: any) { const lines = selected.split(/\r?\n/); // Save the newline character to restore it later const newLines = selected.match(/\r?\n/); - modifyListLines(lines,num,string1); + modifyListLines(lines, num, string1); const newLine = newLines !== null ? newLines[0] : '\n'; selectedStrings[i] = lines.join(newLine); } diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx index 5b5ab1f6b..78d2a1821 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx @@ -187,7 +187,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { return prop_htmlToMarkdownRef.current(props.contentMarkupLanguage, editorRef.current.getContent(), props.contentOriginalCss); }, resetScroll: () => { - if (editor) editor.getWin().scrollTo(0,0); + if (editor) editor.getWin().scrollTo(0, 0); }, scrollTo: (options: ScrollOptions) => { if (!editor) return; diff --git a/packages/app-desktop/gui/NoteEditor/styles/index.ts b/packages/app-desktop/gui/NoteEditor/styles/index.ts index f64c3d047..25d71265c 100644 --- a/packages/app-desktop/gui/NoteEditor/styles/index.ts +++ b/packages/app-desktop/gui/NoteEditor/styles/index.ts @@ -7,7 +7,7 @@ export default function styles(props: NoteEditorProps) { return { root: { boxSizing: 'border-box', - paddingLeft: 0,// theme.mainPadding, + paddingLeft: 0, // theme.mainPadding, paddingTop: 0, width: '100%', height: '100%', diff --git a/packages/app-desktop/gui/NoteList/NoteList.tsx b/packages/app-desktop/gui/NoteList/NoteList.tsx index add3b5335..369d937f9 100644 --- a/packages/app-desktop/gui/NoteList/NoteList.tsx +++ b/packages/app-desktop/gui/NoteList/NoteList.tsx @@ -124,7 +124,7 @@ const NoteListComponent = (props: Props) => { }); menu.popup(bridge().window()); - }, [props.selectedNoteIds, props.notes, props.dispatch, props.watchedNoteFiles,props.plugins, props.selectedFolderId, props.customCss]); + }, [props.selectedNoteIds, props.notes, props.dispatch, props.watchedNoteFiles, props.plugins, props.selectedFolderId, props.customCss]); const onGlobalDrop_ = () => { unregisterGlobalDragEndEvent_(); @@ -307,7 +307,7 @@ const NoteListComponent = (props: Props) => { updateSizeState(); } // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied - }, [previousSelectedNoteIds,previousNotes, previousVisible, props.selectedNoteIds, props.notes]); + }, [previousSelectedNoteIds, previousNotes, previousVisible, props.selectedNoteIds, props.notes]); const scrollNoteIndex_ = (keyCode: any, ctrlKey: any, metaKey: any, noteIndex: any) => { diff --git a/packages/app-mobile/components/SelectDateTimeDialog.tsx b/packages/app-mobile/components/SelectDateTimeDialog.tsx index 8a4e94efc..9bb68751a 100644 --- a/packages/app-mobile/components/SelectDateTimeDialog.tsx +++ b/packages/app-mobile/components/SelectDateTimeDialog.tsx @@ -103,7 +103,7 @@ export default class SelectDateTimeDialog extends React.PureComponent return ( - { this.state.date && {time.formatDateToLocal(this.state.date)} } + { this.state.date && {time.formatDateToLocal(this.state.date)} }