mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-08 13:06:15 +02:00
Tools: Enable eslint rule "comma-spacing"
This commit is contained in:
parent
bba3af17b7
commit
4888b4bd14
@ -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'],
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -35,14 +35,14 @@ describe('useCursorUtils', () => {
|
||||
const numberedListWithEmptyLines = [
|
||||
'1. item1',
|
||||
'2. item2',
|
||||
'3. ' ,
|
||||
'3. ',
|
||||
'4. item3',
|
||||
];
|
||||
|
||||
const noPrefixListWithEmptyLines = [
|
||||
'item1',
|
||||
'item2',
|
||||
'' ,
|
||||
'',
|
||||
'item3',
|
||||
];
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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%',
|
||||
|
@ -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) => {
|
||||
|
||||
|
@ -103,7 +103,7 @@ export default class SelectDateTimeDialog extends React.PureComponent<any, any>
|
||||
return (
|
||||
<View style={{ flex: 0, margin: 20, alignItems: 'center' }}>
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||||
{ this.state.date && <Text style={{ ...theme.normalText,color: theme.color, marginRight: 10 }}>{time.formatDateToLocal(this.state.date)}</Text> }
|
||||
{ this.state.date && <Text style={{ ...theme.normalText, color: theme.color, marginRight: 10 }}>{time.formatDateToLocal(this.state.date)}</Text> }
|
||||
<Button title="Set date" onPress={this.onSetDate} />
|
||||
</View>
|
||||
<DateTimePickerModal
|
||||
|
@ -111,7 +111,7 @@ class SyncTargetAmazonS3 extends BaseSyncTarget {
|
||||
|
||||
new HeadBucketCommand({
|
||||
Bucket: options.path(),
|
||||
}),(err, response) => {
|
||||
}), (err, response) => {
|
||||
if (err) reject(err);
|
||||
else resolve(response);
|
||||
});
|
||||
|
@ -353,7 +353,7 @@ class FileApiDriverAmazonS3 {
|
||||
Bucket: this.s3_bucket_,
|
||||
CopySource: this.makePath_(oldPath),
|
||||
Key: newPath,
|
||||
}),(err, response) => {
|
||||
}), (err, response) => {
|
||||
if (err) reject(err);
|
||||
else resolve(response);
|
||||
});
|
||||
|
@ -212,7 +212,7 @@ const markdownUtils = {
|
||||
const filterRegex = /^[# \n\t*`-]*/;
|
||||
const lines = body.trim().split('\n');
|
||||
const title = lines[0].trim();
|
||||
return title.replace(filterRegex, '').replace(mdLinkRegex, '$1').replace(emptyMdLinkRegex, '$1').substring(0,80);
|
||||
return title.replace(filterRegex, '').replace(mdLinkRegex, '$1').replace(emptyMdLinkRegex, '$1').substring(0, 80);
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -880,7 +880,7 @@ class Setting extends BaseModel {
|
||||
public: false,
|
||||
},
|
||||
|
||||
showNoteCounts: { value: true, type: SettingItemType.Bool, storage: SettingStorage.File, isGlobal: true, public: false, advanced: true, appTypes: [AppType.Desktop,AppType.Cli], label: () => _('Show note counts') },
|
||||
showNoteCounts: { value: true, type: SettingItemType.Bool, storage: SettingStorage.File, isGlobal: true, public: false, advanced: true, appTypes: [AppType.Desktop, AppType.Cli], label: () => _('Show note counts') },
|
||||
|
||||
layoutButtonSequence: {
|
||||
value: Setting.LAYOUT_ALL,
|
||||
@ -1259,7 +1259,7 @@ class Setting extends BaseModel {
|
||||
isGlobal: true,
|
||||
},
|
||||
|
||||
'style.editor.contentMaxWidth': { value: 0, type: SettingItemType.Int, public: true, storage: SettingStorage.File, isGlobal: true,appTypes: [AppType.Desktop], section: 'appearance', label: () => _('Editor maximum width'), description: () => _('Set it to 0 to make it take the complete available space. Recommended width is 600.') },
|
||||
'style.editor.contentMaxWidth': { value: 0, type: SettingItemType.Int, public: true, storage: SettingStorage.File, isGlobal: true, appTypes: [AppType.Desktop], section: 'appearance', label: () => _('Editor maximum width'), description: () => _('Set it to 0 to make it take the complete available space. Recommended width is 600.') },
|
||||
|
||||
'ui.layout': { value: {}, type: SettingItemType.Object, storage: SettingStorage.File, isGlobal: true, public: false, appTypes: [AppType.Desktop] },
|
||||
|
||||
|
@ -158,7 +158,7 @@ export default class OneDriveApi {
|
||||
delete options.contentLength;
|
||||
delete options.startByte;
|
||||
|
||||
const response = await shim.fetch(url,options);
|
||||
const response = await shim.fetch(url, options);
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ export default class OneDriveApi {
|
||||
async execAccountPropertiesRequest() {
|
||||
|
||||
try {
|
||||
const response = await this.exec('GET','https://graph.microsoft.com/v1.0/me/drive');
|
||||
const response = await this.exec('GET', 'https://graph.microsoft.com/v1.0/me/drive');
|
||||
const data = await response.json();
|
||||
const accountProperties = { accountType: data.driveType, driveId: data.id };
|
||||
return accountProperties;
|
||||
|
@ -103,7 +103,7 @@ describe('reducer', function() {
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[2].id });
|
||||
|
||||
// expect that the third note is missing, and the 4th note is now selected
|
||||
const expected = createExpectedState(notes, [0,1,3,4], [3]);
|
||||
const expected = createExpectedState(notes, [0, 1, 3, 4], [3]);
|
||||
|
||||
// check the ids of all the remaining notes
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
@ -119,7 +119,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[0].id });
|
||||
|
||||
const expected = createExpectedState(notes, [1,2,3,4], [1]);
|
||||
const expected = createExpectedState(notes, [1, 2, 3, 4], [1]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -147,7 +147,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[4].id });
|
||||
|
||||
const expected = createExpectedState(notes, [0,1,2,3], [3]);
|
||||
const expected = createExpectedState(notes, [0, 1, 2, 3], [3]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -161,7 +161,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id });
|
||||
|
||||
const expected = createExpectedState(notes, [0,2,3,4], [3]);
|
||||
const expected = createExpectedState(notes, [0, 2, 3, 4], [3]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -175,7 +175,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id });
|
||||
|
||||
const expected = createExpectedState(notes, [0,1,2,4], [1]);
|
||||
const expected = createExpectedState(notes, [0, 1, 2, 4], [1]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -184,13 +184,13 @@ describe('reducer', function() {
|
||||
it('should delete selected notes', (async () => {
|
||||
const folders = await createNTestFolders(1);
|
||||
const notes = await createNTestNotes(5, folders[0]);
|
||||
let state = initTestState(folders, 0, notes, [1,2]);
|
||||
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 });
|
||||
|
||||
const expected = createExpectedState(notes, [0,3,4], [3]);
|
||||
const expected = createExpectedState(notes, [0, 3, 4], [3]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -199,12 +199,12 @@ describe('reducer', function() {
|
||||
it('should delete note when a notes below it are selected', (async () => {
|
||||
const folders = await createNTestFolders(1);
|
||||
const notes = await createNTestNotes(5, folders[0]);
|
||||
let state = initTestState(folders, 0, notes, [3,4]);
|
||||
let state = initTestState(folders, 0, notes, [3, 4]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[1].id });
|
||||
|
||||
const expected = createExpectedState(notes, [0,2,3,4], [3,4]);
|
||||
const expected = createExpectedState(notes, [0, 2, 3, 4], [3, 4]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -213,12 +213,12 @@ describe('reducer', function() {
|
||||
it('should delete note when a notes above it are selected', (async () => {
|
||||
const folders = await createNTestFolders(1);
|
||||
const notes = await createNTestNotes(5, folders[0]);
|
||||
let state = initTestState(folders, 0, notes, [1,2]);
|
||||
let state = initTestState(folders, 0, notes, [1, 2]);
|
||||
|
||||
// test action
|
||||
state = reducer(state, { type: 'NOTE_DELETE', id: notes[3].id });
|
||||
|
||||
const expected = createExpectedState(notes, [0,1,2,4], [1,2]);
|
||||
const expected = createExpectedState(notes, [0, 1, 2, 4], [1, 2]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -227,13 +227,13 @@ describe('reducer', function() {
|
||||
it('should delete notes at end', (async () => {
|
||||
const folders = await createNTestFolders(1);
|
||||
const notes = await createNTestNotes(5, folders[0]);
|
||||
let state = initTestState(folders, 0, notes, [3,4]);
|
||||
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 });
|
||||
|
||||
const expected = createExpectedState(notes, [0,1,2], [2]);
|
||||
const expected = createExpectedState(notes, [0, 1, 2], [2]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -242,14 +242,14 @@ describe('reducer', function() {
|
||||
it('should delete notes when non-contiguous selection', (async () => {
|
||||
const folders = await createNTestFolders(1);
|
||||
const notes = await createNTestNotes(5, folders[0]);
|
||||
let state = initTestState(folders, 0, notes, [0,2,4]);
|
||||
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 });
|
||||
|
||||
const expected = createExpectedState(notes, [1,3], [1]);
|
||||
const expected = createExpectedState(notes, [1, 3], [1]);
|
||||
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
@ -264,7 +264,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id });
|
||||
|
||||
const expected = createExpectedState(folders, [0,1,3,4], [3]);
|
||||
const expected = createExpectedState(folders, [0, 1, 3, 4], [3]);
|
||||
|
||||
expect(getIds(state.folders)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedFolderId).toEqual(expected.selectedIds[0]);
|
||||
@ -278,7 +278,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id });
|
||||
|
||||
const expected = createExpectedState(folders, [0,1,3,4], [1]);
|
||||
const expected = createExpectedState(folders, [0, 1, 3, 4], [1]);
|
||||
|
||||
expect(getIds(state.folders)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedFolderId).toEqual(expected.selectedIds[0]);
|
||||
@ -292,7 +292,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'FOLDER_DELETE', id: folders[2].id });
|
||||
|
||||
const expected = createExpectedState(folders, [0,1,3,4], [4]);
|
||||
const expected = createExpectedState(folders, [0, 1, 3, 4], [4]);
|
||||
|
||||
expect(getIds(state.folders)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedFolderId).toEqual(expected.selectedIds[0]);
|
||||
@ -306,7 +306,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'TAG_DELETE', id: tags[2].id });
|
||||
|
||||
const expected = createExpectedState(tags, [0,1,3,4], [3]);
|
||||
const expected = createExpectedState(tags, [0, 1, 3, 4], [3]);
|
||||
|
||||
expect(getIds(state.tags)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedTagId).toEqual(expected.selectedIds[0]);
|
||||
@ -319,7 +319,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'TAG_DELETE', id: tags[4].id });
|
||||
|
||||
const expected = createExpectedState(tags, [0,1,2,3], [2]);
|
||||
const expected = createExpectedState(tags, [0, 1, 2, 3], [2]);
|
||||
|
||||
expect(getIds(state.tags)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedTagId).toEqual(expected.selectedIds[0]);
|
||||
@ -332,7 +332,7 @@ describe('reducer', function() {
|
||||
// test action
|
||||
state = reducer(state, { type: 'TAG_DELETE', id: tags[0].id });
|
||||
|
||||
const expected = createExpectedState(tags, [1,2,3,4], [2]);
|
||||
const expected = createExpectedState(tags, [1, 2, 3, 4], [2]);
|
||||
|
||||
expect(getIds(state.tags)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedTagId).toEqual(expected.selectedIds[0]);
|
||||
@ -345,18 +345,18 @@ describe('reducer', function() {
|
||||
notes.push(...await createNTestNotes(3, folders[i]));
|
||||
}
|
||||
|
||||
let state = initTestState(folders, 0, notes.slice(0,3), [0]);
|
||||
let state = initTestState(folders, 0, notes.slice(0, 3), [0]);
|
||||
|
||||
let expected = createExpectedState(notes, [0,1,2], [0]);
|
||||
let expected = createExpectedState(notes, [0, 1, 2], [0]);
|
||||
|
||||
expect(state.notes.length).toEqual(expected.items.length);
|
||||
expect(getIds(state.notes.slice(0,4))).toEqual(getIds(expected.items));
|
||||
expect(getIds(state.notes.slice(0, 4))).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
|
||||
// test action
|
||||
state = reducer(state, { type: 'NOTE_SELECT_ALL' });
|
||||
|
||||
expected = createExpectedState(notes.slice(0,3), [0,1,2], [0,1,2]);
|
||||
expected = createExpectedState(notes.slice(0, 3), [0, 1, 2], [0, 1, 2]);
|
||||
expect(getIds(state.notes)).toEqual(getIds(expected.items));
|
||||
expect(state.selectedNoteIds).toEqual(expected.selectedIds);
|
||||
}));
|
||||
@ -395,7 +395,7 @@ describe('reducer', function() {
|
||||
notes.push(...await createNTestNotes(3, folders[i]));
|
||||
}
|
||||
|
||||
let state = initTestState(folders, 0, notes.slice(0,3), [0]);
|
||||
let state = initTestState(folders, 0, notes.slice(0, 3), [0]);
|
||||
state = goToNote(notes, [1], state);
|
||||
state = goToNote(notes, [2], state);
|
||||
|
||||
@ -417,7 +417,7 @@ describe('reducer', function() {
|
||||
notes.push(...await createNTestNotes(5, folders[i]));
|
||||
}
|
||||
|
||||
let state = initTestState(folders, 0, notes.slice(0,5), [0]);
|
||||
let state = initTestState(folders, 0, notes.slice(0, 5), [0]);
|
||||
state = goToNote(notes, [1], state);
|
||||
state = goToNote(notes, [2], state);
|
||||
state = goToNote(notes, [3], state);
|
||||
@ -426,20 +426,20 @@ describe('reducer', function() {
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0, 4)));
|
||||
|
||||
state = goBackWard(state);
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0,3)));
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0, 3)));
|
||||
expect(getIds(state.forwardHistoryNotes)).toEqual(getIds(notes.slice(4, 5)));
|
||||
|
||||
state = goBackWard(state);
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0,2)));
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0, 2)));
|
||||
// because we push the last seen note to stack.
|
||||
expect(getIds(state.forwardHistoryNotes)).toEqual(getIds([notes[4], notes[3]]));
|
||||
|
||||
state = goForward(state);
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0,3)));
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0, 3)));
|
||||
expect(getIds(state.forwardHistoryNotes)).toEqual(getIds([notes[4]]));
|
||||
|
||||
state = goForward(state);
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0,4)));
|
||||
expect(getIds(state.backwardHistoryNotes)).toEqual(getIds(notes.slice(0, 4)));
|
||||
expect(getIds(state.forwardHistoryNotes)).toEqual([]);
|
||||
}));
|
||||
|
||||
@ -450,7 +450,7 @@ describe('reducer', function() {
|
||||
notes.push(...await createNTestNotes(5, folders[i]));
|
||||
}
|
||||
|
||||
let state = initTestState(folders, 0, notes.slice(0,5), [0]);
|
||||
let state = initTestState(folders, 0, notes.slice(0, 5), [0]);
|
||||
|
||||
state = goToNote(notes, [1], state);
|
||||
state = goToNote(notes, [2], state);
|
||||
|
@ -13,7 +13,7 @@ class UndoQueue {
|
||||
push(e: any) {
|
||||
this.inner_.push(e);
|
||||
while (this.length > this.size_) {
|
||||
this.inner_.splice(0,1);
|
||||
this.inner_.splice(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,14 +267,14 @@ describe('services_EncryptionService', function() {
|
||||
|
||||
// First check that we can replicate the error with the old encryption method
|
||||
service.defaultEncryptionMethod_ = EncryptionMethod.SJCL;
|
||||
const hasThrown = await checkThrowAsync(async () => await service.encryptString('🐶🐶🐶'.substr(0,5)));
|
||||
const hasThrown = await checkThrowAsync(async () => await service.encryptString('🐶🐶🐶'.substr(0, 5)));
|
||||
expect(hasThrown).toBe(true);
|
||||
|
||||
// Now check that the new one fixes the problem
|
||||
service.defaultEncryptionMethod_ = EncryptionMethod.SJCL1a;
|
||||
const cipherText = await service.encryptString('🐶🐶🐶'.substr(0,5));
|
||||
const cipherText = await service.encryptString('🐶🐶🐶'.substr(0, 5));
|
||||
const plainText = await service.decryptString(cipherText);
|
||||
expect(plainText).toBe('🐶🐶🐶'.substr(0,5));
|
||||
expect(plainText).toBe('🐶🐶🐶'.substr(0, 5));
|
||||
}));
|
||||
|
||||
it('should check if a master key is loaded', (async () => {
|
||||
|
@ -66,7 +66,7 @@ export interface PluginSettings {
|
||||
|
||||
function makePluginId(source: string): string {
|
||||
// https://www.npmjs.com/package/slug#options
|
||||
return uslug(source).substr(0,32);
|
||||
return uslug(source).substr(0, 32);
|
||||
}
|
||||
|
||||
export default class PluginService extends BaseService {
|
||||
|
@ -9,7 +9,7 @@ const shared = require('../../../components/shared/config-shared.js');
|
||||
|
||||
const logger = Logger.create('defaultPluginsUtils');
|
||||
|
||||
export function checkPreInstalledDefaultPlugins(defaultPluginsId: string[],pluginSettings: PluginSettings) {
|
||||
export function checkPreInstalledDefaultPlugins(defaultPluginsId: string[], pluginSettings: PluginSettings) {
|
||||
const installedDefaultPlugins: Array<string> = Setting.value('installedDefaultPlugins');
|
||||
for (const pluginId of defaultPluginsId) {
|
||||
// if pluginId is present in pluginSettings and not in installedDefaultPlugins array,
|
||||
|
@ -604,7 +604,7 @@ describe('services_SearchFilter', function() {
|
||||
const n11 = await Note.save({ title: 'I also made this', body: 'today', updated_time: today, user_updated_time: today }, { autoTimestamp: false });
|
||||
|
||||
const n2 = await Note.save({ title: 'I made this', body: 'yesterday', updated_time: yesterday, user_updated_time: yesterday }, { autoTimestamp: false });
|
||||
const n3 = await Note.save({ title: 'I made this', body: 'day before yesterday', updated_time: dayBeforeYesterday ,user_updated_time: dayBeforeYesterday }, { autoTimestamp: false });
|
||||
const n3 = await Note.save({ title: 'I made this', body: 'day before yesterday', updated_time: dayBeforeYesterday, user_updated_time: dayBeforeYesterday }, { autoTimestamp: false });
|
||||
|
||||
await engine.syncTables();
|
||||
|
||||
|
@ -247,7 +247,7 @@ const genericFilter = (terms: Term[], conditions: string[], params: string[], re
|
||||
};
|
||||
|
||||
const biConditionalFilter = (terms: Term[], conditions: string[], relation: Relation, filterName: string, useFts: boolean) => {
|
||||
const getCondition = (filterName: string , value: string, relation: Relation) => {
|
||||
const getCondition = (filterName: string, value: string, relation: Relation) => {
|
||||
const tableName = useFts ? (relation === 'AND' ? 'notes_fts' : 'notes_normalized') : 'notes';
|
||||
if (filterName === 'type') {
|
||||
return `${tableName}.is_todo IS ${value === 'todo' ? 1 : 0}`;
|
||||
@ -487,9 +487,9 @@ export default function queryBuilder(terms: Term[], useFts: boolean) {
|
||||
// So we're first finding the OR of other filters and then combining them with the notebook filter using AND
|
||||
// in-required-notebook AND (condition #1 OR condition #2 OR ... )
|
||||
const queryString = `${queryParts.slice(0, 2).join(' ')} AND ROWID IN ( SELECT ROWID FROM notes_fts WHERE 1=0 ${queryParts.slice(2).join(' ')})`;
|
||||
query = ['WITH RECURSIVE' , withs.join(',') , queryString].join(' ');
|
||||
query = ['WITH RECURSIVE', withs.join(','), queryString].join(' ');
|
||||
} else {
|
||||
query = ['WITH RECURSIVE' , withs.join(',') ,queryParts.join(' ')].join(' ');
|
||||
query = ['WITH RECURSIVE', withs.join(','), queryParts.join(' ')].join(' ');
|
||||
}
|
||||
} else {
|
||||
query = queryParts.join(' ');
|
||||
|
@ -98,7 +98,7 @@ describe('Synchronizer.e2ee', function() {
|
||||
expect(remoteInfo.masterKeys[0].hasBeenUsed).toBe(true);
|
||||
}));
|
||||
|
||||
it('should enable encryption automatically when downloading new master key (and none was previously available)',(async () => {
|
||||
it('should enable encryption automatically when downloading new master key (and none was previously available)', (async () => {
|
||||
// Enable encryption on client 1 and sync an item
|
||||
setEncryptionEnabled(true);
|
||||
await loadEncryptionMasterKey();
|
||||
|
@ -904,7 +904,7 @@ class TestApp extends BaseApplication {
|
||||
if (!argv.includes('--profile')) {
|
||||
argv = argv.concat(['--profile', `tests-build/profile/${uuid.create()}`]);
|
||||
}
|
||||
argv = await super.start(['',''].concat(argv));
|
||||
argv = await super.start(['', ''].concat(argv));
|
||||
|
||||
// For now, disable sync and encryption to avoid spurious intermittent failures
|
||||
// caused by them interupting processing and causing delays.
|
||||
|
@ -45,7 +45,7 @@ export function themeById(themeId: string) {
|
||||
// globalStyle should be used for properties that do not change across themes
|
||||
// i.e. should not be used for colors
|
||||
const globalStyle: any = {
|
||||
fontFamily: 'Roboto',// 'sans-serif',
|
||||
fontFamily: 'Roboto', // 'sans-serif',
|
||||
margin: 15, // No text and no interactive component should be within this margin
|
||||
itemMarginTop: 10,
|
||||
itemMarginBottom: 10,
|
||||
|
@ -60,7 +60,7 @@ const useScrollSaver = ({ container, scaledSize, pdfId, rememberScroll, onActive
|
||||
|
||||
useEffect(() => {
|
||||
currentScaleSize.current = scaledSize;
|
||||
} , [scaledSize]);
|
||||
}, [scaledSize]);
|
||||
};
|
||||
|
||||
export default useScrollSaver;
|
||||
|
@ -20,7 +20,7 @@ const useVisibleOnSelect = ({ container, wrapperRef, isVisible, isSelected }: Vi
|
||||
|
||||
useEffect(() => {
|
||||
isVisibleRef.current = isVisible;
|
||||
} , [isVisible]);
|
||||
}, [isVisible]);
|
||||
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ export default function GotoInput(props: GotoInputProps) {
|
||||
|
||||
const inputFocus = useCallback(() => {
|
||||
inputRef.current?.select();
|
||||
} , []);
|
||||
}, []);
|
||||
|
||||
const onPageNoInput = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
if (e.target.value.length <= 0) return;
|
||||
@ -57,7 +57,7 @@ export default function GotoInput(props: GotoInputProps) {
|
||||
|
||||
useEffect(() => {
|
||||
inputRef.current.value = props.currentPage.toString();
|
||||
} , [props.currentPage]);
|
||||
}, [props.currentPage]);
|
||||
|
||||
return (<Group size={props.size || 1}>
|
||||
<FontAwesomeIcon icon={faAngleLeft} title="Previous Page" style={{ cursor: 'pointer' }} onClick={() => props.onChange(props.currentPage - 1)} />
|
||||
|
@ -172,7 +172,7 @@ describe('api_items', function() {
|
||||
});
|
||||
|
||||
test('should report errors when batch uploading', async function() {
|
||||
const { user: user1,session: session1 } = await createUserAndSession(1, false);
|
||||
const { user: user1, session: session1 } = await createUserAndSession(1, false);
|
||||
|
||||
const note1 = makeNoteSerializedBody({ id: '00000000000000000000000000000001' });
|
||||
await models().user().save({ id: user1.id, max_item_size: note1.length });
|
||||
|
@ -90,7 +90,7 @@ const later = require('later');
|
||||
if (numbers.length === 2) return expectedStep;
|
||||
|
||||
// Check that every number is the previous number + the first number
|
||||
return numbers.slice(1).every(function(n,i,a) {
|
||||
return numbers.slice(1).every(function(n, i, a) {
|
||||
return (i === 0 ? n : n - a[i - 1]) === expectedStep;
|
||||
}) ? expectedStep : 0;
|
||||
};
|
||||
|
@ -123,7 +123,7 @@ describe('bundleDefaultPlugins', function() {
|
||||
};
|
||||
|
||||
it('should get local plugin versions', async () => {
|
||||
const manifestsPath = join(supportDir, 'pluginRepo','plugins');
|
||||
const manifestsPath = join(supportDir, 'pluginRepo', 'plugins');
|
||||
const testDefaultPluginsInfo = {
|
||||
'joplin.plugin.ambrt.backlinksToNote': { version: '1.0.4' },
|
||||
'org.joplinapp.plugins.ToggleSidebars': { version: '1.0.2' },
|
||||
@ -142,14 +142,14 @@ describe('bundleDefaultPlugins', function() {
|
||||
downloadedPlugin1: 'joplin-plugin-rich-markdown-0.9.0.tgz',
|
||||
downloadedPlugin2: 'joplin-plugin-backup-1.1.0.tgz',
|
||||
numberOfCalls: 4,
|
||||
calledWith: ['https://registry.npmjs.org/joplin-plugin-rich-markdown','response-1-link','https://registry.npmjs.org/joplin-plugin-backup','response-2-link'],
|
||||
calledWith: ['https://registry.npmjs.org/joplin-plugin-rich-markdown', 'response-1-link', 'https://registry.npmjs.org/joplin-plugin-backup', 'response-2-link'],
|
||||
},
|
||||
{
|
||||
localVersions: { 'io.github.jackgruber.backup': '1.1.0', 'plugin.calebjohn.rich-markdown': '0.0.0' },
|
||||
downloadedPlugin1: 'joplin-plugin-rich-markdown-0.9.0.tgz',
|
||||
downloadedPlugin2: undefined,
|
||||
numberOfCalls: 2,
|
||||
calledWith: ['https://registry.npmjs.org/joplin-plugin-rich-markdown','response-1-link'],
|
||||
calledWith: ['https://registry.npmjs.org/joplin-plugin-rich-markdown', 'response-1-link'],
|
||||
},
|
||||
{
|
||||
localVersions: { 'io.github.jackgruber.backup': '1.1.0', 'plugin.calebjohn.rich-markdown': '0.9.0' },
|
||||
|
@ -34,7 +34,7 @@ async function downloadFile(url: string, outputPath: string) {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
const responseText = await response.text();
|
||||
throw new Error(`Cannot download file from ${url} : ${responseText.substr(0,500)}`);
|
||||
throw new Error(`Cannot download file from ${url} : ${responseText.substr(0, 500)}`);
|
||||
}
|
||||
await writeFile(outputPath, await response.buffer());
|
||||
}
|
||||
@ -42,8 +42,8 @@ async function downloadFile(url: string, outputPath: string) {
|
||||
export async function extractPlugins(currentDir: string, defaultPluginDir: string, downloadedPluginsNames: PluginIdAndName): Promise<void> {
|
||||
for (const pluginId of Object.keys(downloadedPluginsNames)) {
|
||||
await execCommand2(`tar xzf ${currentDir}/${downloadedPluginsNames[pluginId]}`, { quiet: true });
|
||||
await move(`package/publish/${pluginId}.jpl`,`${defaultPluginDir}/${pluginId}/plugin.jpl`, { overwrite: true });
|
||||
await move(`package/publish/${pluginId}.json`,`${defaultPluginDir}/${pluginId}/manifest.json`, { overwrite: true });
|
||||
await move(`package/publish/${pluginId}.jpl`, `${defaultPluginDir}/${pluginId}/plugin.jpl`, { overwrite: true });
|
||||
await move(`package/publish/${pluginId}.json`, `${defaultPluginDir}/${pluginId}/manifest.json`, { overwrite: true });
|
||||
await remove(`${downloadedPluginsNames[pluginId]}`);
|
||||
await remove('package');
|
||||
}
|
||||
@ -58,7 +58,7 @@ export const downloadPlugins = async (localPluginsVersions: PluginAndVersion, de
|
||||
|
||||
if (!response.ok) {
|
||||
const responseText = await response.text();
|
||||
throw new Error(`Cannot fetch ${manifests[pluginId]._npm_package_name} release info from NPM : ${responseText.substr(0,500)}`);
|
||||
throw new Error(`Cannot fetch ${manifests[pluginId]._npm_package_name} release info from NPM : ${responseText.substr(0, 500)}`);
|
||||
}
|
||||
const releaseText = await response.text();
|
||||
const release = JSON.parse(releaseText);
|
||||
@ -74,7 +74,7 @@ export const downloadPlugins = async (localPluginsVersions: PluginAndVersion, de
|
||||
};
|
||||
|
||||
async function start(): Promise<void> {
|
||||
const defaultPluginDir = join(__dirname, '..', '..', 'packages', 'app-desktop', 'build','defaultPlugins');
|
||||
const defaultPluginDir = join(__dirname, '..', '..', 'packages', 'app-desktop', 'build', 'defaultPlugins');
|
||||
const defaultPluginsInfo = getDefaultPluginsInfo();
|
||||
|
||||
const manifestData = await fetch('https://raw.githubusercontent.com/joplin/plugins/master/manifests.json');
|
||||
|
@ -22,7 +22,7 @@ interface PostContent {
|
||||
parsed: MarkdownAndFrontMatter;
|
||||
}
|
||||
|
||||
const ignoredPostIds = ['20180621-172112','20180621-182112','20180906-101039','20180906-111039','20180916-200431','20180916-210431','20180929-111053','20180929-121053','20181004-081123','20181004-091123','20181101-174335','20181213-173459','20190130-230218','20190404-064157','20190404-074157','20190424-102410','20190424-112410','20190523-221026','20190523-231026','20190610-230711','20190611-000711','20190613-192613','20190613-202613','20190814-215957','20190814-225957','20190924-230254','20190925-000254','20190929-142834','20190929-152834','20191012-223121','20191012-233121','20191014-155136','20191014-165136','20191101-131852','20191117-183855','20191118-072700','20200220-190804','20200301-125055','20200314-001555','20200406-214254','20200406-224254','20200505-181736','20200606-151446','20200607-112720','20200613-103545','20200616-191918','20200620-114515','20200622-084127','20200626-134029','20200708-192444','20200906-172325','20200913-163730','20200915-091108','20201030-114530','20201126-114649','20201130-145937','20201212-172039','20201228-112150','20210104-131645','20210105-153008','20210130-144626','20210309-111950','20210310-100852','20210413-091132','20210430-083248','20210506-083359','20210513-095238','20210518-085514','20210621-104753','20210624-171844','20210705-094247','20210706-140228','20210711-095626','20210718-103538','20210729-103234','20210804-085003','20210831-154354','20210901-113415','20210929-144036','20210930-163458','20211031-115215','20211102-150403','20211217-120324','20220215-142000','20220224-release-2-7','20220308-gsoc2022-start','20220405-gsoc-contributor-proposals'];
|
||||
const ignoredPostIds = ['20180621-172112', '20180621-182112', '20180906-101039', '20180906-111039', '20180916-200431', '20180916-210431', '20180929-111053', '20180929-121053', '20181004-081123', '20181004-091123', '20181101-174335', '20181213-173459', '20190130-230218', '20190404-064157', '20190404-074157', '20190424-102410', '20190424-112410', '20190523-221026', '20190523-231026', '20190610-230711', '20190611-000711', '20190613-192613', '20190613-202613', '20190814-215957', '20190814-225957', '20190924-230254', '20190925-000254', '20190929-142834', '20190929-152834', '20191012-223121', '20191012-233121', '20191014-155136', '20191014-165136', '20191101-131852', '20191117-183855', '20191118-072700', '20200220-190804', '20200301-125055', '20200314-001555', '20200406-214254', '20200406-224254', '20200505-181736', '20200606-151446', '20200607-112720', '20200613-103545', '20200616-191918', '20200620-114515', '20200622-084127', '20200626-134029', '20200708-192444', '20200906-172325', '20200913-163730', '20200915-091108', '20201030-114530', '20201126-114649', '20201130-145937', '20201212-172039', '20201228-112150', '20210104-131645', '20210105-153008', '20210130-144626', '20210309-111950', '20210310-100852', '20210413-091132', '20210430-083248', '20210506-083359', '20210513-095238', '20210518-085514', '20210621-104753', '20210624-171844', '20210705-094247', '20210706-140228', '20210711-095626', '20210718-103538', '20210729-103234', '20210804-085003', '20210831-154354', '20210901-113415', '20210929-144036', '20210930-163458', '20211031-115215', '20211102-150403', '20211217-120324', '20220215-142000', '20220224-release-2-7', '20220308-gsoc2022-start', '20220405-gsoc-contributor-proposals'];
|
||||
|
||||
const getPosts = async (newsDir: string): Promise<Post[]> => {
|
||||
const filenames = await readdir(newsDir);
|
||||
|
Loading…
Reference in New Issue
Block a user