1
0
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:
Laurent Cozic
2020-11-12 19:13:28 +00:00
parent 62feb7ff60
commit d20694e52c
291 changed files with 2205 additions and 2203 deletions

View File

@ -1,22 +1,22 @@
import { PluginManifest, PluginPermission } from './types';
export default function manifestFromObject(o:any):PluginManifest {
export default function manifestFromObject(o: any): PluginManifest {
const getString = (name:string, required:boolean = true, defaultValue:string = ''):string => {
const getString = (name: string, required: boolean = true, defaultValue: string = ''): 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: boolean = 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 permissions:PluginPermission[] = [];
const permissions: PluginPermission[] = [];
const manifest = {
manifest_version: getNumber('manifest_version', true),