You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Tools: Apply eslint rule @typescript-eslint/no-inferrable-types with ignoreArguments=false
This commit is contained in:
@ -3,28 +3,28 @@ import validatePluginId from './validatePluginId';
|
||||
|
||||
export default function manifestFromObject(o: any): PluginManifest {
|
||||
|
||||
const getString = (name: string, required: boolean = true, defaultValue: string = ''): string => {
|
||||
const getString = (name: string, required = true, defaultValue = ''): string => {
|
||||
if (required && !o[name]) throw new Error(`Missing required field: ${name}`);
|
||||
if (!o[name]) return defaultValue;
|
||||
if (typeof o[name] !== 'string') throw new Error(`Field must be a string: ${name}`);
|
||||
return o[name];
|
||||
};
|
||||
|
||||
const getNumber = (name: string, required: boolean = true): number => {
|
||||
const getNumber = (name: string, required = true): number => {
|
||||
if (required && !o[name]) throw new Error(`Missing required field: ${name}`);
|
||||
if (!o[name]) return 0;
|
||||
if (typeof o[name] !== 'number') throw new Error(`Field must be a number: ${name}`);
|
||||
return o[name];
|
||||
};
|
||||
|
||||
const getStrings = (name: string, required: boolean = true, defaultValue: string[] = []): string[] => {
|
||||
const getStrings = (name: string, required = true, defaultValue: string[] = []): string[] => {
|
||||
if (required && !o[name]) throw new Error(`Missing required field: ${name}`);
|
||||
if (!o[name]) return defaultValue;
|
||||
if (!Array.isArray(o[name])) throw new Error(`Field must be an array: ${name}`);
|
||||
return o[name];
|
||||
};
|
||||
|
||||
const getBoolean = (name: string, required: boolean = true, defaultValue: boolean = false): boolean => {
|
||||
const getBoolean = (name: string, required = true, defaultValue = false): boolean => {
|
||||
if (required && !o[name]) throw new Error(`Missing required field: ${name}`);
|
||||
if (!o[name]) return defaultValue;
|
||||
if (typeof o[name] !== 'boolean') throw new Error(`Field must be a boolean: ${name}`);
|
||||
|
Reference in New Issue
Block a user