1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Tools: Implement @typescript-eslint/no-explicit-any rule

This commit is contained in:
Laurent Cozic
2024-04-05 12:16:49 +01:00
parent 42900bcc66
commit 2e2a2b3193
654 changed files with 2971 additions and 170 deletions

View File

@ -11,6 +11,7 @@ export interface MenuItem {
label?: string;
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
click?: Function;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
role?: any;
type?: string;
accelerator?: string;
@ -23,10 +24,12 @@ interface MenuItems {
}
interface MenuItemProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
[key: string]: any;
}
interface MenuItemPropsCache {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
[key: string]: any;
}
@ -36,6 +39,7 @@ interface MenuItemCache {
const createShallowObjectEqualSelector = createSelectorCreator(
defaultMemoize,
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
(prev: any, next: any) => {
if (Object.keys(prev).length !== Object.keys(next).length) return false;
for (const n in prev) {
@ -48,9 +52,12 @@ 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(
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
(state: any) => state.array,
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
(array: any[]) => array,
)({
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
keySelector: (_state: any, commandNames: string[]) => {
return commandNames.join('_');
},
@ -95,6 +102,7 @@ export default class MenuUtils {
return item;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
public commandToStatefulMenuItem(commandName: string, ...args: any[]): MenuItem {
const whenClauseContext = this.service.currentWhenClauseContext();
@ -123,6 +131,7 @@ export default class MenuUtils {
return output;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
public commandsToMenuItemProps(commandNames: string[], whenClauseContext: any): MenuItemProps {
const output: MenuItemProps = {};
@ -154,6 +163,7 @@ export default class MenuUtils {
output.push(menuItem);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
if (output.length) output.splice(0, 0, { type: 'separator' } as any);
return output;