You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-24 23:26:50 +02:00
Tools: Apply rule @typescript-eslint/type-annotation-spacing
This commit is contained in:
@ -17,20 +17,20 @@ interface MenuItems {
|
||||
}
|
||||
|
||||
interface MenuItemProps {
|
||||
[key:string]: any,
|
||||
[key: string]: any,
|
||||
}
|
||||
|
||||
interface MenuItemPropsCache {
|
||||
[key:string]: any,
|
||||
[key: string]: any,
|
||||
}
|
||||
|
||||
interface MenuItemCache {
|
||||
[key:string]: MenuItems,
|
||||
[key: string]: MenuItems,
|
||||
}
|
||||
|
||||
const createShallowObjectEqualSelector = createSelectorCreator(
|
||||
defaultMemoize,
|
||||
(prev:any, next:any) => {
|
||||
(prev: any, next: any) => {
|
||||
if (Object.keys(prev).length !== Object.keys(next).length) return false;
|
||||
for (const n in prev) {
|
||||
if (prev[n] !== next[n]) return false;
|
||||
@ -42,10 +42,10 @@ const createShallowObjectEqualSelector = createSelectorCreator(
|
||||
// This selector ensures that for the given command names, the same toolbar
|
||||
// button array is returned if the underlying toolbar buttons have not changed.
|
||||
const selectObjectByCommands = createCachedSelector(
|
||||
(state:any) => state.array,
|
||||
(array:any[]) => array
|
||||
(state: any) => state.array,
|
||||
(array: any[]) => array
|
||||
)({
|
||||
keySelector: (_state:any, commandNames:string[]) => {
|
||||
keySelector: (_state: any, commandNames: string[]) => {
|
||||
return commandNames.join('_');
|
||||
},
|
||||
selectorCreator: createShallowObjectEqualSelector,
|
||||
@ -53,26 +53,26 @@ const selectObjectByCommands = createCachedSelector(
|
||||
|
||||
export default class MenuUtils {
|
||||
|
||||
private service_:CommandService;
|
||||
private menuItemCache_:MenuItemCache = {};
|
||||
private menuItemPropsCache_:MenuItemPropsCache = {};
|
||||
private service_: CommandService;
|
||||
private menuItemCache_: MenuItemCache = {};
|
||||
private menuItemPropsCache_: MenuItemPropsCache = {};
|
||||
|
||||
constructor(service:CommandService) {
|
||||
constructor(service: CommandService) {
|
||||
this.service_ = service;
|
||||
}
|
||||
|
||||
private get service():CommandService {
|
||||
private get service(): CommandService {
|
||||
return this.service_;
|
||||
}
|
||||
|
||||
private get keymapService():KeymapService {
|
||||
private get keymapService(): KeymapService {
|
||||
return KeymapService.instance();
|
||||
}
|
||||
|
||||
public commandToMenuItem(commandName:string, onClick:Function):MenuItem {
|
||||
public commandToMenuItem(commandName: string, onClick: Function): MenuItem {
|
||||
const command = this.service.commandByName(commandName);
|
||||
|
||||
const item:MenuItem = {
|
||||
const item: MenuItem = {
|
||||
id: command.declaration.name,
|
||||
label: this.service.label(commandName),
|
||||
click: () => onClick(command.declaration.name),
|
||||
@ -87,17 +87,17 @@ export default class MenuUtils {
|
||||
return item;
|
||||
}
|
||||
|
||||
public commandToStatefulMenuItem(commandName:string, ...args:any[]):MenuItem {
|
||||
public commandToStatefulMenuItem(commandName: string, ...args: any[]): MenuItem {
|
||||
return this.commandToMenuItem(commandName, () => {
|
||||
return this.service.execute(commandName, ...args);
|
||||
});
|
||||
}
|
||||
|
||||
public commandsToMenuItems(commandNames:string[], onClick:Function):MenuItems {
|
||||
const key:string = `${this.keymapService.lastSaveTime}_${commandNames.join('_')}`;
|
||||
public commandsToMenuItems(commandNames: string[], onClick: Function): MenuItems {
|
||||
const key: string = `${this.keymapService.lastSaveTime}_${commandNames.join('_')}`;
|
||||
if (this.menuItemCache_[key]) return this.menuItemCache_[key];
|
||||
|
||||
const output:MenuItems = {};
|
||||
const output: MenuItems = {};
|
||||
|
||||
for (const commandName of commandNames) {
|
||||
output[commandName] = this.commandToMenuItem(commandName, onClick);
|
||||
@ -108,8 +108,8 @@ export default class MenuUtils {
|
||||
return output;
|
||||
}
|
||||
|
||||
public commandsToMenuItemProps(commandNames:string[], whenClauseContext:any):MenuItemProps {
|
||||
const output:MenuItemProps = {};
|
||||
public commandsToMenuItemProps(commandNames: string[], whenClauseContext: any): MenuItemProps {
|
||||
const output: MenuItemProps = {};
|
||||
|
||||
for (const commandName of commandNames) {
|
||||
const newProps = {
|
||||
|
Reference in New Issue
Block a user