From 6fd080269b9e03459cfe10dafecd3a9d536d1d7e Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 3 Feb 2021 13:56:01 +0000 Subject: [PATCH] linting. --- packages/string-templates/src/helpers/date.js | 14 ++++++++------ packages/string-templates/src/index.js | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/packages/string-templates/src/helpers/date.js b/packages/string-templates/src/helpers/date.js index 6751724608..1c929a758f 100644 --- a/packages/string-templates/src/helpers/date.js +++ b/packages/string-templates/src/helpers/date.js @@ -10,13 +10,15 @@ const dayjs = require("dayjs") */ function isOptions(val) { - return typeof(val) === "object" && typeof(val.hash) === "object" + return typeof val === "object" && typeof val.hash === "object" } function isApp(thisArg) { - return typeof(thisArg) === "object" - && typeof(thisArg.options) === "object" - && typeof(thisArg.app) === "object" + return ( + typeof thisArg === "object" && + typeof thisArg.options === "object" && + typeof thisArg.app === "object" + ) } function getContext(thisArg, locals, options) { @@ -66,11 +68,11 @@ module.exports = function dateHelper(str, pattern, options) { return dayjs().format("MMMM DD, YYYY") } - const defaults = {lang: "en", date: new Date(str)} + const defaults = { lang: "en", date: new Date(str) } const opts = getContext(this, defaults, options) // set the language to use dayjs.locale(opts.lang || opts.language) return dayjs(new Date(str)).format(pattern) -} \ No newline at end of file +} diff --git a/packages/string-templates/src/index.js b/packages/string-templates/src/index.js index e7d9b9d7e7..e662f253c6 100644 --- a/packages/string-templates/src/index.js +++ b/packages/string-templates/src/index.js @@ -2,7 +2,11 @@ const handlebars = require("handlebars") const { registerAll } = require("./helpers/index") const processors = require("./processors") const { cloneDeep } = require("lodash/fp") -const { removeNull, addConstants, removeHandlebarsStatements } = require("./utilities") +const { + removeNull, + addConstants, + removeHandlebarsStatements, +} = require("./utilities") const manifest = require("../manifest.json") const hbsInstance = handlebars.create() @@ -121,7 +125,13 @@ module.exports.makePropSafe = property => { * @returns {boolean} Whether or not the input string is valid. */ module.exports.isValid = string => { - const validCases = ["string", "number", "object", "array", "cannot read property"] + const validCases = [ + "string", + "number", + "object", + "array", + "cannot read property", + ] // this is a portion of a specific string always output by handlebars in the case of a syntax error const invalidCases = [`expecting '`] // don't really need a real context to check if its valid