Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(gates): in the editor, a var() whose name nothing defines is a finding even with a fallback

esenginea95d86dd16ab
diff --git a/desktop b/desktop
index 2160bbd21..ec654b744 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 2160bbd2158a88d02f46abed3aa4f2957a6277d0
+Subproject commit ec654b74489860416c8b4fa1d0b61ee16ca9182b
diff --git a/tools/check-css-vars.mjs b/tools/check-css-vars.mjs
index da10ed2d6..a573db17a 100644
--- a/tools/check-css-vars.mjs
+++ b/tools/check-css-vars.mjs
@@ -15,7 +15,11 @@
* `--accent` and `--bg`, neither of which exists, so a plugin written to the
* manual drew a black circle on a dark viewport.
*
- * A `var()` WITH a fallback is not counted: it has an answer either way.
+ * A `var()` WITH a fallback is not counted in a plugin or the docs, which may run
+ * against an editor older than the name. In the editor it is: every name the
+ * editor has is defined in the editor, so a fallback there is always what draws
+ * — `--danger` never existed, and three delete buttons drew two different
+ * literals instead of `--error`.
*
* node tools/check-css-vars.mjs
*/
@@ -74,10 +78,12 @@ for (const { dir, ext } of USES) {
const text = uncomment(readFileSync(file, 'utf8'));
for (const m of text.matchAll(/var\(\s*(--[A-Za-z0-9_-]+)\s*([,)])/g)) {
uses += 1;
- if (m[2] === ',' || defined.has(m[1])) continue;
+ if (defined.has(m[1])) continue;
+ const fallback = m[2] === ',';
+ if (fallback && !rel.startsWith('desktop/src/')) continue;
const line = text.slice(0, m.index).split('\n').length;
problems.push(`${rel}:${line}: ${m[1]} is used and nothing defines it — `
- + 'the declaration resolves to nothing and draws nothing');
+ + (fallback ? 'only its fallback ever draws, a value off the palette' : 'the declaration resolves to nothing and draws nothing'));
}
}
}