From f977c5a64c50248c0a419b7ec1c2134f15f7f687 Mon Sep 17 00:00:00 2001 From: winston Date: Sat, 18 Nov 2023 06:42:42 +0100 Subject: [PATCH] ci(lint): fix `usercss-meta` parse error (#331) --- src/lint/main.ts | 14 +++++++++++++- template/catppuccin.user.css | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lint/main.ts b/src/lint/main.ts index f510f36c..eb61310c 100755 --- a/src/lint/main.ts +++ b/src/lint/main.ts @@ -30,7 +30,19 @@ for await (const entry of stylesheets) { // verify the usercss metadata const { globalVars, isLess } = await verifyMetadata(entry, content, repo) - .catch(() => ({ globalVars: {}, isLess: false })); + .catch((e) => { + const lines = content.split("\n"); + let startLine = -1; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + if (e.index >= line.length) { + e.index -= line.length; + startLine++; + } else break; + } + log(e.message, { file, startLine, content }, "error"); + throw e; + }); // don't attempt to compile or lint non-less files if (!isLess) continue; diff --git a/template/catppuccin.user.css b/template/catppuccin.user.css index ac691170..bf23fe15 100644 --- a/template/catppuccin.user.css +++ b/template/catppuccin.user.css @@ -81,7 +81,7 @@ * The values below are examples and may need to be adapted. * To apply the correct Theming call the above defined Mixin and pass * your desired Flavor and Accent Color to it. These are usually - * populated through the `@var`s in the Meta Block. */ + * populated through the @vars in the Meta Block. */ // synced colorscheme @media (prefers-color-scheme: light) { .no-theme {