Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

chore: take the lint baseline to zero, and keep it there (#85)

Matthew Kissinger4754f7c65e23
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b6767540..6c7d7e28 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,37 @@
Changes to `@kiln/engine`. Source and installable packages are distributed through
GitHub. The package is not published on the npm registry.
+## The lint baseline is zero, and stays zero — 2026-09-12
+
+- `bun run lint` reported **14 warnings and 11 infos** and exited 0. All 25 are fixed;
+ the tree now reports nothing. The point is not tidiness: a baseline everyone agrees to
+ ignore is a baseline the twenty-sixth finding arrives invisible against.
+- Two of them were not style. `isFinite` in the render inspector is the coercing global,
+ where `Number.isFinite` is not — identical on a `Box3` component, taken because the next
+ caller to pass something looser is the one the coercion silently accepts. And
+ `ids.forEach((id, i) => index.set(id, i))` in the Bradley-Terry fit returned the map
+ from a callback whose contract discards it; the index is built from its pairs instead.
+- Three `any` bounds in `buildSandboxGlobals` carried
+ `// eslint-disable-next-line @typescript-eslint/no-explicit-any`. This repository lints
+ with Biome and has no ESLint config, so those suppressed nothing while reading as
+ reviewed-and-accepted. Rather than translate them, the `any` is gone: `never[]` is the
+ correct bound for "any parameter list" and `unknown` for "any return", with one narrow
+ assertion where tsc resolves a call through the constraint and can only see `unknown`.
+- The quaternion fixture's `0.7071` is now `Math.SQRT1_2` — exact, and it says which angle
+ a quarter turn about Y actually is.
+- **Warnings now fail.** `lint` runs with `--error-on-warnings`, and because that flag
+ does not reach Biome's info severity — where `useTemplate` and several others sit by
+ default — the seven rules this cleanup touched carry an explicit `error` in
+ `biome.json`. Each of the seven was verified by reintroducing its defect and confirming
+ the gate fails and names the rule.
+- The `useIterableCallbackReturn: "warn"` downgrade is gone with the finding it was
+ written around. A test asserts the seven severities and the `lint` script itself: a rule
+ lowered to keep a build green is indistinguishable from a rule nobody wanted, and that
+ has happened here before.
+- `CONTRIBUTING.md` says the contract plainly — the tree reports nothing, so any
+ diagnostic a change produces belongs to that change, to fix or to suppress with a
+ `biome-ignore` comment that says why.
+
## The gates stop reporting and start blocking — 2026-09-12
- **The Windows job blocks.** It landed reporting-only on purpose, because the fault it
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e5a72abe..1317958f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -19,6 +19,10 @@ bun run test
bun run test:coverage
```
+`lint` reports **nothing** on a clean tree, and a warning fails it. There is no
+tolerated baseline to compare against, so any diagnostic your change produces is
+yours -- either fix it, or suppress it with a `biome-ignore` comment that says why.
+
For behavior changes, first add a focused failing test, then make the smallest fix
and run the relevant checks. Keep the coverage thresholds. Ordinary tests use CPU
rendering and make no model calls. Live provider tests are optional and can spend
diff --git a/biome.json b/biome.json
index e1c893d7..4c544822 100644
--- a/biome.json
+++ b/biome.json
@@ -22,9 +22,15 @@
"enabled": true,
"rules": {
"preset": "recommended",
- "style": { "noNonNullAssertion": "off" },
- "complexity": { "useLiteralKeys": "off" },
- "suspicious": { "useIterableCallbackReturn": "warn" }
+ "style": { "noNonNullAssertion": "off", "useTemplate": "error" },
+ "complexity": { "useLiteralKeys": "off", "useOptionalChain": "error" },
+ "correctness": { "noUnusedImports": "error" },
+ "suspicious": {
+ "noApproximativeNumericConstant": "error",
+ "noExplicitAny": "error",
+ "noGlobalIsFinite": "error",
+ "useIterableCallbackReturn": "error"
+ }
}
},
"assist": { "enabled": false }
diff --git a/dist/agent-providers.mjs b/dist/agent-providers.mjs
index 0c25ea14..e1f97692 100644
--- a/dist/agent-providers.mjs
+++ b/dist/agent-providers.mjs
@@ -125,7 +125,7 @@ function makeOpenRouterModel(opts) {
}
var trimmedEnv = (k) => {
const v = process.env[k];
- return v && v.trim() ? v.trim() : undefined;
+ return v?.trim() ? v.trim() : undefined;
};
var META_MODEL_API_BASE_URL = "https://api.meta.ai/v1";
function metaApiKey(opts) {
diff --git a/dist/agent-run.mjs b/dist/agent-run.mjs
index 12107e67..8029d607 100644
--- a/dist/agent-run.mjs
+++ b/dist/agent-run.mjs
@@ -8281,7 +8281,7 @@ function inspectGeometryExport(root, policy = "warn") {
warnings.push(message);
};
const position = geometry.getAttribute("position");
- if (!position || position.itemSize !== 3)
+ if (position?.itemSize !== 3)
throw new TypeError(`${name}: position requires xyz vertices.`);
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const expected = EXPORTED_GEOMETRY_ATTRIBUTES[key];
@@ -20671,7 +20671,7 @@ function estimateGeometryTris(name, args) {
return null;
}
function asObjNum(node, prop) {
- if (!node || node.type !== "ObjectExpression")
+ if (node?.type !== "ObjectExpression")
return null;
for (const p of node.properties) {
if (p.type === "Property" && !p.computed && (p.key.type === "Identifier" && p.key.name === prop || p.key.type === "Literal" && p.key.value === prop)) {
@@ -21374,7 +21374,7 @@ function loopMultiplier(ancestors) {
if (node.type !== "ForStatement")
continue;
const f = node;
- if (!f.test || f.test.type !== "BinaryExpression")
+ if (f.test?.type !== "BinaryExpression")
continue;
const { operator, right } = f.test;
if (operator !== "<" && operator !== "<=")
@@ -24384,24 +24384,24 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
const prim = doc.createPrimitive().setMaterial(Array.isArray(material) ? material[0] : material);
const posAttr = geometry.getAttribute("position");
if (posAttr) {
- prim.setAttribute("POSITION", doc.createAccessor(meshName + "_pos").setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("POSITION", doc.createAccessor(`${meshName}_pos`).setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const normAttr = geometry.getAttribute("normal");
if (normAttr) {
- prim.setAttribute("NORMAL", doc.createAccessor(meshName + "_norm").setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("NORMAL", doc.createAccessor(`${meshName}_norm`).setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const uvAttr = geometry.getAttribute("uv");
if (uvAttr) {
- prim.setAttribute("TEXCOORD_0", doc.createAccessor(meshName + "_uv").setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
+ prim.setAttribute("TEXCOORD_0", doc.createAccessor(`${meshName}_uv`).setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
}
const tangentAttr = geometry.getAttribute("tangent");
if (tangentAttr?.itemSize === 4) {
- prim.setAttribute("TANGENT", doc.createAccessor(meshName + "_tangent").setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
+ prim.setAttribute("TANGENT", doc.createAccessor(`${meshName}_tangent`).setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
}
const indexAttr = geometry.getIndex();
if (indexAttr) {
const IndexArray = posAttr && posAttr.count > 65535 ? Uint32Array : Uint16Array;
- prim.setIndices(doc.createAccessor(meshName + "_idx").setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
+ prim.setIndices(doc.createAccessor(`${meshName}_idx`).setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
}
const mesh = doc.createMesh(meshName);
if (!Array.isArray(material))
@@ -24417,7 +24417,7 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
for (const semantic of prim.listSemantics())
part.setAttribute(semantic, prim.getAttribute(semantic));
const IndexArray = posAttr.count > 65535 ? Uint32Array : Uint16Array;
- part.setIndices(doc.createAccessor(meshName + "_group_indices").setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
+ part.setIndices(doc.createAccessor(`${meshName}_group_indices`).setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
mesh.addPrimitive(part);
covered += group.count;
}
@@ -24536,8 +24536,8 @@ function bridgeAnimations(doc, buf, clips, nodeMap, warnings) {
warnings.push(`Unsupported animation property "${property}" on "${nodeName}" - skipped`);
continue;
}
- const inputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_input").setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
- const outputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_output").setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
+ const inputAcc = doc.createAccessor(`${clip.name}_${nodeName}_input`).setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
+ const outputAcc = doc.createAccessor(`${clip.name}_${nodeName}_output`).setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
const sampler = doc.createAnimationSampler().setInput(inputAcc).setOutput(outputAcc).setInterpolation("LINEAR");
const channel = doc.createAnimationChannel().setTargetNode(targetNode).setTargetPath(targetPath).setSampler(sampler);
anim.addSampler(sampler);
@@ -24884,7 +24884,7 @@ function collectMeshStats(root) {
const idx = geo.getIndex();
const tri = idx ? idx.count / 3 : (geo.getAttribute("position")?.count ?? 0) / 3;
const box = new THREE34.Box3().setFromObject(obj);
- if (!isFinite(box.min.x) || !isFinite(box.max.x)) {
+ if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
const center = new THREE34.Vector3;
@@ -24977,7 +24977,7 @@ function inspectSceneStructure(root, opts = {}) {
}
}
const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
- floaters.push(`${a.name}${fix ? " —" + fix : ""}`);
+ floaters.push(`${a.name}${fix ? ` —${fix}` : ""}`);
}
if (floaters.length > 0) {
warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${floaters.join(" | ")}`);
@@ -25472,7 +25472,7 @@ function wrapComment(text, indent) {
const lines = [];
let line = "";
for (const w of words) {
- if (line && (indent + "// " + line + " " + w).length > WRAP) {
+ if (line && `${indent}// ${line} ${w}`.length > WRAP) {
lines.push(`${indent}// ${line}`);
line = w;
} else {
diff --git a/dist/build.json b/dist/build.json
index 94671e1c..46e1f691 100644
--- a/dist/build.json
+++ b/dist/build.json
@@ -2,10 +2,10 @@
"schemaVersion": 1,
"entries": {
"mcp": {
- "identity": "sha256:4b20a5bab1daba8a98eadff06f85481c9a196dabdaf75023db95482e59906842",
+ "identity": "sha256:20067475685459d0c4b30d1ca041536c6a4d0d2902ee6cd8ba13d45126283676",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "e78c388ec8e3eb3b197a458d3219254e739a85669c0e869aa34ebd296129b8a0",
+ "sourceHash": "8b119c3d8a847dc055b984ce299376e691ae8da52f262a014410c64e19e7ffa2",
"dependencyHash": "e7aeb48fd1c91bd7719fecea4ae771f611a1271c139c342634d7bf337608a20c",
"dependencies": {
"@gltf-transform/core": "4.5.0",
@@ -27,13 +27,13 @@
},
"target": "node",
"file": "mcp-server.mjs",
- "bundleHash": "sha256:bb502af9a18150fe0d204c5acc8318b689e322f903bb37af5484b793f69fdc2b"
+ "bundleHash": "sha256:230a45f97a246aba269162fe1b05e3064fa152336ddab2476602a060135fa271"
},
"cli": {
- "identity": "sha256:4b20a5bab1daba8a98eadff06f85481c9a196dabdaf75023db95482e59906842",
+ "identity": "sha256:20067475685459d0c4b30d1ca041536c6a4d0d2902ee6cd8ba13d45126283676",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "e78c388ec8e3eb3b197a458d3219254e739a85669c0e869aa34ebd296129b8a0",
+ "sourceHash": "8b119c3d8a847dc055b984ce299376e691ae8da52f262a014410c64e19e7ffa2",
"dependencyHash": "e7aeb48fd1c91bd7719fecea4ae771f611a1271c139c342634d7bf337608a20c",
"dependencies": {
"@gltf-transform/core": "4.5.0",
@@ -55,13 +55,13 @@
},
"target": "node",
"file": "cli.mjs",
- "bundleHash": "sha256:50befd6901deeed13a85257a9f5839cd80416aad4c8c512c1dbc9fdd7d68c73a"
+ "bundleHash": "sha256:00dbff6138a98d8cbe7510c433fc0466683fc317864464b820a963f8f0d21b9d"
},
"worker": {
- "identity": "sha256:4b20a5bab1daba8a98eadff06f85481c9a196dabdaf75023db95482e59906842",
+ "identity": "sha256:20067475685459d0c4b30d1ca041536c6a4d0d2902ee6cd8ba13d45126283676",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "e78c388ec8e3eb3b197a458d3219254e739a85669c0e869aa34ebd296129b8a0",
+ "sourceHash": "8b119c3d8a847dc055b984ce299376e691ae8da52f262a014410c64e19e7ffa2",
"dependencyHash": "e7aeb48fd1c91bd7719fecea4ae771f611a1271c139c342634d7bf337608a20c",
"dependencies": {
"@gltf-transform/core": "4.5.0",
@@ -83,13 +83,13 @@
},
"target": "node",
"file": "evaluator-worker.mjs",
- "bundleHash": "sha256:f2ec9893425aad50bb2717d0a4a3889c118421b211dda0062b7299812593d92c"
+ "bundleHash": "sha256:9237ea47c698a012f24762a27f44bb69fbecee8f5f25cc2317595b8d26bfd010"
},
"agent-run": {
- "identity": "sha256:4b20a5bab1daba8a98eadff06f85481c9a196dabdaf75023db95482e59906842",
+ "identity": "sha256:20067475685459d0c4b30d1ca041536c6a4d0d2902ee6cd8ba13d45126283676",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "e78c388ec8e3eb3b197a458d3219254e739a85669c0e869aa34ebd296129b8a0",
+ "sourceHash": "8b119c3d8a847dc055b984ce299376e691ae8da52f262a014410c64e19e7ffa2",
"dependencyHash": "e7aeb48fd1c91bd7719fecea4ae771f611a1271c139c342634d7bf337608a20c",
"dependencies": {
"@gltf-transform/core": "4.5.0",
@@ -111,13 +111,13 @@
},
"target": "node",
"file": "agent-run.mjs",
- "bundleHash": "sha256:fd52e9c43720b0017dd3d6c290e92d485a86e6c5a2d1dba50cb72215d6bf696c"
+ "bundleHash": "sha256:1aa43d4128308a4e720081b3f9e0903bc971e543273529ff3f1338d9ff2bceb0"
},
"agent-providers": {
- "identity": "sha256:4b20a5bab1daba8a98eadff06f85481c9a196dabdaf75023db95482e59906842",
+ "identity": "sha256:20067475685459d0c4b30d1ca041536c6a4d0d2902ee6cd8ba13d45126283676",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "e78c388ec8e3eb3b197a458d3219254e739a85669c0e869aa34ebd296129b8a0",
+ "sourceHash": "8b119c3d8a847dc055b984ce299376e691ae8da52f262a014410c64e19e7ffa2",
"dependencyHash": "e7aeb48fd1c91bd7719fecea4ae771f611a1271c139c342634d7bf337608a20c",
"dependencies": {
"@gltf-transform/core": "4.5.0",
@@ -139,7 +139,7 @@
},
"target": "node",
"file": "agent-providers.mjs",
- "bundleHash": "sha256:0a05d7630c6f7f1394ce7ecf063daae69c7137a364f9a975c595b39b35ac6eb5"
+ "bundleHash": "sha256:fb2295599724eaa739ef31919eccae0ff6adece4c36b6886863eb7eeacb35650"
}
}
}
diff --git a/dist/cli.mjs b/dist/cli.mjs
index ff62fe30..760736b4 100644
--- a/dist/cli.mjs
+++ b/dist/cli.mjs
@@ -10796,7 +10796,7 @@ function inspectGeometryExport(root, policy = "warn") {
warnings.push(message);
};
const position = geometry.getAttribute("position");
- if (!position || position.itemSize !== 3)
+ if (position?.itemSize !== 3)
throw new TypeError(`${name}: position requires xyz vertices.`);
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const expected = EXPORTED_GEOMETRY_ATTRIBUTES[key];
@@ -18874,7 +18874,7 @@ function estimateGeometryTris(name, args) {
return null;
}
function asObjNum(node, prop) {
- if (!node || node.type !== "ObjectExpression")
+ if (node?.type !== "ObjectExpression")
return null;
for (const p of node.properties) {
if (p.type === "Property" && !p.computed && (p.key.type === "Identifier" && p.key.name === prop || p.key.type === "Literal" && p.key.value === prop)) {
@@ -19577,7 +19577,7 @@ function loopMultiplier(ancestors) {
if (node.type !== "ForStatement")
continue;
const f = node;
- if (!f.test || f.test.type !== "BinaryExpression")
+ if (f.test?.type !== "BinaryExpression")
continue;
const { operator, right } = f.test;
if (operator !== "<" && operator !== "<=")
@@ -24350,24 +24350,24 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
const prim = doc.createPrimitive().setMaterial(Array.isArray(material) ? material[0] : material);
const posAttr = geometry.getAttribute("position");
if (posAttr) {
- prim.setAttribute("POSITION", doc.createAccessor(meshName + "_pos").setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("POSITION", doc.createAccessor(`${meshName}_pos`).setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const normAttr = geometry.getAttribute("normal");
if (normAttr) {
- prim.setAttribute("NORMAL", doc.createAccessor(meshName + "_norm").setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("NORMAL", doc.createAccessor(`${meshName}_norm`).setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const uvAttr = geometry.getAttribute("uv");
if (uvAttr) {
- prim.setAttribute("TEXCOORD_0", doc.createAccessor(meshName + "_uv").setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
+ prim.setAttribute("TEXCOORD_0", doc.createAccessor(`${meshName}_uv`).setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
}
const tangentAttr = geometry.getAttribute("tangent");
if (tangentAttr?.itemSize === 4) {
- prim.setAttribute("TANGENT", doc.createAccessor(meshName + "_tangent").setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
+ prim.setAttribute("TANGENT", doc.createAccessor(`${meshName}_tangent`).setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
}
const indexAttr = geometry.getIndex();
if (indexAttr) {
const IndexArray = posAttr && posAttr.count > 65535 ? Uint32Array : Uint16Array;
- prim.setIndices(doc.createAccessor(meshName + "_idx").setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
+ prim.setIndices(doc.createAccessor(`${meshName}_idx`).setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
}
const mesh = doc.createMesh(meshName);
if (!Array.isArray(material))
@@ -24383,7 +24383,7 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
for (const semantic of prim.listSemantics())
part.setAttribute(semantic, prim.getAttribute(semantic));
const IndexArray = posAttr.count > 65535 ? Uint32Array : Uint16Array;
- part.setIndices(doc.createAccessor(meshName + "_group_indices").setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
+ part.setIndices(doc.createAccessor(`${meshName}_group_indices`).setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
mesh.addPrimitive(part);
covered += group.count;
}
@@ -24502,8 +24502,8 @@ function bridgeAnimations(doc, buf, clips, nodeMap, warnings) {
warnings.push(`Unsupported animation property "${property}" on "${nodeName}" - skipped`);
continue;
}
- const inputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_input").setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
- const outputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_output").setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
+ const inputAcc = doc.createAccessor(`${clip.name}_${nodeName}_input`).setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
+ const outputAcc = doc.createAccessor(`${clip.name}_${nodeName}_output`).setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
const sampler = doc.createAnimationSampler().setInput(inputAcc).setOutput(outputAcc).setInterpolation("LINEAR");
const channel = doc.createAnimationChannel().setTargetNode(targetNode).setTargetPath(targetPath).setSampler(sampler);
anim.addSampler(sampler);
@@ -24860,7 +24860,7 @@ function collectMeshStats(root) {
const idx = geo.getIndex();
const tri = idx ? idx.count / 3 : (geo.getAttribute("position")?.count ?? 0) / 3;
const box = new THREE34.Box3().setFromObject(obj);
- if (!isFinite(box.min.x) || !isFinite(box.max.x)) {
+ if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
const center = new THREE34.Vector3;
@@ -24953,7 +24953,7 @@ function inspectSceneStructure(root, opts = {}) {
}
}
const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
- floaters.push(`${a.name}${fix ? " —" + fix : ""}`);
+ floaters.push(`${a.name}${fix ? ` —${fix}` : ""}`);
}
if (floaters.length > 0) {
warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${floaters.join(" | ")}`);
diff --git a/dist/evaluator-worker.mjs b/dist/evaluator-worker.mjs
index 827306cb..ca703ada 100644
--- a/dist/evaluator-worker.mjs
+++ b/dist/evaluator-worker.mjs
@@ -61,7 +61,7 @@ function inspectGeometryExport(root, policy = "warn") {
warnings.push(message);
};
const position = geometry.getAttribute("position");
- if (!position || position.itemSize !== 3)
+ if (position?.itemSize !== 3)
throw new TypeError(`${name}: position requires xyz vertices.`);
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const expected = EXPORTED_GEOMETRY_ATTRIBUTES[key];
@@ -22179,24 +22179,24 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
const prim = doc.createPrimitive().setMaterial(Array.isArray(material) ? material[0] : material);
const posAttr = geometry.getAttribute("position");
if (posAttr) {
- prim.setAttribute("POSITION", doc.createAccessor(meshName + "_pos").setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("POSITION", doc.createAccessor(`${meshName}_pos`).setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const normAttr = geometry.getAttribute("normal");
if (normAttr) {
- prim.setAttribute("NORMAL", doc.createAccessor(meshName + "_norm").setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("NORMAL", doc.createAccessor(`${meshName}_norm`).setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const uvAttr = geometry.getAttribute("uv");
if (uvAttr) {
- prim.setAttribute("TEXCOORD_0", doc.createAccessor(meshName + "_uv").setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
+ prim.setAttribute("TEXCOORD_0", doc.createAccessor(`${meshName}_uv`).setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
}
const tangentAttr = geometry.getAttribute("tangent");
if (tangentAttr?.itemSize === 4) {
- prim.setAttribute("TANGENT", doc.createAccessor(meshName + "_tangent").setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
+ prim.setAttribute("TANGENT", doc.createAccessor(`${meshName}_tangent`).setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
}
const indexAttr = geometry.getIndex();
if (indexAttr) {
const IndexArray = posAttr && posAttr.count > 65535 ? Uint32Array : Uint16Array;
- prim.setIndices(doc.createAccessor(meshName + "_idx").setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
+ prim.setIndices(doc.createAccessor(`${meshName}_idx`).setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
}
const mesh = doc.createMesh(meshName);
if (!Array.isArray(material))
@@ -22212,7 +22212,7 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
for (const semantic of prim.listSemantics())
part.setAttribute(semantic, prim.getAttribute(semantic));
const IndexArray = posAttr.count > 65535 ? Uint32Array : Uint16Array;
- part.setIndices(doc.createAccessor(meshName + "_group_indices").setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
+ part.setIndices(doc.createAccessor(`${meshName}_group_indices`).setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
mesh.addPrimitive(part);
covered += group.count;
}
@@ -22331,8 +22331,8 @@ function bridgeAnimations(doc, buf, clips, nodeMap, warnings) {
warnings.push(`Unsupported animation property "${property}" on "${nodeName}" - skipped`);
continue;
}
- const inputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_input").setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
- const outputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_output").setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
+ const inputAcc = doc.createAccessor(`${clip.name}_${nodeName}_input`).setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
+ const outputAcc = doc.createAccessor(`${clip.name}_${nodeName}_output`).setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
const sampler = doc.createAnimationSampler().setInput(inputAcc).setOutput(outputAcc).setInterpolation("LINEAR");
const channel = doc.createAnimationChannel().setTargetNode(targetNode).setTargetPath(targetPath).setSampler(sampler);
anim.addSampler(sampler);
@@ -22679,7 +22679,7 @@ function collectMeshStats(root) {
const idx = geo.getIndex();
const tri = idx ? idx.count / 3 : (geo.getAttribute("position")?.count ?? 0) / 3;
const box = new THREE34.Box3().setFromObject(obj);
- if (!isFinite(box.min.x) || !isFinite(box.max.x)) {
+ if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
const center = new THREE34.Vector3;
@@ -22772,7 +22772,7 @@ function inspectSceneStructure(root, opts = {}) {
}
}
const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
- floaters.push(`${a.name}${fix ? " —" + fix : ""}`);
+ floaters.push(`${a.name}${fix ? ` —${fix}` : ""}`);
}
if (floaters.length > 0) {
warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${floaters.join(" | ")}`);
diff --git a/dist/mcp-server.mjs b/dist/mcp-server.mjs
index 7b70781e..2b3a942b 100644
--- a/dist/mcp-server.mjs
+++ b/dist/mcp-server.mjs
@@ -4911,7 +4911,7 @@ function inspectGeometryExport(root, policy = "warn") {
warnings.push(message);
};
const position = geometry.getAttribute("position");
- if (!position || position.itemSize !== 3)
+ if (position?.itemSize !== 3)
throw new TypeError(`${name}: position requires xyz vertices.`);
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const expected = EXPORTED_GEOMETRY_ATTRIBUTES[key];
@@ -20508,7 +20508,7 @@ function estimateGeometryTris(name, args) {
return null;
}
function asObjNum(node, prop) {
- if (!node || node.type !== "ObjectExpression")
+ if (node?.type !== "ObjectExpression")
return null;
for (const p of node.properties) {
if (p.type === "Property" && !p.computed && (p.key.type === "Identifier" && p.key.name === prop || p.key.type === "Literal" && p.key.value === prop)) {
@@ -21211,7 +21211,7 @@ function loopMultiplier(ancestors) {
if (node.type !== "ForStatement")
continue;
const f = node;
- if (!f.test || f.test.type !== "BinaryExpression")
+ if (f.test?.type !== "BinaryExpression")
continue;
const { operator, right } = f.test;
if (operator !== "<" && operator !== "<=")
@@ -24618,24 +24618,24 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
const prim = doc.createPrimitive().setMaterial(Array.isArray(material) ? material[0] : material);
const posAttr = geometry.getAttribute("position");
if (posAttr) {
- prim.setAttribute("POSITION", doc.createAccessor(meshName + "_pos").setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("POSITION", doc.createAccessor(`${meshName}_pos`).setArray(geometryAttributeValues(posAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const normAttr = geometry.getAttribute("normal");
if (normAttr) {
- prim.setAttribute("NORMAL", doc.createAccessor(meshName + "_norm").setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
+ prim.setAttribute("NORMAL", doc.createAccessor(`${meshName}_norm`).setArray(geometryAttributeValues(normAttr)).setType(TYPE_VEC3).setBuffer(buf));
}
const uvAttr = geometry.getAttribute("uv");
if (uvAttr) {
- prim.setAttribute("TEXCOORD_0", doc.createAccessor(meshName + "_uv").setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
+ prim.setAttribute("TEXCOORD_0", doc.createAccessor(`${meshName}_uv`).setArray(geometryAttributeValues(uvAttr)).setType(TYPE_VEC2).setBuffer(buf));
}
const tangentAttr = geometry.getAttribute("tangent");
if (tangentAttr?.itemSize === 4) {
- prim.setAttribute("TANGENT", doc.createAccessor(meshName + "_tangent").setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
+ prim.setAttribute("TANGENT", doc.createAccessor(`${meshName}_tangent`).setArray(geometryAttributeValues(tangentAttr)).setType(TYPE_VEC4).setBuffer(buf));
}
const indexAttr = geometry.getIndex();
if (indexAttr) {
const IndexArray = posAttr && posAttr.count > 65535 ? Uint32Array : Uint16Array;
- prim.setIndices(doc.createAccessor(meshName + "_idx").setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
+ prim.setIndices(doc.createAccessor(`${meshName}_idx`).setArray(new IndexArray(indexAttr.array)).setType(TYPE_SCALAR).setBuffer(buf));
}
const mesh = doc.createMesh(meshName);
if (!Array.isArray(material))
@@ -24651,7 +24651,7 @@ function bridgeGeometry(doc, buf, geometry, material, meshName) {
for (const semantic of prim.listSemantics())
part.setAttribute(semantic, prim.getAttribute(semantic));
const IndexArray = posAttr.count > 65535 ? Uint32Array : Uint16Array;
- part.setIndices(doc.createAccessor(meshName + "_group_indices").setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
+ part.setIndices(doc.createAccessor(`${meshName}_group_indices`).setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count))).setType(TYPE_SCALAR).setBuffer(buf));
mesh.addPrimitive(part);
covered += group.count;
}
@@ -24770,8 +24770,8 @@ function bridgeAnimations(doc, buf, clips, nodeMap, warnings) {
warnings.push(`Unsupported animation property "${property}" on "${nodeName}" - skipped`);
continue;
}
- const inputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_input").setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
- const outputAcc = doc.createAccessor(clip.name + "_" + nodeName + "_output").setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
+ const inputAcc = doc.createAccessor(`${clip.name}_${nodeName}_input`).setArray(new Float32Array(track.times)).setType(TYPE_SCALAR).setBuffer(buf);
+ const outputAcc = doc.createAccessor(`${clip.name}_${nodeName}_output`).setArray(new Float32Array(track.values)).setType(valueType).setBuffer(buf);
const sampler = doc.createAnimationSampler().setInput(inputAcc).setOutput(outputAcc).setInterpolation("LINEAR");
const channel = doc.createAnimationChannel().setTargetNode(targetNode).setTargetPath(targetPath).setSampler(sampler);
anim.addSampler(sampler);
@@ -25128,7 +25128,7 @@ function collectMeshStats(root) {
const idx = geo.getIndex();
const tri = idx ? idx.count / 3 : (geo.getAttribute("position")?.count ?? 0) / 3;
const box = new THREE34.Box3().setFromObject(obj);
- if (!isFinite(box.min.x) || !isFinite(box.max.x)) {
+ if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
const center = new THREE34.Vector3;
@@ -25221,7 +25221,7 @@ function inspectSceneStructure(root, opts = {}) {
}
}
const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
- floaters.push(`${a.name}${fix ? " —" + fix : ""}`);
+ floaters.push(`${a.name}${fix ? ` —${fix}` : ""}`);
}
if (floaters.length > 0) {
warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${floaters.join(" | ")}`);
diff --git a/docs/plans/repo-size-and-r2-migration-2026-09-10.md b/docs/plans/repo-size-and-r2-migration-2026-09-10.md
index 83539294..05bf53c2 100644
--- a/docs/plans/repo-size-and-r2-migration-2026-09-10.md
+++ b/docs/plans/repo-size-and-r2-migration-2026-09-10.md
@@ -1574,7 +1574,7 @@ than for more care.
| 13.2 | Safe in-range dependency refresh, kept strictly separate from the deferred majors: `ai` 6.0.222 to 6.0.282, `openai` 6.46.0 to 6.49.0, `@ai-sdk/provider` 3.0.14 to 3.0.16, `@aws-sdk/client-bedrock-runtime` 3.1083.0 to 3.1131.0, and in `site/` react/react-dom 19.3.0 and vite 8.3.0 | **Done 2026-09-12.** Every other pin in the tree was already at latest. Two things came out of it. The `@types/three` rule generalized to every `@types/*` whose runtime the same manifest pins, which is what brought `@types/react` and `@types/react-dom` along with react 19.3 rather than leaving them a release line behind. And `check-toolchain.mjs` gained **its own test**: it takes `--root`, and each case stages a real copy of the repository's files, mutates one value, and asserts the gate names it. Three extensions had each been verified by hand once; nothing stopped a later edit from leaving a rule that could no longer fail |
| 13.3 | Raise the coverage ratchet from 92/91 to 94/92. Measured 95.27% functions / 92.49% lines, so this keeps roughly 1.3 and 0.5 points for normal churn | **Done 2026-09-12.** In absolute terms that is 42 functions and 224 lines of room, which is what the gate now prints -- a percentage says whether it passed, and turning that into work needs LCOV totals the person who tripped it does not have. The gate also refuses a threshold set above the baseline it records, and refuses a thresholds file that records no baseline: a threshold above anything ever measured fails in whatever change runs next and reads there as that change's regression |
| 13.4 | Promote the Windows job from `continue-on-error` to blocking | **Done 2026-09-12 in the repository; one GitHub setting outstanding.** Nine runs with the job: seven green, two red, no recurrence of the GLib fault, and four consecutive greens including two on main. Both reds were this session's own new code and both were real Windows-only defects, which is the argument for blocking. Given a 30-minute bound, since a blocking job that hangs is a blocked merge. A test now rejects `continue-on-error` at job level so this cannot be demoted by one line. **Outstanding:** main's branch protection lists only `typecheck . lint . test`, so a red Windows run fails the workflow and still permits the merge until the Windows context is added there |
-| 13.5 | Clear the one substantive lint finding: an unused import in `src/__tests__/optimize.test.ts`. Everything else in the 14/11 baseline is `useTemplate` and `useOptionalChain` style | Approved, not started |
+| 13.5 | Clear the one substantive lint finding: an unused import in `src/__tests__/optimize.test.ts`. Everything else in the 14/11 baseline is `useTemplate` and `useOptionalChain` style | **Done 2026-09-12, wider than written.** The 14/11 split was not all style: `isFinite` in the render inspector was the coercing global, `forEach` in the Bradley-Terry fit returned a value its callback discards, and three `any` bounds in `buildSandboxGlobals` were guarded by `eslint-disable` comments in a repository that lints with Biome and has no ESLint config -- suppressing nothing while reading as accepted. All 25 findings are fixed and the tree reports zero. `lint` now runs `--error-on-warnings`, and since that does not reach Biome's info severity the seven rules involved carry an explicit `error`; each was verified by reintroducing its defect. A baseline kept in prose is one the next finding arrives invisible against, which is why this went past the single unused import |
| 13.6 | Decide shadows by comparison, not assumption. r186 deleted the `PCFSoftShadowMap` implementation; `render-service` now names `PCFShadowMap`, and `VSMShadowMap` is the soft filter that survives. Render gallery presets under both and choose by eye, because this is the only user-visible regression in the r186 upgrade and it lands on marketing surface | Approved, not started |
### Explicitly not in this phase
diff --git a/package.json b/package.json
index 8a8c21ff..6a37fa4b 100644
--- a/package.json
+++ b/package.json
@@ -100,7 +100,7 @@
"test:coverage": "KILN_SPIKE_LIVE=0 KILN_RENDER=cpu bun test src scripts --coverage && bun scripts/check-coverage.mjs",
"test:live": "KILN_SPIKE_LIVE=1 bun test",
"test:package": "node scripts/test-plugin-package.mjs && node scripts/smoke-package.mjs",
- "lint": "biome check .",
+ "lint": "biome check --error-on-warnings .",
"verify:posters": "bun scripts/verify-posters.mjs",
"site:assets": "cd site && bun scripts/build-assets.mjs",
"site:skills": "cd site && bun scripts/build-skills-discovery.mjs",
diff --git a/scripts/reliability.test.mjs b/scripts/reliability.test.mjs
index 8c752bed..55ef37e2 100644
--- a/scripts/reliability.test.mjs
+++ b/scripts/reliability.test.mjs
@@ -49,6 +49,29 @@ describe('repository reliability contracts', () => {
expect(pkg.scripts['test:coverage']).toBe(
'KILN_SPIKE_LIVE=0 KILN_RENDER=cpu bun test src scripts --coverage && bun scripts/check-coverage.mjs',
);
+ // A warning baseline is a number kept in prose that everyone agrees to ignore, and
+ // the twenty-sixth finding arrives invisible. The tree reports nothing, so the flag
+ // that makes a warning fatal is part of the contract rather than a preference.
+ expect(pkg.scripts['lint']).toBe('biome check --error-on-warnings .');
+ // `--error-on-warnings` does not cover Biome's info severity, which is where several
+ // of these sit by default, so the rules this repository has actually cleaned carry an
+ // explicit `error`. Asserted rather than trusted because the downgrade has happened
+ // here before: `useIterableCallbackReturn` was pinned to `warn` around a single
+ // finding, and a rule quietly lowered to keep a build green is indistinguishable from
+ // a rule nobody wanted.
+ const biome = JSON.parse(await readText('biome.json'));
+ const severities = Object.assign({}, ...Object.values(biome.linter.rules).filter((group) => typeof group === 'object'));
+ for (const rule of [
+ 'useTemplate',
+ 'useOptionalChain',
+ 'noUnusedImports',
+ 'noApproximativeNumericConstant',
+ 'noExplicitAny',
+ 'noGlobalIsFinite',
+ 'useIterableCallbackReturn',
+ ]) {
+ expect(severities[rule], `${rule} must stay at error`).toBe('error');
+ }
// Views must be byte-reproducible: a runner that happens to reach a GPU render
// service must not be able to change what the golden-image tests compare.
expect(pkg.scripts['test']).toContain('KILN_RENDER=cpu');
diff --git a/src/__tests__/optimize.test.ts b/src/__tests__/optimize.test.ts
index 3f8e19fe..3fef2992 100644
--- a/src/__tests__/optimize.test.ts
+++ b/src/__tests__/optimize.test.ts
@@ -18,7 +18,6 @@ import {
createInstance,
createPivot,
boxGeo,
- cylinderGeo,
gameMaterial,
glassMaterial,
} from '../primitives';
@@ -130,10 +129,12 @@ describe('optimize=full (static-only; auto-degrade on animation)', () => {
parent: hub,
});
}
+ // Identity, then a quarter turn about Y: (0, sin 45deg, 0, cos 45deg). `Math.SQRT1_2`
+ // rather than 0.7071 -- exact, and it says which angle this is.
const track = new THREE.QuaternionKeyframeTrack(
'Joint_Spin.quaternion',
[0, 1],
- [0, 0, 0, 1, 0, 0.7071, 0, 0.7071],
+ [0, 0, 0, 1, 0, Math.SQRT1_2, 0, Math.SQRT1_2],
);
const clip = new THREE.AnimationClip('spin', 1, [track]);
diff --git a/src/__tests__/program-tools.test.ts b/src/__tests__/program-tools.test.ts
index b6188cac..e241c5ac 100644
--- a/src/__tests__/program-tools.test.ts
+++ b/src/__tests__/program-tools.test.ts
@@ -111,7 +111,7 @@ describe('program references', () => {
it('pages source without loss and bounds search results', async () => {
const store = new MemoryProgramStore();
- const source = 'α'.repeat(20000) + '\nneedle\n' + 'z'.repeat(20000);
+ const source = `${'α'.repeat(20000)}\nneedle\n${'z'.repeat(20000)}`;
const ref = await store.put(source);
const tool = createKilnProgramToolRegistry({ programStore: store }).find(
(d) => d.name === 'kiln_source',
diff --git a/src/agent/providers.ts b/src/agent/providers.ts
index 422feabf..fb62e94f 100644
--- a/src/agent/providers.ts
+++ b/src/agent/providers.ts
@@ -207,7 +207,7 @@ export interface MakeKilnModelOptions {
const trimmedEnv = (k: string): string | undefined => {
const v = process.env[k];
- return v && v.trim() ? v.trim() : undefined;
+ return v?.trim() ? v.trim() : undefined;
};
const META_MODEL_API_BASE_URL = 'https://api.meta.ai/v1';
diff --git a/src/arena/bradley-terry.ts b/src/arena/bradley-terry.ts
index e7e66679..9fe0a697 100644
--- a/src/arena/bradley-terry.ts
+++ b/src/arena/bradley-terry.ts
@@ -83,8 +83,9 @@ export function fitBradleyTerry(
}
const ids = [...idSet].sort(); // sort -> deterministic indexing
const n = ids.length;
- const index = new Map<string, number>();
- ids.forEach((id, i) => index.set(id, i));
+ // Built from the pairs rather than filled by forEach: `Map#set` returns the map, so
+ // the one-expression arrow returned a value the callback's contract discards.
+ const index = new Map<string, number>(ids.map((id, i): [string, number] => [id, i]));
// Pairwise comparison counts and per-item win/game tallies.
// pairCount[i][j] = number of comparisons between i and j (symmetric).
diff --git a/src/geometry-export.ts b/src/geometry-export.ts
index 92384d2b..e62e77c5 100644
--- a/src/geometry-export.ts
+++ b/src/geometry-export.ts
@@ -38,8 +38,7 @@ export function inspectGeometryExport(
warnings.push(message);
};
const position = geometry.getAttribute('position');
- if (!position || position.itemSize !== 3)
- throw new TypeError(`${name}: position requires xyz vertices.`);
+ if (position?.itemSize !== 3) throw new TypeError(`${name}: position requires xyz vertices.`);
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const expected = EXPORTED_GEOMETRY_ATTRIBUTES[key];
if (expected === undefined) {
diff --git a/src/primitives.ts b/src/primitives.ts
index 4ea4276f..7effe608 100644
--- a/src/primitives.ts
+++ b/src/primitives.ts
@@ -1672,12 +1672,15 @@ export function buildSandboxGlobals(
// CSG ops remain lazy at their own call sites, so importing the wrapper here
// is safe for Node ESM builds and still avoids manifold WASM init unless used.
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const wrap = <F extends (...args: any[]) => any>(name: string, fn: F): F => {
+ const wrap = <F extends (...args: never[]) => unknown>(name: string, fn: F): F => {
if (!usage) return fn;
const wrapped = (...args: Parameters<F>): ReturnType<F> => {
usage[name] = (usage[name] ?? 0) + 1;
- return fn(...args);
+ // `fn` IS an F, so this genuinely returns `ReturnType<F>`; tsc resolves the call
+ // through F's constraint and sees only `unknown`. The assertion states what holds
+ // by construction, and is narrower than typing the bound as `any`, which would
+ // silence the whole expression instead of this one step.
+ return fn(...args) as ReturnType<F>;
};
return wrapped as F;
};
@@ -1719,8 +1722,10 @@ export function buildSandboxGlobals(
],
};
};
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const cacheGeo = <F extends (...args: any[]) => THREE.BufferGeometry>(name: string, fn: F): F => {
+ const cacheGeo = <F extends (...args: never[]) => THREE.BufferGeometry>(
+ name: string,
+ fn: F,
+ ): F => {
const memoFn = (...args: Parameters<F>): THREE.BufferGeometry => {
let key: string;
try {
@@ -1745,8 +1750,7 @@ export function buildSandboxGlobals(
// Compose: usage tracking (outer) + memoisation (inner). A cache hit
// still ticks the usage counter so the telemetry reflects what the
// agent wrote, not what was recomputed.
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const wrapGeo = <F extends (...args: any[]) => THREE.BufferGeometry>(name: string, fn: F): F =>
+ const wrapGeo = <F extends (...args: never[]) => THREE.BufferGeometry>(name: string, fn: F): F =>
wrap(name, cacheGeo(name, fn));
const loadApprovedTexture = (...args: unknown[]): Promise<THREE.DataTexture> => {
diff --git a/src/prompt-api.ts b/src/prompt-api.ts
index cdd2d148..c9dd1cf1 100644
--- a/src/prompt-api.ts
+++ b/src/prompt-api.ts
@@ -58,7 +58,7 @@ function wrapComment(text: string, indent: string): string[] {
const lines: string[] = [];
let line = '';
for (const w of words) {
- if (line && (indent + '// ' + line + ' ' + w).length > WRAP) {
+ if (line && `${indent}// ${line} ${w}`.length > WRAP) {
lines.push(`${indent}// ${line}`);
line = w;
} else {
diff --git a/src/render.ts b/src/render.ts
index a7350226..b8a0adf1 100644
--- a/src/render.ts
+++ b/src/render.ts
@@ -572,7 +572,7 @@ function bridgeGeometry(
prim.setAttribute(
'POSITION',
doc
- .createAccessor(meshName + '_pos')
+ .createAccessor(`${meshName}_pos`)
.setArray(geometryAttributeValues(posAttr))
.setType(TYPE_VEC3)
.setBuffer(buf),
@@ -584,7 +584,7 @@ function bridgeGeometry(
prim.setAttribute(
'NORMAL',
doc
- .createAccessor(meshName + '_norm')
+ .createAccessor(`${meshName}_norm`)
.setArray(geometryAttributeValues(normAttr))
.setType(TYPE_VEC3)
.setBuffer(buf),
@@ -596,7 +596,7 @@ function bridgeGeometry(
prim.setAttribute(
'TEXCOORD_0',
doc
- .createAccessor(meshName + '_uv')
+ .createAccessor(`${meshName}_uv`)
.setArray(geometryAttributeValues(uvAttr))
.setType(TYPE_VEC2)
.setBuffer(buf),
@@ -608,7 +608,7 @@ function bridgeGeometry(
prim.setAttribute(
'TANGENT',
doc
- .createAccessor(meshName + '_tangent')
+ .createAccessor(`${meshName}_tangent`)
.setArray(geometryAttributeValues(tangentAttr))
.setType(TYPE_VEC4)
.setBuffer(buf),
@@ -623,7 +623,7 @@ function bridgeGeometry(
const IndexArray = posAttr && posAttr.count > 65535 ? Uint32Array : Uint16Array;
prim.setIndices(
doc
- .createAccessor(meshName + '_idx')
+ .createAccessor(`${meshName}_idx`)
.setArray(new IndexArray(indexAttr.array))
.setType(TYPE_SCALAR)
.setBuffer(buf),
@@ -658,7 +658,7 @@ function bridgeGeometry(
const IndexArray = posAttr!.count > 65535 ? Uint32Array : Uint16Array;
part.setIndices(
doc
- .createAccessor(meshName + '_group_indices')
+ .createAccessor(`${meshName}_group_indices`)
.setArray(new IndexArray(indexValues.slice(group.start, group.start + group.count)))
.setType(TYPE_SCALAR)
.setBuffer(buf),
@@ -832,13 +832,13 @@ function bridgeAnimations(
}
const inputAcc = doc
- .createAccessor(clip.name + '_' + nodeName + '_input')
+ .createAccessor(`${clip.name}_${nodeName}_input`)
.setArray(new Float32Array(track.times))
.setType(TYPE_SCALAR)
.setBuffer(buf);
const outputAcc = doc
- .createAccessor(clip.name + '_' + nodeName + '_output')
+ .createAccessor(`${clip.name}_${nodeName}_output`)
.setArray(new Float32Array(track.values))
.setType(valueType)
.setBuffer(buf);
@@ -2197,7 +2197,7 @@ function collectMeshStats(root: THREE.Object3D): MeshStats[] {
const tri = idx ? idx.count / 3 : (geo.getAttribute('position')?.count ?? 0) / 3;
const box = new THREE.Box3().setFromObject(obj);
- if (!isFinite(box.min.x) || !isFinite(box.max.x)) {
+ if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
const center = new THREE.Vector3();
@@ -2334,7 +2334,7 @@ export function inspectSceneStructure(
nearest && nearestGap
? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.`
: '';
- floaters.push(`${a.name}${fix ? ' —' + fix : ''}`);
+ floaters.push(`${a.name}${fix ? ` —${fix}` : ''}`);
}
if (floaters.length > 0) {
warnings.push(
diff --git a/src/validation.ts b/src/validation.ts
index a35ca0c7..8cf84cb3 100644
--- a/src/validation.ts
+++ b/src/validation.ts
@@ -96,7 +96,7 @@ function estimateGeometryTris(name: string, args: readonly acorn.Expression[]):
/** Numeric property off an options-object literal arg (e.g. gearGeo({ teeth: 16 })). */
function asObjNum(node: acorn.Expression | undefined, prop: string): number | null {
- if (!node || node.type !== 'ObjectExpression') return null;
+ if (node?.type !== 'ObjectExpression') return null;
for (const p of node.properties) {
if (
p.type === 'Property' &&
@@ -1132,7 +1132,7 @@ function loopMultiplier(ancestors: readonly acorn.Node[]): number {
for (const node of ancestors) {
if (node.type !== 'ForStatement') continue;
const f = node as acorn.ForStatement;
- if (!f.test || f.test.type !== 'BinaryExpression') continue;
+ if (f.test?.type !== 'BinaryExpression') continue;
const { operator, right } = f.test;
if (operator !== '<' && operator !== '<=') continue;
if (right.type !== 'Literal' || typeof right.value !== 'number') continue;