From 3bef3ba7fda4e06f22ad70ad73ecd1af11ff1802 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 15 Sep 2022 12:11:49 +0530 Subject: [PATCH] Only log valid diagrams --- .eslintrc.cjs | 3 ++- src/lib/util/stats.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 17858327..f4f6f285 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -44,6 +44,7 @@ module.exports = { ], '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-assignment': 'off', - 'es/no-regexp-lookbehind-assertions': 'error' + 'es/no-regexp-lookbehind-assertions': 'error', + curly: ['error', 'all'] } }; diff --git a/src/lib/util/stats.ts b/src/lib/util/stats.ts index b138044c..9b4b9209 100644 --- a/src/lib/util/stats.ts +++ b/src/lib/util/stats.ts @@ -54,6 +54,9 @@ export const countLines = (code: string): number => { export const saveStatistics = (graph: string): void => { const graphType = detectType(graph); + if (!graphType) { + return; + } const length = countLines(graph); logEvent('render', { graphType, length }); };