You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Tools: Add eslint rule "no-unneeded-ternary"
This commit is contained in:
		| @@ -92,6 +92,7 @@ module.exports = { | ||||
| 		// "react-hooks/exhaustive-deps": "warn", | ||||
|  | ||||
| 		'promise/prefer-await-to-then': 'error', | ||||
| 		'no-unneeded-ternary': 'error', | ||||
|  | ||||
| 		// ------------------------------- | ||||
| 		// Formatting | ||||
|   | ||||
| @@ -512,14 +512,14 @@ function useMenu(props: Props) { | ||||
| 				// Issue: https://github.com/laurent22/joplin/issues/934 | ||||
| 				submenu: [{ | ||||
| 					label: _('About Joplin'), | ||||
| 					visible: shim.isMac() ? true : false, | ||||
| 					visible: !!shim.isMac(), | ||||
| 					click: () => _showAbout(), | ||||
| 				}, { | ||||
| 					type: 'separator', | ||||
| 					visible: shim.isMac() ? true : false, | ||||
| 					visible: !!shim.isMac(), | ||||
| 				}, { | ||||
| 					label: _('Preferences...'), | ||||
| 					visible: shim.isMac() ? true : false, | ||||
| 					visible: !!shim.isMac(), | ||||
| 					accelerator: shim.isMac() && keymapService.getAccelerator('config'), | ||||
| 					click: () => { | ||||
| 						props.dispatch({ | ||||
| @@ -529,11 +529,11 @@ function useMenu(props: Props) { | ||||
| 					}, | ||||
| 				}, { | ||||
| 					label: _('Check for updates...'), | ||||
| 					visible: shim.isMac() ? true : false, | ||||
| 					visible: !!shim.isMac(), | ||||
| 					click: () => _checkForUpdates(), | ||||
| 				}, { | ||||
| 					type: 'separator', | ||||
| 					visible: shim.isMac() ? true : false, | ||||
| 					visible: !!shim.isMac(), | ||||
| 				}, | ||||
| 				shim.isMac() ? noItem : newNoteItem, | ||||
| 				shim.isMac() ? noItem : newTodoItem, | ||||
| @@ -541,14 +541,14 @@ function useMenu(props: Props) { | ||||
| 				shim.isMac() ? noItem : newSubFolderItem, | ||||
| 				{ | ||||
| 					type: 'separator', | ||||
| 					visible: shim.isMac() ? false : true, | ||||
| 					visible: !shim.isMac(), | ||||
| 				}, { | ||||
| 					label: _('Import'), | ||||
| 					visible: shim.isMac() ? false : true, | ||||
| 					visible: !shim.isMac(), | ||||
| 					submenu: importItems, | ||||
| 				}, { | ||||
| 					label: _('Export all'), | ||||
| 					visible: shim.isMac() ? false : true, | ||||
| 					visible: !shim.isMac(), | ||||
| 					submenu: exportItems, | ||||
| 				}, { | ||||
| 					type: 'separator', | ||||
| @@ -586,7 +586,7 @@ function useMenu(props: Props) { | ||||
|  | ||||
| 			const rootMenuFileMacOs = { | ||||
| 				label: _('&File'), | ||||
| 				visible: shim.isMac() ? true : false, | ||||
| 				visible: !!shim.isMac(), | ||||
| 				submenu: [ | ||||
| 					newNoteItem, | ||||
| 					newTodoItem, | ||||
| @@ -796,7 +796,7 @@ function useMenu(props: Props) { | ||||
| 						click() { void bridge().openExternal('https://joplinapp.org/donate/'); }, | ||||
| 					}, { | ||||
| 						label: _('Check for updates...'), | ||||
| 						visible: shim.isMac() ? false : true, | ||||
| 						visible: !shim.isMac(), | ||||
| 						click: () => _checkForUpdates(), | ||||
| 					}, | ||||
| 					separator(), | ||||
| @@ -818,10 +818,10 @@ function useMenu(props: Props) { | ||||
|  | ||||
| 					{ | ||||
| 						type: 'separator', | ||||
| 						visible: shim.isMac() ? false : true, | ||||
| 						visible: !shim.isMac(), | ||||
| 					}, { | ||||
| 						label: _('About Joplin'), | ||||
| 						visible: shim.isMac() ? false : true, | ||||
| 						visible: !shim.isMac(), | ||||
| 						click: () => _showAbout(), | ||||
| 					}], | ||||
| 				}, | ||||
|   | ||||
| @@ -236,7 +236,7 @@ shared.initState = async function(comp: any) { | ||||
| 		mode: mode, | ||||
| 		folder: folder, | ||||
| 		isLoading: false, | ||||
| 		fromShare: comp.props.sharedData ? true : false, | ||||
| 		fromShare: !!comp.props.sharedData, | ||||
| 		noteResources: await shared.attachedResources(note ? note.body : ''), | ||||
| 	}); | ||||
|  | ||||
|   | ||||
| @@ -11,5 +11,5 @@ export default function(url: string) { | ||||
| 		return true; | ||||
| 	} | ||||
|  | ||||
| 	return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true; | ||||
| 	return BAD_PROTO_RE.test(str) ? (!!GOOD_DATA_RE.test(str)) : true; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user