diff --git a/control-structure-spacing.js b/control-structure-spacing.js index 92e6f4dcf..7a25796af 100644 --- a/control-structure-spacing.js +++ b/control-structure-spacing.js @@ -46,6 +46,16 @@ export default { const afterOpen = sourceCode.getTokenAfter(openParen); const beforeClose = sourceCode.getTokenBefore(closeParen); + { + const contentBetweenParens = sourceCode.getText().slice(openParen.range[1], closeParen.range[0]); + const isSingleCharVariable = /^\s*[a-zA-Z_$]\s*$/.test(contentBetweenParens); + + // Skip spacing requirements for single character variables + if ( isSingleCharVariable ) { + return; + } + } + // Control structures should have spacing if ( afterOpen && openParen.range[1] === afterOpen.range[0] ) { context.report({ diff --git a/extensions/whoami/routes.js b/extensions/whoami/routes.js index b552fc699..1697c378e 100644 --- a/extensions/whoami/routes.js +++ b/extensions/whoami/routes.js @@ -47,7 +47,7 @@ const whoami_common = ({ is_user, user }) => { epoch = new Date(user.last_activity_ts).getTime(); // round to 1 decimal place epoch = Math.round(epoch / 1000); - } catch(e) { + } catch (e) { console.error('Error parsing last_activity_ts', e); }