From afc010b7eb7df806a81020256863f0d72ad77d04 Mon Sep 17 00:00:00 2001 From: thi64146 Date: Wed, 27 Mar 2024 17:13:39 -0600 Subject: [PATCH] eslint adjust better readability --- libs/blocks/share/share.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/blocks/share/share.js b/libs/blocks/share/share.js index 160256a463..45f2e116ce 100644 --- a/libs/blocks/share/share.js +++ b/libs/blocks/share/share.js @@ -57,8 +57,11 @@ export default async function decorate(block) { const rows = block.querySelectorAll(':scope > div'); const childDiv = rows[0].querySelector(':scope > div'); const emptyRow = childDiv?.innerText.trim() === ''; - /* eslint-disable no-confusing-arrow,no-useless-escape */ - const toSentenceCase = (str) => str && typeof str === 'string' ? str.toLowerCase().replace(/(^\s*\w|[\.\!\?]\s*\w)/g, (c) => c.toUpperCase()) : ''; + const toSentenceCase = (str) => { + if (!str || typeof str !== 'string') return ''; + /* eslint-disable-next-line no-useless-escape */ + return str.toLowerCase().replace(/(^\s*\w|[\.\!\?]\s*\w)/g, (c) => c.toUpperCase()); + }; if (block.classList.contains('inline')) { rows[0].innerHTML = '';