1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Tools: Enable eslint rule comma-dangle: always-multiline for functions

This commit is contained in:
Laurent Cozic 2023-08-23 18:28:00 +01:00
parent 5a8032050d
commit 77df474b46
126 changed files with 335 additions and 335 deletions

View File

@ -119,7 +119,7 @@ module.exports = {
'objects': 'always-multiline', 'objects': 'always-multiline',
'imports': 'always-multiline', 'imports': 'always-multiline',
'exports': 'always-multiline', 'exports': 'always-multiline',
'functions': 'never', 'functions': 'always-multiline',
}], }],
'comma-spacing': ['error', { 'before': false, 'after': true }], 'comma-spacing': ['error', { 'before': false, 'after': true }],
'no-trailing-spaces': 'error', 'no-trailing-spaces': 'error',
@ -209,7 +209,7 @@ module.exports = {
'enums': 'always-multiline', 'enums': 'always-multiline',
'generics': 'always-multiline', 'generics': 'always-multiline',
'tuples': 'always-multiline', 'tuples': 'always-multiline',
'functions': 'never', 'functions': 'always-multiline',
}], }],
'@typescript-eslint/object-curly-spacing': ['error', 'always'], '@typescript-eslint/object-curly-spacing': ['error', 'always'],
'@typescript-eslint/semi': ['error', 'always'], '@typescript-eslint/semi': ['error', 'always'],

View File

@ -50,7 +50,7 @@ class LinkSelector {
link: matches[n][0], link: matches[n][0],
noteX: matches[n].index, noteX: matches[n].index,
noteY: i, noteY: i,
} },
); );
}); });
} }

View File

@ -482,7 +482,7 @@ class AppGui {
if (this.linkSelector_.link) { if (this.linkSelector_.link) {
this.term_.moveTo( this.term_.moveTo(
this.linkSelector_.noteX + cursorOffsetX, this.linkSelector_.noteX + cursorOffsetX,
this.linkSelector_.noteY + cursorOffsetY this.linkSelector_.noteY + cursorOffsetY,
); );
shim.setTimeout(() => this.term_.term().inverse(this.linkSelector_.link), 50); shim.setTimeout(() => this.term_.term().inverse(this.linkSelector_.link), 50);
} }

View File

@ -173,7 +173,7 @@ class Command extends BaseCommand {
reg.db(), reg.db(),
sync.lockHandler(), sync.lockHandler(),
appTypeToLockType(Setting.value('appType')), appTypeToLockType(Setting.value('appType')),
Setting.value('clientId') Setting.value('clientId'),
); );
migrationHandler.setLogger(cliUtils.stdoutLogger(this.stdout.bind(this))); migrationHandler.setLogger(cliUtils.stdoutLogger(this.stdout.bind(this)));

View File

@ -39,7 +39,7 @@ async function createClients() {
// eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied // eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied
execCommand(client, 'config sync.target 2').then(() => { execCommand(client, 'config sync.target 2').then(() => {
return execCommand(client, `config sync.2.path ${syncDir}`); return execCommand(client, `config sync.2.path ${syncDir}`);
}) }),
); );
output.push(client); output.push(client);
} }

View File

@ -248,7 +248,7 @@ describe('MdToHtml', () => {
const result = await mdToHtml.render(input, null, { bodyOnly: true, mapsToLine: true }); const result = await mdToHtml.render(input, null, { bodyOnly: true, mapsToLine: true });
expect(result.html.trim()).toBe('<h1 id="head" class="maps-to-line" source-line="0" source-line-end="1">Head</h1>\n' + expect(result.html.trim()).toBe('<h1 id="head" class="maps-to-line" source-line="0" source-line-end="1">Head</h1>\n' +
'<p class="maps-to-line" source-line="1" source-line-end="2">Fruits</p>\n' + '<p class="maps-to-line" source-line="1" source-line-end="2">Fruits</p>\n' +
'<ul>\n<li class="maps-to-line" source-line="2" source-line-end="3">Apple</li>\n</ul>' '<ul>\n<li class="maps-to-line" source-line="2" source-line-end="3">Apple</li>\n</ul>',
); );
} }
})); }));

View File

@ -24,7 +24,7 @@ function newPluginService(appVersion = '1.4') {
{ {
dispatch: () => {}, dispatch: () => {},
getState: () => {}, getState: () => {},
} },
); );
return service; return service;
} }

View File

@ -19,7 +19,7 @@ function newPluginService(appVersion = '1.4') {
{ {
dispatch: () => {}, dispatch: () => {},
getState: () => {}, getState: () => {},
} },
); );
return service; return service;
} }

View File

@ -19,7 +19,7 @@ export function newPluginService(appVersion = '1.4', options: PluginServiceOptio
{ {
dispatch: () => {}, dispatch: () => {},
getState: options.getState ? options.getState : () => {}, getState: options.getState ? options.getState : () => {},
} },
); );
return service; return service;
} }

View File

@ -10,7 +10,7 @@ delete require.cache[require.resolve('./paths')];
const NODE_ENV = process.env.NODE_ENV; const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) { if (!NODE_ENV) {
throw new Error( throw new Error(
'The NODE_ENV environment variable is required but was not specified.' 'The NODE_ENV environment variable is required but was not specified.',
); );
} }
@ -36,7 +36,7 @@ dotenvFiles.forEach(dotenvFile => {
require('dotenv-expand')( require('dotenv-expand')(
require('dotenv').config({ require('dotenv').config({
path: dotenvFile, path: dotenvFile,
}) }),
); );
} }
}); });
@ -78,7 +78,7 @@ function getClientEnvironment(publicUrl) {
// This should only be used as an escape hatch. Normally you would put // This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths. // images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl, PUBLIC_URL: publicUrl,
} },
); );
// Stringify all values so we can feed into Webpack DefinePlugin // Stringify all values so we can feed into Webpack DefinePlugin
const stringified = { const stringified = {

View File

@ -55,8 +55,8 @@ function getAdditionalModulePaths(options = {}) {
throw new Error( throw new Error(
chalk.red.bold( chalk.red.bold(
'Your project\'s `baseUrl` can only be set to `src` or `node_modules`.' + 'Your project\'s `baseUrl` can only be set to `src` or `node_modules`.' +
' Create React App does not support other values at this time.' ' Create React App does not support other values at this time.',
) ),
); );
} }
@ -109,7 +109,7 @@ function getModules() {
if (hasTsConfig && hasJsConfig) { if (hasTsConfig && hasJsConfig) {
throw new Error( throw new Error(
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.' 'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.',
); );
} }

View File

@ -55,7 +55,7 @@ const moduleFileExtensions = [
// Resolve file paths in the same order as webpack // Resolve file paths in the same order as webpack
const resolveModule = (resolveFn, filePath) => { const resolveModule = (resolveFn, filePath) => {
const extension = moduleFileExtensions.find(extension => const extension = moduleFileExtensions.find(extension =>
fs.existsSync(resolveFn(`${filePath}.${extension}`)) fs.existsSync(resolveFn(`${filePath}.${extension}`)),
); );
if (extension) { if (extension) {

View File

@ -7,14 +7,14 @@ exports.resolveModuleName = (
moduleName, moduleName,
containingFile, containingFile,
compilerOptions, compilerOptions,
resolutionHost resolutionHost,
) => { ) => {
return resolveModuleName( return resolveModuleName(
moduleName, moduleName,
containingFile, containingFile,
compilerOptions, compilerOptions,
resolutionHost, resolutionHost,
typescript.resolveModuleName typescript.resolveModuleName,
); );
}; };
@ -23,13 +23,13 @@ exports.resolveTypeReferenceDirective = (
moduleName, moduleName,
containingFile, containingFile,
compilerOptions, compilerOptions,
resolutionHost resolutionHost,
) => { ) => {
return resolveModuleName( return resolveModuleName(
moduleName, moduleName,
containingFile, containingFile,
compilerOptions, compilerOptions,
resolutionHost, resolutionHost,
typescript.resolveTypeReferenceDirective typescript.resolveTypeReferenceDirective,
); );
}; };

View File

@ -46,15 +46,15 @@ if (process.env.HOST) {
console.log( console.log(
chalk.cyan( chalk.cyan(
`Attempting to bind to HOST environment variable: ${chalk.yellow( `Attempting to bind to HOST environment variable: ${chalk.yellow(
chalk.bold(process.env.HOST) chalk.bold(process.env.HOST),
)}` )}`,
) ),
); );
console.log( console.log(
'If this was unintentional, check that you haven\'t mistakenly set it in your shell.' 'If this was unintentional, check that you haven\'t mistakenly set it in your shell.',
); );
console.log( console.log(
`Learn more here: ${chalk.yellow('https://bit.ly/CRA-advanced-config')}` `Learn more here: ${chalk.yellow('https://bit.ly/CRA-advanced-config')}`,
); );
console.log(); console.log();
} }
@ -102,7 +102,7 @@ checkBrowsers(paths.appPath, isInteractive)
// Serve webpack assets generated by the compiler over a web server. // Serve webpack assets generated by the compiler over a web server.
const serverConfig = createDevServerConfig( const serverConfig = createDevServerConfig(
proxyConfig, proxyConfig,
urls.lanUrlForConfig urls.lanUrlForConfig,
); );
const devServer = new WebpackDevServer(compiler, serverConfig); const devServer = new WebpackDevServer(compiler, serverConfig);
// Launch WebpackDevServer. // Launch WebpackDevServer.
@ -120,8 +120,8 @@ checkBrowsers(paths.appPath, isInteractive)
if (process.env.NODE_PATH) { if (process.env.NODE_PATH) {
console.log( console.log(
chalk.yellow( chalk.yellow(
'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.' 'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.',
) ),
); );
console.log(); console.log();
} }

View File

@ -74,7 +74,7 @@ const pluginClasses = [
const appDefaultState = createAppDefaultState( const appDefaultState = createAppDefaultState(
bridge().windowContentSize(), bridge().windowContentSize(),
resourceEditWatcherDefaultState resourceEditWatcherDefaultState,
); );
class Application extends BaseApplication { class Application extends BaseApplication {

View File

@ -71,36 +71,36 @@ class ClipperConfigScreenComponent extends React.Component {
webClipperStatusComps.push( webClipperStatusComps.push(
<p key="text_1" style={theme.textStyle}> <p key="text_1" style={theme.textStyle}>
<b>{_('The web clipper service is enabled and set to auto-start.')}</b> <b>{_('The web clipper service is enabled and set to auto-start.')}</b>
</p> </p>,
); );
if (this.props.clipperServer.startState === 'started') { if (this.props.clipperServer.startState === 'started') {
webClipperStatusComps.push( webClipperStatusComps.push(
<p key="text_2" style={theme.textStyle}> <p key="text_2" style={theme.textStyle}>
{_('Status: Started on port %d', this.props.clipperServer.port)} {_('Status: Started on port %d', this.props.clipperServer.port)}
</p> </p>,
); );
} else { } else {
webClipperStatusComps.push( webClipperStatusComps.push(
<p key="text_3" style={theme.textStyle}> <p key="text_3" style={theme.textStyle}>
{_('Status: %s', this.props.clipperServer.startState)} {_('Status: %s', this.props.clipperServer.startState)}
</p> </p>,
); );
} }
webClipperStatusComps.push( webClipperStatusComps.push(
<button key="disable_button" style={buttonStyle} onClick={this.disableClipperServer_click}> <button key="disable_button" style={buttonStyle} onClick={this.disableClipperServer_click}>
{_('Disable Web Clipper Service')} {_('Disable Web Clipper Service')}
</button> </button>,
); );
} else { } else {
webClipperStatusComps.push( webClipperStatusComps.push(
<p key="text_4" style={theme.textStyle}> <p key="text_4" style={theme.textStyle}>
{_('The web clipper service is not enabled.')} {_('The web clipper service is not enabled.')}
</p> </p>,
); );
webClipperStatusComps.push( webClipperStatusComps.push(
<button key="enable_button" style={buttonStyle} onClick={this.enableClipperServer_click}> <button key="enable_button" style={buttonStyle} onClick={this.enableClipperServer_click}>
{_('Enable Web Clipper Service')} {_('Enable Web Clipper Service')}
</button> </button>,
); );
} }

View File

@ -197,7 +197,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
theme={theme} theme={theme}
text={_('Help')} text={_('Help')}
/> />
</p> </p>,
); );
} }
@ -219,7 +219,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
onClick={this.checkSyncConfig_} onClick={this.checkSyncConfig_}
/> />
{statusComp} {statusComp}
</div> </div>,
); );
} }
} }
@ -381,7 +381,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
items.push( items.push(
<option value={e.key.toString()} key={e.key}> <option value={e.key.toString()} key={e.key}>
{settingOptions[e.key]} {settingOptions[e.key]}
</option> </option>,
); );
} }

View File

@ -29,7 +29,7 @@ const callHook = (isUpdate: boolean, pluginEnabled = true, pluginInstalledViaGUI
}, },
repoApi, repoApi,
onPluginSettingsChange, onPluginSettingsChange,
isUpdate isUpdate,
); );
describe('useOnInstallHandler', () => { describe('useOnInstallHandler', () => {
@ -37,7 +37,7 @@ describe('useOnInstallHandler', () => {
beforeAll(() => { beforeAll(() => {
(PluginService.instance as jest.Mock).mockReturnValue(pluginServiceInstance); (PluginService.instance as jest.Mock).mockReturnValue(pluginServiceInstance);
(defaultPluginSetting as jest.Mock).mockImplementation( (defaultPluginSetting as jest.Mock).mockImplementation(
jest.requireActual('@joplin/lib/services/plugins/PluginService').defaultPluginSetting jest.requireActual('@joplin/lib/services/plugins/PluginService').defaultPluginSetting,
); );
}); });

View File

@ -59,7 +59,7 @@ export default function DialogButtonRow(props: Props) {
buttonComps.push( buttonComps.push(
<button key={b.name} style={buttonStyle} onClick={() => onCustomButtonClick({ buttonName: b.name })} onKeyDown={onKeyDown}> <button key={b.name} style={buttonStyle} onClick={() => onCustomButtonClick({ buttonName: b.name })} onKeyDown={onKeyDown}>
{b.label} {b.label}
</button> </button>,
); );
} }
} }
@ -68,7 +68,7 @@ export default function DialogButtonRow(props: Props) {
buttonComps.push( buttonComps.push(
<button disabled={props.okButtonDisabled} key="ok" style={buttonStyle} onClick={onOkButtonClick} ref={props.okButtonRef} onKeyDown={onKeyDown}> <button disabled={props.okButtonDisabled} key="ok" style={buttonStyle} onClick={onOkButtonClick} ref={props.okButtonRef} onKeyDown={onKeyDown}>
{props.okButtonLabel ? props.okButtonLabel : _('OK')} {props.okButtonLabel ? props.okButtonLabel : _('OK')}
</button> </button>,
); );
} }
@ -76,7 +76,7 @@ export default function DialogButtonRow(props: Props) {
buttonComps.push( buttonComps.push(
<button disabled={props.cancelButtonDisabled} key="cancel" style={{ ...buttonStyle }} onClick={onCancelButtonClick}> <button disabled={props.cancelButtonDisabled} key="cancel" style={{ ...buttonStyle }} onClick={onCancelButtonClick}>
{props.cancelButtonLabel ? props.cancelButtonLabel : _('Cancel')} {props.cancelButtonLabel ? props.cancelButtonLabel : _('Cancel')}
</button> </button>,
); );
} }

View File

@ -64,7 +64,7 @@ const EncryptionConfigScreen = (props: Props) => {
<tr key={mk.id}> <tr key={mk.id}>
<td style={theme.textStyle}>{mk.id}</td> <td style={theme.textStyle}>{mk.id}</td>
<td><button onClick={() => onUpgradeMasterKey(mk)} style={theme.buttonStyle}>Upgrade</button></td> <td><button onClick={() => onUpgradeMasterKey(mk)} style={theme.buttonStyle}>Upgrade</button></td>
</tr> </tr>,
); );
} }
@ -309,7 +309,7 @@ const EncryptionConfigScreen = (props: Props) => {
rows.push( rows.push(
<tr key={id}> <tr key={id}>
<td style={theme.textStyle}>{id}</td> <td style={theme.textStyle}>{id}</td>
</tr> </tr>,
); );
} }

View File

@ -89,14 +89,14 @@ export default class ErrorBoundary extends React.Component<Props, State> {
<section key="message"> <section key="message">
<h2>Message</h2> <h2>Message</h2>
<p>{this.state.error.message}</p> <p>{this.state.error.message}</p>
</section> </section>,
); );
output.push( output.push(
<section key="versionInfo"> <section key="versionInfo">
<h2>Version info</h2> <h2>Version info</h2>
<pre>{versionInfo(packageInfo, this.state.plugins).message}</pre> <pre>{versionInfo(packageInfo, this.state.plugins).message}</pre>
</section> </section>,
); );
if (this.state.pluginInfos.length) { if (this.state.pluginInfos.length) {
@ -104,7 +104,7 @@ export default class ErrorBoundary extends React.Component<Props, State> {
<section key="pluginSettings"> <section key="pluginSettings">
<h2>Plugins</h2> <h2>Plugins</h2>
<pre>{JSON.stringify(this.state.pluginInfos, null, 4)}</pre> <pre>{JSON.stringify(this.state.pluginInfos, null, 4)}</pre>
</section> </section>,
); );
} }
@ -113,7 +113,7 @@ export default class ErrorBoundary extends React.Component<Props, State> {
<section key="stacktrace"> <section key="stacktrace">
<h2>Stack trace</h2> <h2>Stack trace</h2>
<pre>{this.state.error.stack}</pre> <pre>{this.state.error.stack}</pre>
</section> </section>,
); );
} }
@ -123,7 +123,7 @@ export default class ErrorBoundary extends React.Component<Props, State> {
<section key="componentStack"> <section key="componentStack">
<h2>Component stack</h2> <h2>Component stack</h2>
<pre>{this.state.errorInfo.componentStack}</pre> <pre>{this.state.errorInfo.componentStack}</pre>
</section> </section>,
); );
} }
} }

View File

@ -53,7 +53,7 @@ const styleSelector = createSelector(
}; };
return output; return output;
} },
); );
function platformAssets(type: string) { function platformAssets(type: string) {

View File

@ -42,7 +42,7 @@ class ImportScreenComponent extends React.Component<Props, State> {
}, },
() => { () => {
void this.doImport(); void this.doImport();
} },
); );
} }
} }

View File

@ -88,7 +88,7 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => {
<div> <div>
{accelerator.split('+').map(part => <kbd style={styles.kbd} key={part}>{part}</kbd>).reduce( {accelerator.split('+').map(part => <kbd style={styles.kbd} key={part}>{part}</kbd>).reduce(
(accumulator, part) => (accumulator.length ? [...accumulator, ' + ', part] : [part]), (accumulator, part) => (accumulator.length ? [...accumulator, ' + ', part] : [part]),
[] [],
)} )}
</div> </div>
); );

View File

@ -12,7 +12,7 @@ const useCommandStatus = (): [CommandStatus, (commandName: string)=> void, (comm
keymapService.getCommandNames().reduce((accumulator: CommandStatus, command: string) => { keymapService.getCommandNames().reduce((accumulator: CommandStatus, command: string) => {
accumulator[command] = false; accumulator[command] = false;
return accumulator; return accumulator;
}, {}) }, {}),
); );
const disableStatus = (commandName: string) => setStatus(prevStatus => ({ ...prevStatus, [commandName]: false })); const disableStatus = (commandName: string) => setStatus(prevStatus => ({ ...prevStatus, [commandName]: false }));

View File

@ -608,37 +608,37 @@ class MainScreenComponent extends React.Component<Props, State> {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('Safe mode is currently active. Note rendering and all plugins are temporarily disabled.'), _('Safe mode is currently active. Note rendering and all plugins are temporarily disabled.'),
_('Disable safe mode and restart'), _('Disable safe mode and restart'),
onDisableSafeModeAndRestart onDisableSafeModeAndRestart,
); );
} else if (this.props.hasMissingSyncCredentials) { } else if (this.props.hasMissingSyncCredentials) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('The synchronisation password is missing.'), _('The synchronisation password is missing.'),
_('Set the password'), _('Set the password'),
onViewSyncSettingsScreen onViewSyncSettingsScreen,
); );
} else if (this.props.shouldUpgradeSyncTarget) { } else if (this.props.shouldUpgradeSyncTarget) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('The sync target needs to be upgraded before Joplin can sync. The operation may take a few minutes to complete and the app needs to be restarted. To proceed please click on the link.'), _('The sync target needs to be upgraded before Joplin can sync. The operation may take a few minutes to complete and the app needs to be restarted. To proceed please click on the link.'),
_('Restart and upgrade'), _('Restart and upgrade'),
onRestartAndUpgrade onRestartAndUpgrade,
); );
} else if (this.props.hasDisabledEncryptionItems) { } else if (this.props.hasDisabledEncryptionItems) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('Some items cannot be decrypted.'), _('Some items cannot be decrypted.'),
_('View them now'), _('View them now'),
onViewStatusScreen onViewStatusScreen,
); );
} else if (this.props.showNeedUpgradingMasterKeyMessage) { } else if (this.props.showNeedUpgradingMasterKeyMessage) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('One of your master keys use an obsolete encryption method.'), _('One of your master keys use an obsolete encryption method.'),
_('View them now'), _('View them now'),
onViewEncryptionConfigScreen onViewEncryptionConfigScreen,
); );
} else if (this.props.showShouldReencryptMessage) { } else if (this.props.showShouldReencryptMessage) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('The default encryption method has been changed, you should re-encrypt your data.'), _('The default encryption method has been changed, you should re-encrypt your data.'),
_('More info'), _('More info'),
onViewEncryptionConfigScreen onViewEncryptionConfigScreen,
); );
} else if (this.showShareInvitationNotification(this.props)) { } else if (this.showShareInvitationNotification(this.props)) {
const invitation = this.props.shareInvitations.find(inv => inv.status === 0); const invitation = this.props.shareInvitations.find(inv => inv.status === 0);
@ -649,25 +649,25 @@ class MainScreenComponent extends React.Component<Props, State> {
_('Accept'), _('Accept'),
() => onInvitationRespond(invitation.id, invitation.share.folder_id, invitation.master_key, true), () => onInvitationRespond(invitation.id, invitation.share.folder_id, invitation.master_key, true),
_('Reject'), _('Reject'),
() => onInvitationRespond(invitation.id, invitation.share.folder_id, invitation.master_key, false) () => onInvitationRespond(invitation.id, invitation.share.folder_id, invitation.master_key, false),
); );
} else if (this.props.hasDisabledSyncItems) { } else if (this.props.hasDisabledSyncItems) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('Some items cannot be synchronised.'), _('Some items cannot be synchronised.'),
_('View them now'), _('View them now'),
onViewStatusScreen onViewStatusScreen,
); );
} else if (this.props.showMissingMasterKeyMessage) { } else if (this.props.showMissingMasterKeyMessage) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
_('One or more master keys need a password.'), _('One or more master keys need a password.'),
_('Set the password'), _('Set the password'),
onViewEncryptionConfigScreen onViewEncryptionConfigScreen,
); );
} else if (this.props.showInstallTemplatesPlugin) { } else if (this.props.showInstallTemplatesPlugin) {
msg = this.renderNotificationMessage( msg = this.renderNotificationMessage(
'The template feature has been moved to a plugin called "Templates".', 'The template feature has been moved to a plugin called "Templates".',
'Install plugin', 'Install plugin',
onViewPluginScreen onViewPluginScreen,
); );
} }

View File

@ -301,7 +301,7 @@ function useMenu(props: Props) {
return menuUtils.commandsToMenuItems( return menuUtils.commandsToMenuItems(
commandNames.concat(pluginCommandNames), commandNames.concat(pluginCommandNames),
(commandName: string) => onMenuItemClickRef.current(commandName), (commandName: string) => onMenuItemClickRef.current(commandName),
props.locale props.locale,
); );
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
}, [commandNames, pluginCommandNames, props.locale]); }, [commandNames, pluginCommandNames, props.locale]);
@ -347,7 +347,7 @@ function useMenu(props: Props) {
if (type === 'notes') { if (type === 'notes') {
sortItems.push( sortItems.push(
{ ...menuItemDic.toggleNotesSortOrderReverse, type: 'checkbox' }, { ...menuItemDic.toggleNotesSortOrderReverse, type: 'checkbox' },
{ ...menuItemDic.toggleNotesSortOrderField, visible: false } { ...menuItemDic.toggleNotesSortOrderField, visible: false },
); );
} else { } else {
sortItems.push({ sortItems.push({
@ -391,7 +391,7 @@ function useMenu(props: Props) {
{ {
plugins: pluginsRef.current, plugins: pluginsRef.current,
customCss: props.customCss, customCss: props.customCss,
} },
); );
}, },
}); });
@ -414,7 +414,7 @@ function useMenu(props: Props) {
}); });
exportItems.push( exportItems.push(
menuItemDic.exportPdf menuItemDic.exportPdf,
); );
// We need a dummy entry, otherwise the ternary operator to show a // We need a dummy entry, otherwise the ternary operator to show a

View File

@ -68,7 +68,7 @@ export default function MultiNoteActions(props: MultiNoteActionsProps) {
itemComps.push( itemComps.push(
<button key={item.label} style={styles.button} onClick={() => multiNotesButton_click(item)}> <button key={item.label} style={styles.button} onClick={() => multiNotesButton_click(item)}>
{item.label} {item.label}
</button> </button>,
); );
} }

View File

@ -838,7 +838,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
click: async () => { click: async () => {
editorCutText(); editorCutText();
}, },
}) }),
); );
menu.append( menu.append(
@ -848,7 +848,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
click: async () => { click: async () => {
editorCopyText(); editorCopyText();
}, },
}) }),
); );
menu.append( menu.append(
@ -858,7 +858,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
click: async () => { click: async () => {
editorPaste(); editorPaste();
}, },
}) }),
); );
const spellCheckerMenuItems = SpellCheckerService.instance().contextMenuItems(params.misspelledWord, params.dictionarySuggestions); const spellCheckerMenuItems = SpellCheckerService.instance().contextMenuItems(params.misspelledWord, params.dictionarySuggestions);

View File

@ -750,13 +750,13 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
].concat( ].concat(
pluginAssets pluginAssets
.filter((a: any) => a.mime === 'text/css') .filter((a: any) => a.mime === 'text/css')
.map((a: any) => a.path) .map((a: any) => a.path),
); );
const allJsFiles = [].concat( const allJsFiles = [].concat(
pluginAssets pluginAssets
.filter((a: any) => a.mime === 'application/javascript') .filter((a: any) => a.mime === 'application/javascript')
.map((a: any) => a.path) .map((a: any) => a.path),
); );

View File

@ -181,6 +181,6 @@ export async function processPastedHtml(html: string) {
return mappedResources[src]; return mappedResources[src];
}), { }), {
allowedFilePrefixes: [Setting.value('resourceDir')], allowedFilePrefixes: [Setting.value('resourceDir')],
} },
); );
} }

View File

@ -231,7 +231,7 @@ class NotePropertiesDialog extends React.Component<Props, State> {
}, },
() => { () => {
resolve(); resolve();
} },
); );
}); });
} }

View File

@ -88,7 +88,7 @@ class NoteRevisionViewerComponent extends React.PureComponent<Props, State> {
}, },
() => { () => {
void this.reloadNote(); void this.reloadNote();
} },
); );
} }
@ -116,7 +116,7 @@ class NoteRevisionViewerComponent extends React.PureComponent<Props, State> {
}, },
() => { () => {
void this.reloadNote(); void this.reloadNote();
} },
); );
} }
} }
@ -198,7 +198,7 @@ class NoteRevisionViewerComponent extends React.PureComponent<Props, State> {
revisionListItems.push( revisionListItems.push(
<option key={rev.id} value={rev.id}> <option key={rev.id} value={rev.id}>
{`${time.formatMsToLocal(rev.item_updated_time)} (${stats})`} {`${time.formatMsToLocal(rev.item_updated_time)} (${stats})`}
</option> </option>,
); );
} }

View File

@ -275,28 +275,28 @@ export default class PromptDialog extends React.Component<Props, any> {
buttonComps.push( buttonComps.push(
<button key="create" disabled={!this.state.answer} style={styles.button} onClick={() => onClose(true, 'create')}> <button key="create" disabled={!this.state.answer} style={styles.button} onClick={() => onClose(true, 'create')}>
{_('Create')} {_('Create')}
</button> </button>,
); );
} }
if (buttonTypes.indexOf('ok') >= 0) { if (buttonTypes.indexOf('ok') >= 0) {
buttonComps.push( buttonComps.push(
<button key="ok" disabled={!this.state.answer} style={styles.button} onClick={() => onClose(true, 'ok')}> <button key="ok" disabled={!this.state.answer} style={styles.button} onClick={() => onClose(true, 'ok')}>
{_('OK')} {_('OK')}
</button> </button>,
); );
} }
if (buttonTypes.indexOf('cancel') >= 0) { if (buttonTypes.indexOf('cancel') >= 0) {
buttonComps.push( buttonComps.push(
<button key="cancel" style={styles.button} onClick={() => onClose(false, 'cancel')}> <button key="cancel" style={styles.button} onClick={() => onClose(false, 'cancel')}>
{_('Cancel')} {_('Cancel')}
</button> </button>,
); );
} }
if (buttonTypes.indexOf('clear') >= 0) { if (buttonTypes.indexOf('clear') >= 0) {
buttonComps.push( buttonComps.push(
<button key="clear" style={styles.button} onClick={() => onClose(false, 'clear')}> <button key="clear" style={styles.button} onClick={() => onClose(false, 'clear')}>
{_('Clear')} {_('Clear')}
</button> </button>,
); );
} }

View File

@ -111,7 +111,7 @@ const ResourceTableComp = (props: ResourceTable) => {
<td style={cellStyle} className="dataCell"> <td style={cellStyle} className="dataCell">
<button style={theme.buttonStyle} onClick={() => props.onResourceDelete(resource)}>{_('Delete')}</button> <button style={theme.buttonStyle} onClick={() => props.onResourceDelete(resource)}>{_('Delete')}</button>
</td> </td>
</tr> </tr>,
)} )}
</tbody> </tbody>
</table> </table>

View File

@ -267,5 +267,5 @@ root.render(
<ErrorBoundary> <ErrorBoundary>
<Root /> <Root />
</ErrorBoundary> </ErrorBoundary>
</Provider> </Provider>,
); );

View File

@ -280,7 +280,7 @@ const SidebarComponent = (props: Props) => {
const menu = new Menu(); const menu = new Menu();
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem('newFolder')) new MenuItem(menuUtils.commandToStatefulMenuItem('newFolder')),
); );
menu.popup({ window: bridge().window() }); menu.popup({ window: bridge().window() });
@ -314,13 +314,13 @@ const SidebarComponent = (props: Props) => {
if (itemType === BaseModel.TYPE_FOLDER && !item.encryption_applied) { if (itemType === BaseModel.TYPE_FOLDER && !item.encryption_applied) {
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem('newFolder', itemId)) new MenuItem(menuUtils.commandToStatefulMenuItem('newFolder', itemId)),
); );
} }
if (itemType === BaseModel.TYPE_FOLDER) { if (itemType === BaseModel.TYPE_FOLDER) {
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem('deleteFolder', itemId)) new MenuItem(menuUtils.commandToStatefulMenuItem('deleteFolder', itemId)),
); );
} else { } else {
menu.append( menu.append(
@ -342,7 +342,7 @@ const SidebarComponent = (props: Props) => {
}); });
} }
}, },
}) }),
); );
} }
@ -364,7 +364,7 @@ const SidebarComponent = (props: Props) => {
click: async () => { click: async () => {
await InteropServiceHelper.export(props.dispatch, module, { sourceFolderIds: [itemId], plugins: pluginsRef.current }); await InteropServiceHelper.export(props.dispatch, module, { sourceFolderIds: [itemId], plugins: pluginsRef.current });
}, },
}) }),
); );
} }
@ -386,7 +386,7 @@ const SidebarComponent = (props: Props) => {
new MenuItem({ new MenuItem({
label: _('Export'), label: _('Export'),
submenu: exportMenu, submenu: exportMenu,
}) }),
); );
if (Setting.value('notes.perFolderSortOrderEnabled')) { if (Setting.value('notes.perFolderSortOrderEnabled')) {
menu.append(new MenuItem({ menu.append(new MenuItem({
@ -404,13 +404,13 @@ const SidebarComponent = (props: Props) => {
click: () => { click: () => {
clipboard.writeText(getFolderCallbackUrl(itemId)); clipboard.writeText(getFolderCallbackUrl(itemId));
}, },
}) }),
); );
} }
if (itemType === BaseModel.TYPE_TAG) { if (itemType === BaseModel.TYPE_TAG) {
menu.append(new MenuItem( menu.append(new MenuItem(
menuUtils.commandToStatefulMenuItem('renameTag', itemId) menuUtils.commandToStatefulMenuItem('renameTag', itemId),
)); ));
menu.append( menu.append(
new MenuItem({ new MenuItem({
@ -418,7 +418,7 @@ const SidebarComponent = (props: Props) => {
click: () => { click: () => {
clipboard.writeText(getTagCallbackUrl(itemId)); clipboard.writeText(getTagCallbackUrl(itemId));
}, },
}) }),
); );
} }
@ -431,7 +431,7 @@ const SidebarComponent = (props: Props) => {
itemType === ModelType.Folder && location === MenuItemLocation.FolderContextMenu itemType === ModelType.Folder && location === MenuItemLocation.FolderContextMenu
) { ) {
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem(view.commandName, itemId)) new MenuItem(menuUtils.commandToStatefulMenuItem(view.commandName, itemId)),
); );
} }
} }
@ -705,7 +705,7 @@ const SidebarComponent = (props: Props) => {
onDrop: onFolderDrop_, onDrop: onFolderDrop_,
['data-folder-id']: '', ['data-folder-id']: '',
toggleblock: 1, toggleblock: 1,
}) }),
); );
const foldersStyle = useMemo(() => { const foldersStyle = useMemo(() => {
@ -725,14 +725,14 @@ const SidebarComponent = (props: Props) => {
style={foldersStyle} style={foldersStyle}
> >
{folderItems} {folderItems}
</div> </div>,
); );
} }
items.push( items.push(
renderHeader('tagHeader', _('Tags'), 'icon-tags', null, null, { renderHeader('tagHeader', _('Tags'), 'icon-tags', null, null, {
toggleblock: 1, toggleblock: 1,
}) }),
); );
if (props.tags.length) { if (props.tags.length) {
@ -743,7 +743,7 @@ const SidebarComponent = (props: Props) => {
items.push( items.push(
<div className="tags" key="tag_items" style={{ display: props.tagHeaderIsExpanded ? 'block' : 'none' }}> <div className="tags" key="tag_items" style={{ display: props.tagHeaderIsExpanded ? 'block' : 'none' }}>
{tagItems} {tagItems}
</div> </div>,
); );
} }
@ -765,7 +765,7 @@ const SidebarComponent = (props: Props) => {
syncReportText.push( syncReportText.push(
<StyledSyncReportText key={i}> <StyledSyncReportText key={i}>
{lines[i]} {lines[i]}
</StyledSyncReportText> </StyledSyncReportText>,
); );
} }

View File

@ -133,14 +133,14 @@ function StatusScreen(props: Props) {
<li style={theme.textStyle} key={`item_${n}`}> <li style={theme.textStyle} key={`item_${n}`}>
<span>{text}</span> <span>{text}</span>
{retryLink} {retryLink}
</li> </li>,
); );
} else { } else {
itemsHtml.push( itemsHtml.push(
<div style={theme.textStyle} key={`item_${n}`}> <div style={theme.textStyle} key={`item_${n}`}>
<span>{text}</span> <span>{text}</span>
{retryLink} {retryLink}
</div> </div>,
); );
} }
} }

View File

@ -112,7 +112,7 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
return true; return true;
}, },
...extraOptions, ...extraOptions,
} },
); );
}; };

View File

@ -46,7 +46,7 @@ const style = createSelector(
output.buttonLabelSelected = { ...output.buttonLabel, color: theme.color }; output.buttonLabelSelected = { ...output.buttonLabel, color: theme.color };
return output; return output;
} },
); );
module.exports = style; module.exports = style;

View File

@ -45,15 +45,15 @@ export default class NoteListUtils {
if (!hasEncrypted) { if (!hasEncrypted) {
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem('setTags', noteIds)) new MenuItem(menuUtils.commandToStatefulMenuItem('setTags', noteIds)),
); );
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem('moveToFolder', noteIds)) new MenuItem(menuUtils.commandToStatefulMenuItem('moveToFolder', noteIds)),
); );
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem('duplicateNote', noteIds)) new MenuItem(menuUtils.commandToStatefulMenuItem('duplicateNote', noteIds)),
); );
if (singleNoteId) { if (singleNoteId) {
@ -64,8 +64,8 @@ export default class NoteListUtils {
if (noteIds.length <= 1) { if (noteIds.length <= 1) {
menu.append( menu.append(
new MenuItem( new MenuItem(
menuUtils.commandToStatefulMenuItem('toggleNoteType', noteIds) menuUtils.commandToStatefulMenuItem('toggleNoteType', noteIds),
) ),
); );
} else { } else {
const switchNoteType = async (noteIds: string[], type: string) => { const switchNoteType = async (noteIds: string[], type: string) => {
@ -84,7 +84,7 @@ export default class NoteListUtils {
click: async () => { click: async () => {
await switchNoteType(noteIds, 'note'); await switchNoteType(noteIds, 'note');
}, },
}) }),
); );
menu.append( menu.append(
@ -93,7 +93,7 @@ export default class NoteListUtils {
click: async () => { click: async () => {
await switchNoteType(noteIds, 'todo'); await switchNoteType(noteIds, 'todo');
}, },
}) }),
); );
} }
@ -108,7 +108,7 @@ export default class NoteListUtils {
} }
clipboard.writeText(links.join(' ')); clipboard.writeText(links.join(' '));
}, },
}) }),
); );
if (noteIds.length === 1) { if (noteIds.length === 1) {
@ -118,15 +118,15 @@ export default class NoteListUtils {
click: () => { click: () => {
clipboard.writeText(getNoteCallbackUrl(noteIds[0])); clipboard.writeText(getNoteCallbackUrl(noteIds[0]));
}, },
}) }),
); );
} }
if ([9, 10].includes(Setting.value('sync.target'))) { if ([9, 10].includes(Setting.value('sync.target'))) {
menu.append( menu.append(
new MenuItem( new MenuItem(
menuUtils.commandToStatefulMenuItem('showShareNoteDialog', noteIds.slice()) menuUtils.commandToStatefulMenuItem('showShareNoteDialog', noteIds.slice()),
) ),
); );
} }
@ -150,14 +150,14 @@ export default class NoteListUtils {
customCss: props.customCss, customCss: props.customCss,
}); });
}, },
}) }),
); );
} }
exportMenu.append( exportMenu.append(
new MenuItem( new MenuItem(
menuUtils.commandToStatefulMenuItem('exportPdf', noteIds) menuUtils.commandToStatefulMenuItem('exportPdf', noteIds),
) ),
); );
const exportMenuItem = new MenuItem({ label: _('Export'), submenu: exportMenu }); const exportMenuItem = new MenuItem({ label: _('Export'), submenu: exportMenu });
@ -167,8 +167,8 @@ export default class NoteListUtils {
menu.append( menu.append(
new MenuItem( new MenuItem(
menuUtils.commandToStatefulMenuItem('deleteNote', noteIds) menuUtils.commandToStatefulMenuItem('deleteNote', noteIds),
) ),
); );
const pluginViewInfos = pluginUtils.viewInfosByType(props.plugins, 'menuItem'); const pluginViewInfos = pluginUtils.viewInfosByType(props.plugins, 'menuItem');
@ -179,7 +179,7 @@ export default class NoteListUtils {
if (cmdService.isEnabled(info.view.commandName)) { if (cmdService.isEnabled(info.view.commandName)) {
menu.append( menu.append(
new MenuItem(menuUtils.commandToStatefulMenuItem(info.view.commandName, noteIds)) new MenuItem(menuUtils.commandToStatefulMenuItem(info.view.commandName, noteIds)),
); );
} }
} }

View File

@ -31,7 +31,7 @@ const tasks = {
fn: async () => { fn: async () => {
await compileSass( await compileSass(
`${__dirname}/style.scss`, `${__dirname}/style.scss`,
`${__dirname}/style.min.css` `${__dirname}/style.min.css`,
); );
}, },
}, },

View File

@ -108,7 +108,7 @@ function UserWebview(props: Props, ref: any) {
frameWindow(), frameWindow(),
isReady, isReady,
postMessage, postMessage,
props.html props.html,
); );
const contentSize = useContentSize( const contentSize = useContentSize(
@ -117,14 +117,14 @@ function UserWebview(props: Props, ref: any) {
minWidth, minWidth,
minHeight, minHeight,
props.fitToContent, props.fitToContent,
isReady isReady,
); );
useSubmitHandler( useSubmitHandler(
frameWindow(), frameWindow(),
props.onSubmit, props.onSubmit,
props.onDismiss, props.onDismiss,
htmlHash htmlHash,
); );
useWebviewToPluginMessages( useWebviewToPluginMessages(
@ -132,14 +132,14 @@ function UserWebview(props: Props, ref: any) {
isReady, isReady,
props.pluginId, props.pluginId,
props.viewId, props.viewId,
postMessage postMessage,
); );
useScriptLoader( useScriptLoader(
postMessage, postMessage,
isReady, isReady,
props.scripts, props.scripts,
cssFilePath cssFilePath,
); );
return <StyledFrame return <StyledFrame

View File

@ -32,7 +32,7 @@ const FolderPicker: FunctionComponent<FolderPickerProps> = ({
const theme = themeStyle(themeId); const theme = themeStyle(themeId);
const addFolderChildren = ( const addFolderChildren = (
folders: FolderEntityWithChildren[], pickerItems: DropdownListItem[], indent: number folders: FolderEntityWithChildren[], pickerItems: DropdownListItem[], indent: number,
) => { ) => {
folders.sort((a, b) => { folders.sort((a, b) => {
const aTitle = a && a.title ? a.title : ''; const aTitle = a && a.title ? a.title : '';

View File

@ -43,12 +43,12 @@ export default function NoteBodyViewer(props: Props) {
props.highlightedKeywords, props.highlightedKeywords,
props.noteResources, props.noteResources,
props.paddingBottom, props.paddingBottom,
props.noteHash props.noteHash,
); );
const onResourceLongPress = useOnResourceLongPress( const onResourceLongPress = useOnResourceLongPress(
props.onJoplinLinkClick, props.onJoplinLinkClick,
dialogBoxRef dialogBoxRef,
); );
const onMessage = useOnMessage( const onMessage = useOnMessage(
@ -56,7 +56,7 @@ export default function NoteBodyViewer(props: Props) {
props.noteBody, props.noteBody,
props.onMarkForDownload, props.onMarkForDownload,
props.onJoplinLinkClick, props.onJoplinLinkClick,
onResourceLongPress onResourceLongPress,
); );
const onLoadEnd = useCallback(() => { const onLoadEnd = useCallback(() => {

View File

@ -125,7 +125,7 @@ export default function useSource(noteBody: string, noteMarkupLanguage: number,
noteMarkupLanguage, noteMarkupLanguage,
bodyToRender, bodyToRender,
rendererTheme, rendererTheme,
mdOptions mdOptions,
); );
if (cancelled) return; if (cancelled) return;

View File

@ -51,7 +51,7 @@ interface CodeMirrorResult extends CodeMirrorControl {
} }
export function initCodeMirror( export function initCodeMirror(
parentElement: any, initialText: string, settings: EditorSettings parentElement: any, initialText: string, settings: EditorSettings,
): CodeMirrorResult { ): CodeMirrorResult {
logMessage('Initializing CodeMirror...'); logMessage('Initializing CodeMirror...');
const theme = settings.themeData; const theme = settings.themeData;

View File

@ -82,7 +82,7 @@ const computeDecorations = (view: EditorView) => {
for (const { from, to } of view.visibleRanges) { for (const { from, to } of view.visibleRanges) {
ensureSyntaxTree( ensureSyntaxTree(
view.state, view.state,
to to,
)?.iterate({ )?.iterate({
from, to, from, to,
enter: node => { enter: node => {

View File

@ -11,35 +11,35 @@ describe('markdownCommands.bulletedVsChecklist', () => {
it('should remove a checklist following a bulleted list without modifying the bulleted list', async () => { it('should remove a checklist following a bulleted list without modifying the bulleted list', async () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, EditorSelection.cursor(bulletedListPart.length + 5), expectedTags initialDocText, EditorSelection.cursor(bulletedListPart.length + 5), expectedTags,
); );
toggleList(ListType.CheckList)(editor); toggleList(ListType.CheckList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
`${bulletedListPart}\n\nThis is a checklist\nwith multiple items.\n☑` `${bulletedListPart}\n\nThis is a checklist\nwith multiple items.\n☑`,
); );
}); });
it('should remove an unordered list following a checklist without modifying the checklist', async () => { it('should remove an unordered list following a checklist without modifying the checklist', async () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, EditorSelection.cursor(bulletedListPart.length - 5), expectedTags initialDocText, EditorSelection.cursor(bulletedListPart.length - 5), expectedTags,
); );
toggleList(ListType.UnorderedList)(editor); toggleList(ListType.UnorderedList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
`Test\nThis is a test.\n3\n4\n5\n\n${checklistPart}` `Test\nThis is a test.\n3\n4\n5\n\n${checklistPart}`,
); );
}); });
it('should replace a selection of unordered and task lists with a correctly-numbered list', async () => { it('should replace a selection of unordered and task lists with a correctly-numbered list', async () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, EditorSelection.range(0, initialDocText.length), expectedTags initialDocText, EditorSelection.range(0, initialDocText.length), expectedTags,
); );
toggleList(ListType.OrderedList)(editor); toggleList(ListType.OrderedList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'1. Test\n2. This is a test.\n3. 3\n4. 4\n5. 5' '1. Test\n2. This is a test.\n3. 3\n4. 4\n5. 5'
+ '\n\n6. This is a checklist\n7. with multiple items.\n8. ☑' + '\n\n6. This is a checklist\n7. with multiple items.\n8. ☑',
); );
}); });
}); });

View File

@ -9,7 +9,7 @@ describe('markdownCommands', () => {
it('should bold/italicize everything selected', async () => { it('should bold/italicize everything selected', async () => {
const initialDocText = 'Testing...'; const initialDocText = 'Testing...';
const editor = await createEditor( const editor = await createEditor(
initialDocText, EditorSelection.range(0, initialDocText.length), [] initialDocText, EditorSelection.range(0, initialDocText.length), [],
); );
toggleBolded(editor); toggleBolded(editor);
@ -36,7 +36,7 @@ describe('markdownCommands', () => {
it('for a cursor, bolding, then italicizing, should produce a bold-italic region', async () => { it('for a cursor, bolding, then italicizing, should produce a bold-italic region', async () => {
const initialDocText = ''; const initialDocText = '';
const editor = await createEditor( const editor = await createEditor(
initialDocText, EditorSelection.cursor(0), [] initialDocText, EditorSelection.cursor(0), [],
); );
toggleBolded(editor); toggleBolded(editor);
@ -110,14 +110,14 @@ describe('markdownCommands', () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, initialDocText,
EditorSelection.cursor('Testing...\n\n> This'.length), EditorSelection.cursor('Testing...\n\n> This'.length),
['Blockquote'] ['Blockquote'],
); );
toggleHeaderLevel(1)(editor); toggleHeaderLevel(1)(editor);
const mainSel = editor.state.selection.main; const mainSel = editor.state.selection.main;
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'Testing...\n\n> # This is a test.\n> ...a test' 'Testing...\n\n> # This is a test.\n> ...a test',
); );
expect(mainSel.empty).toBe(true); expect(mainSel.empty).toBe(true);
expect(mainSel.from).toBe('Testing...\n\n> # This is a test.'.length); expect(mainSel.from).toBe('Testing...\n\n> # This is a test.'.length);
@ -125,7 +125,7 @@ describe('markdownCommands', () => {
toggleHeaderLevel(3)(editor); toggleHeaderLevel(3)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'Testing...\n\n> ### This is a test.\n> ...a test' 'Testing...\n\n> ### This is a test.\n> ...a test',
); );
}); });
@ -135,9 +135,9 @@ describe('markdownCommands', () => {
initialDocText, initialDocText,
EditorSelection.range( EditorSelection.range(
'Testing...\n\n> This'.length, 'Testing...\n\n> This'.length,
'Testing...\n\n> This is a test.\n> y = mx + b'.length 'Testing...\n\n> This is a test.\n> y = mx + b'.length,
), ),
['Blockquote'] ['Blockquote'],
); );
toggleMath(editor); toggleMath(editor);
@ -145,7 +145,7 @@ describe('markdownCommands', () => {
// Toggling math should surround the content in '$$'s // Toggling math should surround the content in '$$'s
const mainSel = editor.state.selection.main; const mainSel = editor.state.selection.main;
expect(editor.state.doc.toString()).toEqual( expect(editor.state.doc.toString()).toEqual(
'Testing...\n\n> $$\n> This is a test.\n> y = mx + b\n> $$\n> ...a test' 'Testing...\n\n> $$\n> This is a test.\n> y = mx + b\n> $$\n> ...a test',
); );
expect(mainSel.from).toBe('Testing...\n\n'.length); expect(mainSel.from).toBe('Testing...\n\n'.length);
expect(mainSel.to).toBe('Testing...\n\n> $$\n> This is a test.\n> y = mx + b\n> $$'.length); expect(mainSel.to).toBe('Testing...\n\n> $$\n> This is a test.\n> y = mx + b\n> $$'.length);
@ -157,7 +157,7 @@ describe('markdownCommands', () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, initialDocText,
EditorSelection.cursor('Testing...\n\n> $$\n> This is'.length), EditorSelection.cursor('Testing...\n\n> $$\n> This is'.length),
['Blockquote', blockMathTagName] ['Blockquote', blockMathTagName],
); );
// Toggling math should remove the '$$'s // Toggling math should remove the '$$'s
@ -174,12 +174,12 @@ describe('markdownCommands', () => {
updateLink('bar', 'https://example.com/')(editor); updateLink('bar', 'https://example.com/')(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'[bar](https://example.com/)' '[bar](https://example.com/)',
); );
updateLink('', 'https://example.com/')(editor); updateLink('', 'https://example.com/')(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'https://example.com/' 'https://example.com/',
); );
}); });
@ -225,7 +225,7 @@ describe('markdownCommands', () => {
toggleMath(editor); toggleMath(editor);
editor.dispatch(editor.state.replaceSelection('f(x) = ...')); editor.dispatch(editor.state.replaceSelection('f(x) = ...'));
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'> Testing...> \n> \n> $$\n> f(x) = ...\n> $$' '> Testing...> \n> \n> $$\n> f(x) = ...\n> $$',
); );
// If we toggle math again, everything from the start of the line with the first // If we toggle math again, everything from the start of the line with the first

View File

@ -12,12 +12,12 @@ describe('markdownCommands.toggleList', () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, initialDocText,
EditorSelection.cursor(5), EditorSelection.cursor(5),
['BulletList', 'InlineCode'] ['BulletList', 'InlineCode'],
); );
toggleList(ListType.UnorderedList)(editor); toggleList(ListType.UnorderedList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'testing\nthis is a `test`\n' 'testing\nthis is a `test`\n',
); );
}); });
@ -26,12 +26,12 @@ describe('markdownCommands.toggleList', () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, initialDocText,
EditorSelection.cursor('Testing...\nThis is a'.length), EditorSelection.cursor('Testing...\nThis is a'.length),
[] [],
); );
toggleList(ListType.OrderedList)(editor); toggleList(ListType.OrderedList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'Testing...\n1. This is a test\nof list toggling...' 'Testing...\n1. This is a test\nof list toggling...',
); );
editor.setState(EditorState.create({ editor.setState(EditorState.create({
@ -41,7 +41,7 @@ describe('markdownCommands.toggleList', () => {
toggleList(ListType.OrderedList)(editor); toggleList(ListType.OrderedList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'1. Testing...\n2. This is a test\n3. of list toggling...' '1. Testing...\n2. This is a test\n3. of list toggling...',
); );
}); });
@ -51,12 +51,12 @@ describe('markdownCommands.toggleList', () => {
const editor = await createEditor( const editor = await createEditor(
unorderedListText, unorderedListText,
EditorSelection.cursor(unorderedListText.length), EditorSelection.cursor(unorderedListText.length),
['BulletList'] ['BulletList'],
); );
toggleList(ListType.OrderedList)(editor); toggleList(ListType.OrderedList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'1. 1\n2. 2\n3. 3\n4. 4\n5. 5\n6. 6\n7. 7' '1. 1\n2. 2\n3. 3\n4. 4\n5. 5\n6. 6\n7. 7',
); );
}); });
@ -154,12 +154,12 @@ describe('markdownCommands.toggleList', () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, initialDocText,
EditorSelection.cursor(0), EditorSelection.cursor(0),
['OrderedList', 'BulletList'] ['OrderedList', 'BulletList'],
); );
toggleList(ListType.CheckList)(editor); toggleList(ListType.CheckList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'- [ ] Foo\n- [ ] Bar\n- [ ] Baz\n\t- Test\n\t- of\n\t- sublists\n- [ ] Foo' '- [ ] Foo\n- [ ] Bar\n- [ ] Baz\n\t- Test\n\t- of\n\t- sublists\n- [ ] Foo',
); );
}); });
@ -169,7 +169,7 @@ describe('markdownCommands.toggleList', () => {
const editor = await createEditor( const editor = await createEditor(
initialDocText, initialDocText,
EditorSelection.cursor(initialDocText.length), EditorSelection.cursor(initialDocText.length),
['OrderedList'] ['OrderedList'],
); );
increaseIndent(editor); increaseIndent(editor);
@ -177,12 +177,12 @@ describe('markdownCommands.toggleList', () => {
toggleList(ListType.CheckList)(editor); toggleList(ListType.CheckList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'1. This\n2. is\n\t- [ ] ' '1. This\n2. is\n\t- [ ] ',
); );
editor.dispatch(editor.state.replaceSelection('a test.')); editor.dispatch(editor.state.replaceSelection('a test.'));
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'1. This\n2. is\n\t- [ ] a test.' '1. This\n2. is\n\t- [ ] a test.',
); );
}); });
@ -191,12 +191,12 @@ describe('markdownCommands.toggleList', () => {
const initialDocText = `${preSubListText}> \t* a\n> \t* test\n> * of list toggling`; const initialDocText = `${preSubListText}> \t* a\n> \t* test\n> * of list toggling`;
const editor = await createEditor( const editor = await createEditor(
initialDocText, EditorSelection.cursor(preSubListText.length + 3), initialDocText, EditorSelection.cursor(preSubListText.length + 3),
['BlockQuote', 'BulletList'] ['BlockQuote', 'BulletList'],
); );
toggleList(ListType.OrderedList)(editor); toggleList(ListType.OrderedList)(editor);
expect(editor.state.doc.toString()).toBe( expect(editor.state.doc.toString()).toBe(
'> # List test\n> * This\n> * is\n> \t1. a\n> \t2. test\n> * of list toggling' '> # List test\n> * This\n> * is\n> \t1. a\n> \t2. test\n> * of list toggling',
); );
expect(editor.state.selection.main.from).toBe(preSubListText.length); expect(editor.state.selection.main.from).toBe(preSubListText.length);
}); });

View File

@ -250,7 +250,7 @@ export const toggleList = (listType: ListType): Command => {
sel = EditorSelection.range( sel = EditorSelection.range(
doc.line(newFromLineNo).from, doc.line(newFromLineNo).from,
doc.line(newToLineNo).to doc.line(newToLineNo).to,
); );
computeSelectionProps(); computeSelectionProps();
} }
@ -299,7 +299,7 @@ export const toggleList = (listType: ListType): Command => {
const containerMatch = lineContent.match(containerRegex); const containerMatch = lineContent.match(containerRegex);
if (!containerMatch) { if (!containerMatch) {
throw new Error( throw new Error(
'Assertion failed: container regex does not match line content.' 'Assertion failed: container regex does not match line content.',
); );
} }
@ -336,7 +336,7 @@ export const toggleList = (listType: ListType): Command => {
} else { } else {
sel = EditorSelection.range( sel = EditorSelection.range(
sel.from, sel.from,
sel.to + charsAdded sel.to + charsAdded,
); );
} }
@ -374,10 +374,10 @@ export const toggleHeaderLevel = (level: number): Command => {
`${level - 1 >= 1 ? `(?:^[#]{1,${level - 1}}\\s)|` : '' `${level - 1 >= 1 ? `(?:^[#]{1,${level - 1}}\\s)|` : ''
// Check all number of #s higher than [level] // Check all number of #s higher than [level]
}(?:^[#]{${level + 1},}\\s)` }(?:^[#]{${level + 1},}\\s)`,
), ),
'', '',
matchEmpty matchEmpty,
); );
view.dispatch(changes); view.dispatch(changes);
@ -387,7 +387,7 @@ export const toggleHeaderLevel = (level: number): Command => {
// We want exactly [level] '#' characters. // We want exactly [level] '#' characters.
new RegExp(`^[#]{${level}} `), new RegExp(`^[#]{${level}} `),
`${headerStr} `, `${headerStr} `,
matchEmpty matchEmpty,
); );
view.dispatch(changes); view.dispatch(changes);
@ -408,7 +408,7 @@ export const increaseIndent: Command = (view: EditorView): boolean => {
matchNothing, matchNothing,
// ...and thus always add indentUnit. // ...and thus always add indentUnit.
indentUnit, indentUnit,
matchEmpty matchEmpty,
); );
view.dispatch(changes); view.dispatch(changes);
@ -429,7 +429,7 @@ export const decreaseIndent: Command = (view: EditorView): boolean => {
new RegExp(`^(?:[\\t]|[ ]{1,${getIndentUnit(view.state)}})`), new RegExp(`^(?:[\\t]|[ ]{1,${getIndentUnit(view.state)}})`),
// Don't add new text // Don't add new text
'', '',
matchEmpty matchEmpty,
); );
view.dispatch(changes); view.dispatch(changes);

View File

@ -143,7 +143,7 @@ const BlockMathConfig: MarkdownConfig = {
let stop; let stop;
let endMatch = mathBlockEndRegex.exec( let endMatch = mathBlockEndRegex.exec(
line.text.substring(mathStartMatch[0].length) line.text.substring(mathStartMatch[0].length),
); );
// If the math region ends immediately (on the same line), // If the math region ends immediately (on the same line),
@ -183,7 +183,7 @@ const BlockMathConfig: MarkdownConfig = {
Math.min(lineEnd, stop + delimLen), Math.min(lineEnd, stop + delimLen),
// The child of the container element should be the content element // The child of the container element should be the content element
[contentElem] [contentElem],
); );
cx.addElement(containerElement); cx.addElement(containerElement);

View File

@ -103,7 +103,7 @@ describe('markdownReformatter', () => {
}); });
const changes = toggleRegionFormatGlobally( const changes = toggleRegionFormatGlobally(
initialState, inlineCodeRegionSpec, blockCodeRegionSpec initialState, inlineCodeRegionSpec, blockCodeRegionSpec,
); );
const newState = initialState.update(changes).state; const newState = initialState.update(changes).state;
@ -117,7 +117,7 @@ describe('markdownReformatter', () => {
}); });
const changes = toggleRegionFormatGlobally( const changes = toggleRegionFormatGlobally(
initialState, inlineCodeRegionSpec, blockCodeRegionSpec initialState, inlineCodeRegionSpec, blockCodeRegionSpec,
); );
const newState = initialState.update(changes).state; const newState = initialState.update(changes).state;

View File

@ -84,7 +84,7 @@ export enum MatchSide {
// Returns the length of a match for this in the given selection, // Returns the length of a match for this in the given selection,
// -1 if no match is found. // -1 if no match is found.
export const findInlineMatch = ( export const findInlineMatch = (
doc: DocumentText, spec: RegionSpec, sel: SelectionRange, side: MatchSide doc: DocumentText, spec: RegionSpec, sel: SelectionRange, side: MatchSide,
): number => { ): number => {
const [regex, template] = (() => { const [regex, template] = (() => {
if (side === MatchSide.Start) { if (side === MatchSide.Start) {
@ -182,7 +182,7 @@ export const isIndentationEquivalent = (state: EditorState, a: string, b: string
// Expands and returns a copy of [sel] to the smallest container node with name in [nodeNames]. // Expands and returns a copy of [sel] to the smallest container node with name in [nodeNames].
export const growSelectionToNode = ( export const growSelectionToNode = (
state: EditorState, sel: SelectionRange, nodeNames: string|string[]|null state: EditorState, sel: SelectionRange, nodeNames: string|string[]|null,
): SelectionRange => { ): SelectionRange => {
if (!nodeNames) { if (!nodeNames) {
return sel; return sel;
@ -235,7 +235,7 @@ export const growSelectionToNode = (
// If the selection is already surrounded by these characters, they are // If the selection is already surrounded by these characters, they are
// removed. // removed.
const toggleInlineRegionSurrounded = ( const toggleInlineRegionSurrounded = (
doc: DocumentText, sel: SelectionRange, spec: RegionSpec doc: DocumentText, sel: SelectionRange, spec: RegionSpec,
): SelectionUpdate => { ): SelectionUpdate => {
let content = doc.sliceString(sel.from, sel.to); let content = doc.sliceString(sel.from, sel.to);
const startMatchLen = findInlineMatch(doc, spec, sel, MatchSide.Start); const startMatchLen = findInlineMatch(doc, spec, sel, MatchSide.Start);
@ -291,7 +291,7 @@ const toggleInlineRegionSurrounded = (
// Returns updated selections: For all selections in the given `EditorState`, toggles // Returns updated selections: For all selections in the given `EditorState`, toggles
// whether each is contained in an inline region of type [spec]. // whether each is contained in an inline region of type [spec].
export const toggleInlineSelectionFormat = ( export const toggleInlineSelectionFormat = (
state: EditorState, spec: RegionSpec, sel: SelectionRange state: EditorState, spec: RegionSpec, sel: SelectionRange,
): SelectionUpdate => { ): SelectionUpdate => {
const endMatchLen = findInlineMatch(state.doc, spec, sel, MatchSide.End); const endMatchLen = findInlineMatch(state.doc, spec, sel, MatchSide.End);
@ -315,7 +315,7 @@ export const toggleInlineSelectionFormat = (
// Like toggleInlineSelectionFormat, but for all selections in [state]. // Like toggleInlineSelectionFormat, but for all selections in [state].
export const toggleInlineFormatGlobally = ( export const toggleInlineFormatGlobally = (
state: EditorState, spec: RegionSpec state: EditorState, spec: RegionSpec,
): TransactionSpec => { ): TransactionSpec => {
const changes = state.changeByRange((sel: SelectionRange) => { const changes = state.changeByRange((sel: SelectionRange) => {
return toggleInlineSelectionFormat(state, spec, sel); return toggleInlineSelectionFormat(state, spec, sel);
@ -328,13 +328,13 @@ export const toggleRegionFormatGlobally = (
state: EditorState, state: EditorState,
inlineSpec: RegionSpec, inlineSpec: RegionSpec,
blockSpec: RegionSpec blockSpec: RegionSpec,
): TransactionSpec => { ): TransactionSpec => {
const doc = state.doc; const doc = state.doc;
const preserveBlockQuotes = true; const preserveBlockQuotes = true;
const getMatchEndPoints = ( const getMatchEndPoints = (
match: RegExpMatchArray, line: Line, inBlockQuote: boolean match: RegExpMatchArray, line: Line, inBlockQuote: boolean,
): [startIdx: number, stopIdx: number] => { ): [startIdx: number, stopIdx: number] => {
const startIdx = line.from + match.index; const startIdx = line.from + match.index;
let stopIdx; let stopIdx;
@ -499,7 +499,7 @@ export const toggleRegionFormatGlobally = (
// Selection should now encompass all lines that were changed. // Selection should now encompass all lines that were changed.
range: EditorSelection.range( range: EditorSelection.range(
fromLine.from, toLine.to + charsAdded fromLine.from, toLine.to + charsAdded,
), ),
}; };
}); });
@ -515,7 +515,7 @@ export const toggleSelectedLinesStartWith = (
matchEmpty: boolean, matchEmpty: boolean,
// Name associated with what [regex] matches (e.g. FencedCode) // Name associated with what [regex] matches (e.g. FencedCode)
nodeName?: string nodeName?: string,
): TransactionSpec => { ): TransactionSpec => {
const ignoreBlockQuotes = true; const ignoreBlockQuotes = true;
const getLineContentStart = (line: Line): number => { const getLineContentStart = (line: Line): number => {
@ -701,7 +701,7 @@ export const renumberList = (state: EditorState, sel: SelectionRange): Selection
} else { } else {
sel = EditorSelection.range( sel = EditorSelection.range(
fromLine.from, fromLine.from,
toLine.to + charsAdded toLine.to + charsAdded,
); );
} }

View File

@ -229,7 +229,7 @@ for (const language of supportedLanguages) {
name: language.name, name: language.name,
alias: language.aliases, alias: language.aliases,
support, support,
}) }),
); );
} }

View File

@ -10,7 +10,7 @@ import loadLangauges from './loadLanguages';
// Creates and returns a minimal editor with markdown extensions. Waits to return the editor // Creates and returns a minimal editor with markdown extensions. Waits to return the editor
// until all syntax tree tags in `expectedSyntaxTreeTags` exist. // until all syntax tree tags in `expectedSyntaxTreeTags` exist.
const createEditor = async ( const createEditor = async (
initialText: string, initialSelection: SelectionRange, expectedSyntaxTreeTags: string[] initialText: string, initialSelection: SelectionRange, expectedSyntaxTreeTags: string[],
): Promise<EditorView> => { ): Promise<EditorView> => {
await loadLangauges(); await loadLangauges();

View File

@ -10,7 +10,7 @@ const forceFullParse = (editorState: EditorState) => {
if (!syntaxTreeAvailable(editorState)) { if (!syntaxTreeAvailable(editorState)) {
throw new Error( throw new Error(
`Unable to generate a syntax tree in ${timeout}. Is the editor configured to parse a language?` `Unable to generate a syntax tree in ${timeout}. Is the editor configured to parse a language?`,
); );
} }
}; };

View File

@ -41,7 +41,7 @@ const Toolbar = (props: ToolbarProps) => {
key={key.toString()} key={key.toString()}
styleSheet={props.styleSheet} styleSheet={props.styleSheet}
spec={spec} spec={spec}
/> />,
); );
} }
@ -49,7 +49,7 @@ const Toolbar = (props: ToolbarProps) => {
const containerWidth = event.nativeEvent.layout.width; const containerWidth = event.nativeEvent.layout.width;
const maxButtonsTotal = Math.floor(containerWidth / buttonSize); const maxButtonsTotal = Math.floor(containerWidth / buttonSize);
setMaxButtonsEachSide(Math.floor( setMaxButtonsEachSide(Math.floor(
Math.min((maxButtonsTotal - 1) / 2, allButtonSpecs.length / 2) Math.min((maxButtonsTotal - 1) / 2, allButtonSpecs.length / 2),
)); ));
}, [allButtonSpecs.length]); }, [allButtonSpecs.length]);

View File

@ -41,7 +41,7 @@ const ToolbarOverflowRows = (props: OverflowPopupProps) => {
// After invoking this button's action, hide the overflow menu // After invoking this button's action, hide the overflow menu
onActionComplete={props.onToggleOverflow} onActionComplete={props.onToggleOverflow}
/> />,
); );
// Show the "hide overflow" button if in the center of the last row // Show the "hide overflow" button if in the center of the last row
@ -54,7 +54,7 @@ const ToolbarOverflowRows = (props: OverflowPopupProps) => {
styleSheet={props.styleSheet} styleSheet={props.styleSheet}
overflowVisible={true} overflowVisible={true}
onToggleOverflowVisible={props.onToggleOverflow} onToggleOverflowVisible={props.onToggleOverflow}
/> />,
); );
} }
} }
@ -69,7 +69,7 @@ const ToolbarOverflowRows = (props: OverflowPopupProps) => {
> >
{row} {row}
</ScrollView> </ScrollView>
</View> </View>,
); );
} }

View File

@ -120,7 +120,7 @@ type OnSetVisibleCallback = (visible: boolean)=> void;
type OnSearchStateChangeCallback = (state: SearchState)=> void; type OnSearchStateChangeCallback = (state: SearchState)=> void;
const useEditorControl = ( const useEditorControl = (
injectJS: OnInjectJSCallback, setLinkDialogVisible: OnSetVisibleCallback, injectJS: OnInjectJSCallback, setLinkDialogVisible: OnSetVisibleCallback,
setSearchState: OnSearchStateChangeCallback, searchStateRef: RefObject<SearchState> setSearchState: OnSearchStateChangeCallback, searchStateRef: RefObject<SearchState>,
): EditorControl => { ): EditorControl => {
return useMemo(() => { return useMemo(() => {
return { return {
@ -132,7 +132,7 @@ const useEditorControl = (
}, },
select(anchor: number, head: number) { select(anchor: number, head: number) {
injectJS( injectJS(
`cm.select(${JSON.stringify(anchor)}, ${JSON.stringify(head)});` `cm.select(${JSON.stringify(anchor)}, ${JSON.stringify(head)});`,
); );
}, },
insertText(text: string) { insertText(text: string) {
@ -299,7 +299,7 @@ function NoteEditor(props: Props, ref: any) {
}; };
const editorControl = useEditorControl( const editorControl = useEditorControl(
injectJS, setLinkDialogVisible, setSearchState, searchStateRef injectJS, setLinkDialogVisible, setSearchState, searchStateRef,
); );
useImperativeHandle(ref, () => { useImperativeHandle(ref, () => {

View File

@ -39,7 +39,7 @@ interface ActionButtonProps {
} }
const ActionButton = ( const ActionButton = (
props: ActionButtonProps props: ActionButtonProps,
) => { ) => {
return ( return (
<CustomButton <CustomButton
@ -154,7 +154,7 @@ export const SearchPanel = (props: SearchPanelProps) => {
// Creates a TextInut with the given parameters // Creates a TextInut with the given parameters
const createInput = ( const createInput = (
placeholder: string, value: string, onChange: OnChangeCallback, autoFocus: boolean placeholder: string, value: string, onChange: OnChangeCallback, autoFocus: boolean,
) => { ) => {
return ( return (
<TextInput <TextInput
@ -229,7 +229,7 @@ export const SearchPanel = (props: SearchPanelProps) => {
}, },
// Autofocus // Autofocus
true true,
); );
const replaceTextInput = createInput( const replaceTextInput = createInput(
@ -242,7 +242,7 @@ export const SearchPanel = (props: SearchPanelProps) => {
}, },
// Don't autofocus // Don't autofocus
false false,
); );
const labeledSearchInput = ( const labeledSearchInput = (

View File

@ -71,7 +71,7 @@ export default (props: Props) => {
onPress: () => {}, onPress: () => {},
style: 'cancel', style: 'cancel',
}, },
] ],
); );
}, []); }, []);
@ -108,7 +108,7 @@ export default (props: Props) => {
onPress: () => {}, onPress: () => {},
style: 'cancel', style: 'cancel',
}, },
] ],
); );
}, [profileConfig]); }, [profileConfig]);
@ -144,7 +144,7 @@ export default (props: Props) => {
onPress: () => {}, onPress: () => {},
style: 'cancel', style: 'cancel',
}, },
] ],
); );
}} }}
/> />

View File

@ -333,7 +333,7 @@ class ScreenHeaderComponent extends PureComponent<ScreenHeaderProps, ScreenHeade
} }
function saveButton( function saveButton(
styles: any, onPress: OnPressCallback, disabled: boolean, show: boolean styles: any, onPress: OnPressCallback, disabled: boolean, show: boolean,
) { ) {
if (!show) return null; if (!show) return null;
@ -489,7 +489,7 @@ class ScreenHeaderComponent extends PureComponent<ScreenHeaderProps, ScreenHeade
menuOptionComponents.push( menuOptionComponents.push(
<MenuOption value={o.onPress} key={`menuOption_${key++}`} style={this.styles().contextMenuItem} disabled={!!o.disabled}> <MenuOption value={o.onPress} key={`menuOption_${key++}`} style={this.styles().contextMenuItem} disabled={!!o.disabled}>
<Text style={o.disabled ? this.styles().contextMenuItemTextDisabled : this.styles().contextMenuItemText}>{o.title}</Text> <Text style={o.disabled ? this.styles().contextMenuItemTextDisabled : this.styles().contextMenuItemText}>{o.title}</Text>
</MenuOption> </MenuOption>,
); );
} }
} }
@ -501,13 +501,13 @@ class ScreenHeaderComponent extends PureComponent<ScreenHeaderProps, ScreenHeade
menuOptionComponents.push( menuOptionComponents.push(
<MenuOption value={() => this.deleteButton_press()} key={'menuOption_delete'} style={this.styles().contextMenuItem}> <MenuOption value={() => this.deleteButton_press()} key={'menuOption_delete'} style={this.styles().contextMenuItem}>
<Text style={this.styles().contextMenuItemText}>{_('Delete')}</Text> <Text style={this.styles().contextMenuItemText}>{_('Delete')}</Text>
</MenuOption> </MenuOption>,
); );
menuOptionComponents.push( menuOptionComponents.push(
<MenuOption value={() => this.duplicateButton_press()} key={'menuOption_duplicate'} style={this.styles().contextMenuItem}> <MenuOption value={() => this.duplicateButton_press()} key={'menuOption_duplicate'} style={this.styles().contextMenuItem}>
<Text style={this.styles().contextMenuItemText}>{_('Duplicate')}</Text> <Text style={this.styles().contextMenuItemText}>{_('Duplicate')}</Text>
</MenuOption> </MenuOption>,
); );
} }
@ -622,7 +622,7 @@ class ScreenHeaderComponent extends PureComponent<ScreenHeaderProps, ScreenHeade
if (this.props.onSaveButtonPress) this.props.onSaveButtonPress(); if (this.props.onSaveButtonPress) this.props.onSaveButtonPress();
}, },
this.props.saveButtonDisabled === true, this.props.saveButtonDisabled === true,
this.props.showSaveButton === true this.props.showSaveButton === true,
)} )}
{titleComp} {titleComp}
{selectAllButtonComp} {selectAllButtonComp}

View File

@ -92,7 +92,7 @@ export default (props: Props) => {
onPress: () => complete(false), onPress: () => complete(false),
style: 'cancel', style: 'cancel',
}, },
] ],
); );
}, [initialPromptDone, display, props.dispatch]); }, [initialPromptDone, display, props.dispatch]);

View File

@ -273,7 +273,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
{ {
text: _('Discard changes'), text: _('Discard changes'),
onPress: goBack, onPress: goBack,
}] }],
); );
return true; return true;
@ -369,10 +369,10 @@ class ConfigScreenComponent extends BaseScreenComponent {
'sync.10.inboxEmail', 'sync.10.inboxEmail',
_('Copy to clipboard'), _('Copy to clipboard'),
() => Clipboard.setString(this.props.settings['sync.10.inboxEmail']), () => Clipboard.setString(this.props.settings['sync.10.inboxEmail']),
{ description } { description },
) )
} }
</View> </View>,
); );
} }
@ -621,7 +621,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
{_('- Location: to allow attaching geo-location information to a note.')} {_('- Location: to allow attaching geo-location information to a note.')}
</Text> </Text>
</View> </View>
</View> </View>,
); );
} }
@ -636,7 +636,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
{_('Make a donation')} {_('Make a donation')}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>,
); );
settingComps.push( settingComps.push(
@ -650,7 +650,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
{_('Joplin website')} {_('Joplin website')}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>,
); );
settingComps.push( settingComps.push(
@ -664,31 +664,31 @@ class ConfigScreenComponent extends BaseScreenComponent {
{_('Privacy Policy')} {_('Privacy Policy')}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>,
); );
settingComps.push( settingComps.push(
<View key="version_info_app" style={this.styles().settingContainer}> <View key="version_info_app" style={this.styles().settingContainer}>
<Text style={this.styles().settingText}>{`Joplin ${VersionInfo.appVersion}`}</Text> <Text style={this.styles().settingText}>{`Joplin ${VersionInfo.appVersion}`}</Text>
</View> </View>,
); );
settingComps.push( settingComps.push(
<View key="version_info_db" style={this.styles().settingContainer}> <View key="version_info_db" style={this.styles().settingContainer}>
<Text style={this.styles().settingText}>{_('Database v%s', reg.db().version())}</Text> <Text style={this.styles().settingText}>{_('Database v%s', reg.db().version())}</Text>
</View> </View>,
); );
settingComps.push( settingComps.push(
<View key="version_info_fts" style={this.styles().settingContainer}> <View key="version_info_fts" style={this.styles().settingContainer}>
<Text style={this.styles().settingText}>{_('FTS enabled: %d', this.props.settings['db.ftsEnabled'])}</Text> <Text style={this.styles().settingText}>{_('FTS enabled: %d', this.props.settings['db.ftsEnabled'])}</Text>
</View> </View>,
); );
settingComps.push( settingComps.push(
<View key="version_info_hermes" style={this.styles().settingContainer}> <View key="version_info_hermes" style={this.styles().settingContainer}>
<Text style={this.styles().settingText}>{_('Hermes enabled: %d', (global as any).HermesInternal ? 1 : 0)}</Text> <Text style={this.styles().settingText}>{_('Hermes enabled: %d', (global as any).HermesInternal ? 1 : 0)}</Text>
</View> </View>,
); );
return ( return (

View File

@ -40,7 +40,7 @@ describe('NoteExportButton', () => {
await act(() => fireEvent.press(exportButton)); await act(() => fireEvent.press(exportButton));
await waitFor(() => await waitFor(() =>
expect(view.queryByText(_('Exported successfully!'))).not.toBeNull() expect(view.queryByText(_('Exported successfully!'))).not.toBeNull(),
); );
// With the default folder setup, there should be no warnings // With the default folder setup, there should be no warnings

View File

@ -565,7 +565,7 @@ class NoteScreenComponent extends BaseScreenComponent {
}, },
(error: any) => { (error: any) => {
reject(error); reject(error);
} },
); );
}); });
} }
@ -756,7 +756,7 @@ class NoteScreenComponent extends BaseScreenComponent {
uri: data.uri, uri: data.uri,
type: 'image/jpg', type: 'image/jpg',
}, },
'image' 'image',
); );
this.setState({ showCamera: false }); this.setState({ showCamera: false });

View File

@ -262,7 +262,7 @@ const EncryptionConfigScreen = (props: Props) => {
rows.push( rows.push(
<Text style={styles.normalText} key={id}> <Text style={styles.normalText} key={id}>
{id} {id}
</Text> </Text>,
); );
} }

View File

@ -112,7 +112,7 @@ const SideMenuContentComponent = (props: Props) => {
toValue: 1, toValue: 1,
duration: 3000, duration: 3000,
easing: Easing.linear, easing: Easing.linear,
}) }),
); );
syncIconAnimation.start(); syncIconAnimation.start();
@ -156,7 +156,7 @@ const SideMenuContentComponent = (props: Props) => {
if (folder.id === props.inboxJopId) { if (folder.id === props.inboxJopId) {
return folderDeletion( return folderDeletion(
_('Delete the Inbox notebook?\n\nIf you delete the inbox notebook, any email that\'s recently been sent to it may be lost.') _('Delete the Inbox notebook?\n\nIf you delete the inbox notebook, any email that\'s recently been sent to it may be lost.'),
); );
} }
return folderDeletion(_('Delete notebook "%s"?\n\nAll notes and sub-notebooks within this notebook will also be deleted.', folder.title)); return folderDeletion(_('Delete notebook "%s"?\n\nAll notes and sub-notebooks within this notebook will also be deleted.', folder.title));
@ -191,7 +191,7 @@ const SideMenuContentComponent = (props: Props) => {
], ],
{ {
cancelable: false, cancelable: false,
} },
); );
}; };
@ -456,7 +456,7 @@ const SideMenuContentComponent = (props: Props) => {
items.push( items.push(
<Text key="sync_report" style={styles_.syncStatus}> <Text key="sync_report" style={styles_.syncStatus}>
{fullReport.join('\n')} {fullReport.join('\n')}
</Text> </Text>,
); );
} }
@ -464,7 +464,7 @@ const SideMenuContentComponent = (props: Props) => {
items.push( items.push(
<Text key="net_info" style={styles_.syncStatus}> <Text key="net_info" style={styles_.syncStatus}>
{ _('Mobile data - auto-sync disabled') } { _('Mobile data - auto-sync disabled') }
</Text> </Text>,
); );
} }

View File

@ -22,5 +22,5 @@ utils.registerGulpTasks(gulp, tasks);
gulp.task('build', gulp.series( gulp.task('build', gulp.series(
'buildInjectedJs', 'buildInjectedJs',
'encodeAssets', 'encodeAssets',
'podInstall' 'podInstall',
)); ));

View File

@ -72,7 +72,7 @@ module.exports = {
} }
return path.join(process.cwd(), `node_modules/${name}`); return path.join(process.cwd(), `node_modules/${name}`);
}, },
} },
), ),
}, },
projectRoot: path.resolve(__dirname), projectRoot: path.resolve(__dirname),

View File

@ -881,7 +881,7 @@ class AppComponent extends React.Component {
this.unsubscribeScreenWidthChangeHandler_ = Dimensions.addEventListener('change', this.handleScreenWidthChange_); this.unsubscribeScreenWidthChangeHandler_ = Dimensions.addEventListener('change', this.handleScreenWidthChange_);
this.themeChangeListener_ = Appearance.addChangeListener( this.themeChangeListener_ = Appearance.addChangeListener(
({ colorScheme }) => onSystemColorSchemeChange(colorScheme) ({ colorScheme }) => onSystemColorSchemeChange(colorScheme),
); );
onSystemColorSchemeChange(Appearance.getColorScheme()); onSystemColorSchemeChange(Appearance.getColorScheme());

View File

@ -36,7 +36,7 @@ class BundledFile {
public constructor( public constructor(
public readonly bundleName: string, public readonly bundleName: string,
private readonly sourceFilePath: string private readonly sourceFilePath: string,
) { ) {
this.rootFileDirectory = dirname(sourceFilePath); this.rootFileDirectory = dirname(sourceFilePath);
this.bundleBaseName = basename(sourceFilePath, extname(sourceFilePath)); this.bundleBaseName = basename(sourceFilePath, extname(sourceFilePath));
@ -200,7 +200,7 @@ class BundledFile {
const bundledFiles: BundledFile[] = [ const bundledFiles: BundledFile[] = [
new BundledFile( new BundledFile(
'codeMirrorBundle', 'codeMirrorBundle',
`${mobileDir}/components/NoteEditor/CodeMirror/CodeMirror.ts` `${mobileDir}/components/NoteEditor/CodeMirror/CodeMirror.ts`,
), ),
]; ];

View File

@ -25,7 +25,7 @@ const autodetectTheme = () => {
const colorScheme = systemColorScheme; const colorScheme = systemColorScheme;
logger.debug( logger.debug(
'Autodetecting theme. getColorScheme returns', Appearance.getColorScheme(), 'Autodetecting theme. getColorScheme returns', Appearance.getColorScheme(),
'and the expected theme is', systemColorScheme 'and the expected theme is', systemColorScheme,
); );
if (colorScheme === 'dark') { if (colorScheme === 'dark') {

View File

@ -16,7 +16,7 @@ class DatabaseDriverReactNative {
}, },
error => { error => {
reject(error); reject(error);
} },
); );
}); });
} }
@ -35,7 +35,7 @@ class DatabaseDriverReactNative {
}, },
error => { error => {
reject(error); reject(error);
} },
); );
}); });
} }
@ -66,7 +66,7 @@ class DatabaseDriverReactNative {
}, },
error => { error => {
reject(error); reject(error);
} },
); );
}); });
} }

View File

@ -33,7 +33,7 @@ class GeolocationReact {
error => { error => {
reject(error); reject(error);
}, },
options options,
); );
}); });
} }

View File

@ -150,7 +150,7 @@ module.exports = class extends Generator {
const newContent = mergePackageKey(null, sourceContent, destContent); const newContent = mergePackageKey(null, sourceContent, destContent);
return JSON.stringify(newContent, null, 2); return JSON.stringify(newContent, null, 2);
}, },
} },
); );
} else if (this.options.update && destFile === 'plugin.config.json' && this.fs.exists(destFilePath)) { } else if (this.options.update && destFile === 'plugin.config.json' && this.fs.exists(destFilePath)) {
// Keep existing content for now. Maybe later we could merge the configs. // Keep existing content for now. Maybe later we could merge the configs.
@ -163,20 +163,20 @@ module.exports = class extends Generator {
process: (sourceBuffer) => { process: (sourceBuffer) => {
return mergeIgnoreFile(sourceBuffer.toString(), destContent); return mergeIgnoreFile(sourceBuffer.toString(), destContent);
}, },
} },
); );
} else { } else {
this.fs.copyTpl( this.fs.copyTpl(
this.templatePath(file), this.templatePath(file),
destFilePath, destFilePath,
this.props this.props,
); );
} }
} }
this.fs.copy( this.fs.copy(
this.templatePath('api'), this.templatePath('api'),
this.destinationPath('api') this.destinationPath('api'),
); );
} }

View File

@ -132,7 +132,7 @@ function createPluginArchive(sourceDir, destPath) {
cwd: sourceDir, cwd: sourceDir,
sync: true, sync: true,
}, },
distFiles distFiles,
); );
console.info(chalk.cyan(`Plugin archive has been created in ${destPath}`)); console.info(chalk.cyan(`Plugin archive has been created in ${destPath}`));

View File

@ -43,7 +43,7 @@ export default class EventDispatcher<EventKeyType extends string|symbol|number,
// This allows any iterators over this.listeners to continue iterating // This allows any iterators over this.listeners to continue iterating
// without skipping elements. // without skipping elements.
this.listeners[eventName] = this.listeners[eventName].filter( this.listeners[eventName] = this.listeners[eventName].filter(
otherCallback => otherCallback !== callback otherCallback => otherCallback !== callback,
); );
} }
} }

View File

@ -547,7 +547,7 @@ export default class JoplinDatabase extends Database {
encryption_cipher_text: 'TEXT NOT NULL DEFAULT ""', encryption_cipher_text: 'TEXT NOT NULL DEFAULT ""',
encryption_applied: 'INT NOT NULL DEFAULT 0', encryption_applied: 'INT NOT NULL DEFAULT 0',
encryption_blob_encrypted: 'INT NOT NULL DEFAULT 0', encryption_blob_encrypted: 'INT NOT NULL DEFAULT 0',
}) }),
); );
} }
@ -761,7 +761,7 @@ export default class JoplinDatabase extends Database {
encryption_applied: 'INT NOT NULL DEFAULT 0', encryption_applied: 'INT NOT NULL DEFAULT 0',
markup_language: 'INT NOT NULL DEFAULT 1', markup_language: 'INT NOT NULL DEFAULT 1',
is_shared: 'INT NOT NULL DEFAULT 0', is_shared: 'INT NOT NULL DEFAULT 0',
}) }),
); );
} }

View File

@ -537,7 +537,7 @@ export default class Synchronizer {
(fnName, ...args) => { (fnName, ...args) => {
return this.apiCall(fnName, ...args); return this.apiCall(fnName, ...args);
}, },
action => { return this.dispatch(action); } action => { return this.dispatch(action); },
); );
} // DELETE_REMOTE STEP } // DELETE_REMOTE STEP
@ -768,7 +768,7 @@ export default class Synchronizer {
local, local,
syncTargetId, syncTargetId,
itemIsReadOnly, itemIsReadOnly,
(action: any) => this.dispatch(action) (action: any) => this.dispatch(action),
); );
completeItemProcessing(path); completeItemProcessing(path);

View File

@ -198,7 +198,7 @@ shared.settingsSections = createSelector(
} }
return output; return output;
} },
); );
shared.settingsToComponents2 = function(comp, device, settings, selectedSectionName = '') { shared.settingsToComponents2 = function(comp, device, settings, selectedSectionName = '') {

View File

@ -138,7 +138,7 @@ class FileApiDriverDropbox {
{ {
'Dropbox-API-Arg': JSON.stringify({ path: this.makePath_(path) }), 'Dropbox-API-Arg': JSON.stringify({ path: this.makePath_(path) }),
}, },
options options,
); );
return response; return response;
} catch (error) { } catch (error) {
@ -182,7 +182,7 @@ class FileApiDriverDropbox {
mute: true, // Don't send a notification to user since there can be many of these updates mute: true, // Don't send a notification to user since there can be many of these updates
}), }),
}, },
options options,
); );
} catch (error) { } catch (error) {
if (this.hasErrorCode_(error, 'restricted_content')) { if (this.hasErrorCode_(error, 'restricted_content')) {

View File

@ -4,7 +4,7 @@ const { useEffect, useRef } = shim.react();
function useEventListener( function useEventListener(
eventName: any, eventName: any,
handler: any, handler: any,
element?: any element?: any,
) { ) {
// Create a ref that stores handler // Create a ref that stores handler
const savedHandler = useRef<any>(); const savedHandler = useRef<any>();

View File

@ -56,7 +56,7 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
return true; return true;
}, },
...extraOptions, ...extraOptions,
} },
); );
}; };

View File

@ -626,7 +626,7 @@ export default class BaseItem extends BaseModel {
`, `,
this.db().escapeField(ItemClass.tableName()), this.db().escapeField(ItemClass.tableName()),
whereSql.join(' AND '), whereSql.join(' AND '),
limit limit,
); );
const items = await ItemClass.modelSelectAll(sql); const items = await ItemClass.modelSelectAll(sql);
@ -689,7 +689,7 @@ export default class BaseItem extends BaseModel {
this.db().escapeField(ItemClass.tableName()), this.db().escapeField(ItemClass.tableName()),
Number(syncTarget), Number(syncTarget),
extraWhere, extraWhere,
limit limit,
); );
const neverSyncedItem = await ItemClass.modelSelectAll(sql); const neverSyncedItem = await ItemClass.modelSelectAll(sql);
@ -718,7 +718,7 @@ export default class BaseItem extends BaseModel {
this.db().escapeField(ItemClass.tableName()), this.db().escapeField(ItemClass.tableName()),
Number(syncTarget), Number(syncTarget),
extraWhere, extraWhere,
newLimit newLimit,
); );
changedItems = await ItemClass.modelSelectAll(sql); changedItems = await ItemClass.modelSelectAll(sql);
@ -855,7 +855,7 @@ export default class BaseItem extends BaseModel {
SELECT id SELECT id
FROM %s FROM %s
WHERE encryption_applied = 0`, WHERE encryption_applied = 0`,
this.db().escapeField(ItemClass.tableName()) this.db().escapeField(ItemClass.tableName()),
); );
const items = await ItemClass.modelSelectAll(sql); const items = await ItemClass.modelSelectAll(sql);
@ -918,7 +918,7 @@ export default class BaseItem extends BaseModel {
this.getClass('Folder'), this.getClass('Folder'),
options.changeSource, options.changeSource,
BaseItem.syncShareCache, BaseItem.syncShareCache,
o.parent_id o.parent_id,
); );
} }
} }

View File

@ -119,7 +119,7 @@ export default class NoteResource extends BaseModel {
queries.push({ queries.push({
sql: 'INSERT INTO note_resources (note_id, resource_id, is_associated, last_seen_time) VALUES (?, ?, ?, ?)', sql: 'INSERT INTO note_resources (note_id, resource_id, is_associated, last_seen_time) VALUES (?, ?, ?, ?)',
params: ['', id, 0, lastSeenTime] } params: ['', id, 0, lastSeenTime] },
); );
} }
await this.db().transactionExecBatch(queries); await this.db().transactionExecBatch(queries);
@ -141,7 +141,7 @@ export default class NoteResource extends BaseModel {
AND last_seen_time < ? AND last_seen_time < ?
AND last_seen_time != 0 AND last_seen_time != 0
`, `,
[cutOffTime] [cutOffTime],
); );
return output.map((r: any) => r.resource_id); return output.map((r: any) => r.resource_id);
} }

View File

@ -1312,7 +1312,7 @@ class Setting extends BaseModel {
onClick: () => { onClick: () => {
shim.openOrCreateFile( shim.openOrCreateFile(
this.customCssFilePath(Setting.customCssFilenames.RENDERED_MARKDOWN), this.customCssFilePath(Setting.customCssFilenames.RENDERED_MARKDOWN),
'/* For styling the rendered Markdown */' '/* For styling the rendered Markdown */',
); );
}, },
type: SettingItemType.Button, type: SettingItemType.Button,
@ -1329,7 +1329,7 @@ class Setting extends BaseModel {
onClick: () => { onClick: () => {
shim.openOrCreateFile( shim.openOrCreateFile(
this.customCssFilePath(Setting.customCssFilenames.JOPLIN_APP), this.customCssFilePath(Setting.customCssFilenames.JOPLIN_APP),
`/* For styling the entire Joplin app (except the rendered Markdown, which is defined in \`${Setting.customCssFilenames.RENDERED_MARKDOWN}\`) */` `/* For styling the entire Joplin app (except the rendered Markdown, which is defined in \`${Setting.customCssFilenames.RENDERED_MARKDOWN}\`) */`,
); );
}, },
type: SettingItemType.Button, type: SettingItemType.Button,

View File

@ -32,7 +32,7 @@ export default class Tag extends BaseItem {
return Note.previews( return Note.previews(
null, null,
{ ...options, conditions: [`id IN ("${noteIds.join('","')}")`] } { ...options, conditions: [`id IN ("${noteIds.join('","')}")`] },
); );
} }

View File

@ -211,12 +211,12 @@ const createShallowArrayEqualSelector = createSelectorCreator(
if (prev[i] !== next[i]) return false; if (prev[i] !== next[i]) return false;
} }
return true; return true;
} },
); );
const selectArrayShallow = createCachedSelector( const selectArrayShallow = createCachedSelector(
(state: any) => state.array, (state: any) => state.array,
(array: any[]) => array (array: any[]) => array,
)({ )({
keySelector: (_state: any, cacheKey: any) => { keySelector: (_state: any, cacheKey: any) => {
return cacheKey; return cacheKey;

View File

@ -350,7 +350,7 @@ export default class KeymapService extends BaseService {
'Accelerator "%s" is used for "%s" and "%s" commands. This may lead to unexpected behaviour.', 'Accelerator "%s" is used for "%s" and "%s" commands. This may lead to unexpected behaviour.',
itemAccelerator, itemAccelerator,
originalItem.command, originalItem.command,
itemCommand itemCommand,
)); ));
} else if (itemAccelerator) { } else if (itemAccelerator) {
usedAccelerators.add(itemAccelerator); usedAccelerators.add(itemAccelerator);

View File

@ -44,7 +44,7 @@ export default class ResourceService extends BaseService {
AND id > ? AND id > ?
ORDER BY id ASC ORDER BY id ASC
LIMIT 10 LIMIT 10
`, [BaseModel.TYPE_NOTE, Setting.value('resourceService.lastProcessedChangeId')] `, [BaseModel.TYPE_NOTE, Setting.value('resourceService.lastProcessedChangeId')],
); );
if (!changes.length) break; if (!changes.length) break;

View File

@ -126,7 +126,7 @@ export default class RevisionService extends BaseService {
ORDER BY id ASC ORDER BY id ASC
LIMIT 10 LIMIT 10
`, `,
[BaseModel.TYPE_NOTE, ItemChange.SOURCE_SYNC, ItemChange.SOURCE_DECRYPTION, Setting.value('revisionService.lastProcessedChangeId')] [BaseModel.TYPE_NOTE, ItemChange.SOURCE_SYNC, ItemChange.SOURCE_DECRYPTION, Setting.value('revisionService.lastProcessedChangeId')],
); );
if (!changes.length) break; if (!changes.length) break;

View File

@ -42,14 +42,14 @@ const createShallowObjectEqualSelector = createSelectorCreator(
if (prev[n] !== next[n]) return false; if (prev[n] !== next[n]) return false;
} }
return true; return true;
} },
); );
// This selector ensures that for the given command names, the same toolbar // This selector ensures that for the given command names, the same toolbar
// button array is returned if the underlying toolbar buttons have not changed. // button array is returned if the underlying toolbar buttons have not changed.
const selectObjectByCommands = createCachedSelector( const selectObjectByCommands = createCachedSelector(
(state: any) => state.array, (state: any) => state.array,
(array: any[]) => array (array: any[]) => array,
)({ )({
keySelector: (_state: any, commandNames: string[]) => { keySelector: (_state: any, commandNames: string[]) => {
return commandNames.join('_'); return commandNames.join('_');

View File

@ -13,7 +13,7 @@ describe('Module', () => {
const importModuleMultiSource = makeImportModule( const importModuleMultiSource = makeImportModule(
baseMetadata, baseMetadata,
() => new InteropService_Importer_Base() () => new InteropService_Importer_Base(),
); );
const importModuleSingleSource = makeImportModule({ const importModuleSingleSource = makeImportModule({

View File

@ -63,7 +63,7 @@ const moduleFullLabel = (metadata: ImportMetadata|ExportMetadata, moduleSource:
}; };
export const makeImportModule = ( export const makeImportModule = (
metadata: Partial<ImportMetadata>, factory: ()=> InteropService_Importer_Base metadata: Partial<ImportMetadata>, factory: ()=> InteropService_Importer_Base,
): ImportModule => { ): ImportModule => {
const importerDefaults: ImportMetadata = { const importerDefaults: ImportMetadata = {
...defaultBaseMetadata, ...defaultBaseMetadata,
@ -93,7 +93,7 @@ export const makeImportModule = (
}; };
export const makeExportModule = ( export const makeExportModule = (
metadata: Partial<ExportMetadata>, factory: ()=> InteropService_Exporter_Base metadata: Partial<ExportMetadata>, factory: ()=> InteropService_Exporter_Base,
): ExportModule => { ): ExportModule => {
const exporterDefaults: ExportMetadata = { const exporterDefaults: ExportMetadata = {
...defaultBaseMetadata, ...defaultBaseMetadata,

View File

@ -140,7 +140,7 @@ export default class JoplinSettings {
this.plugin_.deprecationNotice( this.plugin_.deprecationNotice(
'1.8', '1.8',
'joplin.settings.registerSetting() is deprecated in favour of joplin.settings.registerSettings()', 'joplin.settings.registerSetting() is deprecated in favour of joplin.settings.registerSettings()',
!registerSettingAllowedPluginIds.includes(this.plugin_.id) !registerSettingAllowedPluginIds.includes(this.plugin_.id),
); );
await this.registerSettings({ [key]: settingItem }); await this.registerSettings({ [key]: settingItem });

View File

@ -109,7 +109,7 @@ export default class SearchEngine {
queries.push({ sql: ` queries.push({ sql: `
INSERT INTO notes_normalized(${SearchEngine.relevantFields}) INSERT INTO notes_normalized(${SearchEngine.relevantFields})
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
params: [n.id, n.title, n.body, n.user_created_time, n.user_updated_time, n.is_todo, n.todo_completed, n.todo_due, n.parent_id, n.latitude, n.longitude, n.altitude, n.source_url] } params: [n.id, n.title, n.body, n.user_created_time, n.user_updated_time, n.is_todo, n.todo_completed, n.todo_due, n.parent_id, n.latitude, n.longitude, n.altitude, n.source_url] },
); );
} }
@ -174,7 +174,7 @@ export default class SearchEngine {
ORDER BY id ASC ORDER BY id ASC
LIMIT 10 LIMIT 10
`, `,
[BaseModel.TYPE_NOTE, lastChangeId] [BaseModel.TYPE_NOTE, lastChangeId],
); );
if (!changes.length) break; if (!changes.length) break;
@ -184,7 +184,7 @@ export default class SearchEngine {
const noteIds = changes.map(a => a.item_id); const noteIds = changes.map(a => a.item_id);
const notes = await Note.modelSelectAll(` const notes = await Note.modelSelectAll(`
SELECT ${SearchEngine.relevantFields} SELECT ${SearchEngine.relevantFields}
FROM notes WHERE id IN ("${noteIds.join('","')}") AND is_conflict = 0 AND encryption_applied = 0` FROM notes WHERE id IN ("${noteIds.join('","')}") AND is_conflict = 0 AND encryption_applied = 0`,
); );
for (let i = 0; i < changes.length; i++) { for (let i = 0; i < changes.length; i++) {

View File

@ -91,7 +91,7 @@ const filterByTableName = (
requirement: Requirement, requirement: Requirement,
withs: string[], withs: string[],
tableName: string, tableName: string,
useFts: boolean useFts: boolean,
) => { ) => {
const operator: Operation = getOperator(requirement, relation); const operator: Operation = getOperator(requirement, relation);

Some files were not shown because too many files have changed in this diff Show More