1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-08 13:06:15 +02:00

Tools: Add eslint rule @typescript-eslint/array-type

This commit is contained in:
Laurent Cozic 2023-06-30 09:16:08 +01:00
parent e89b59be8e
commit c6a15b3186
8 changed files with 8 additions and 7 deletions

View File

@ -183,6 +183,7 @@ module.exports = {
'rules': {
'@typescript-eslint/explicit-member-accessibility': ['error'],
'@typescript-eslint/type-annotation-spacing': ['error', { 'before': false, 'after': true }],
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/no-inferrable-types': ['error'],
'@typescript-eslint/comma-dangle': ['error', {
'arrays': 'always-multiline',

View File

@ -10,7 +10,7 @@ export const declaration: CommandDeclaration = {
export const runtime = (): CommandRuntime => {
return {
execute: async (_context: CommandContext, field?: string | Array<any>, reverse?: boolean) => {
execute: async (_context: CommandContext, field?: string | any[], reverse?: boolean) => {
// field: Sort order's field. undefined means switching a field.
// reverse: whether the sort order is reversed or not. undefined means toggling.
//

View File

@ -20,7 +20,7 @@ const { clipboard } = require('electron');
interface Props {
themeId: number;
noteIds: Array<string>;
noteIds: string[];
onClose: Function;
shares: StateShare[];
syncTargetId: number;

View File

@ -6,7 +6,7 @@ type CallbackHandler<EventType> = (data: EventType)=> void;
export default class EventDispatcher<EventKeyType extends string|symbol|number, EventMessageType> {
// Partial marks all fields as optional. To initialize with an empty object, this is required.
// See https://stackoverflow.com/a/64526384
private listeners: Partial<Record<EventKeyType, Array<Listener<EventMessageType>>>>;
private listeners: Partial<Record<EventKeyType, Listener<EventMessageType>[]>>;
public constructor() {
this.listeners = {};
}

View File

@ -69,7 +69,7 @@ const markdownUtils = {
},
// Returns the **encoded** URLs, so to be useful they should be decoded again before use.
extractFileUrls(md: string, onlyType: string = null): Array<string> {
extractFileUrls(md: string, onlyType: string = null): string[] {
const markdownIt = new MarkdownIt();
markdownIt.validateLink = validateLinks; // Necessary to support file:/// links

View File

@ -2082,7 +2082,7 @@ class Setting extends BaseModel {
// If yes, then it just returns 'true'. If its not present then, it will
// update it and return 'false'
public static setArrayValue(settingName: string, value: string): boolean {
const settingValue: Array<any> = this.value(settingName);
const settingValue: any[] = this.value(settingName);
if (settingValue.includes(value)) return true;
settingValue.push(value);
this.setValue(settingName, settingValue);

View File

@ -10,7 +10,7 @@ const shared = require('../../../components/shared/config-shared.js');
const logger = Logger.create('defaultPluginsUtils');
export function checkPreInstalledDefaultPlugins(defaultPluginsId: string[], pluginSettings: PluginSettings) {
const installedDefaultPlugins: Array<string> = Setting.value('installedDefaultPlugins');
const installedDefaultPlugins: string[] = Setting.value('installedDefaultPlugins');
for (const pluginId of defaultPluginsId) {
// if pluginId is present in pluginSettings and not in installedDefaultPlugins array,
// then its either pre-installed by user or just uninstalled

View File

@ -55,7 +55,7 @@ interface SafxInterface {
unlink(uriString: string): Promise<boolean>;
mkdir(uriString: string): Promise<DocumentFileDetail>;
rename(uriString: string, newName: string): Promise<DocumentFileDetail>;
getPersistedUriPermissions(): Promise<Array<string>>;
getPersistedUriPermissions(): Promise<string[]>;
releasePersistableUriPermission(uriString: string): Promise<void>;
listFiles(uriString: string): Promise<DocumentFileDetail[]>;
stat(uriString: string): Promise<DocumentFileDetail>;