Skip to content

AI-native design editor. Open-source Figma alternative.

fix(lint): resolve all linting warnings and errors

Danila Poyarkovd2d6a8944823
diff --git a/packages/core/src/design-jsx/render.ts b/packages/core/src/design-jsx/render.ts
index 589d314dc..930b869c2 100644
--- a/packages/core/src/design-jsx/render.ts
+++ b/packages/core/src/design-jsx/render.ts
@@ -36,6 +36,7 @@ export function buildComponent(jsxString: string): () => unknown {
code = transform(`${aliases}\nreturn function __render() { return <>${trimmed}</> }`, opts).code
}
+ // eslint-disable-next-line typescript-eslint/no-implied-eval -- sucrase output must be evaluated at runtime
return new Function('React', code)(React) as () => unknown
}
diff --git a/packages/core/src/editor/nodes.ts b/packages/core/src/editor/nodes.ts
index f525ff512..bd65ee92b 100644
--- a/packages/core/src/editor/nodes.ts
+++ b/packages/core/src/editor/nodes.ts
@@ -205,8 +205,8 @@ export function createNodeActions(ctx: EditorContext) {
if (!nudgeOriginals) {
nudgeOriginals = new Map()
for (const id of movable) {
- const node = ctx.graph.getNode(id)!
- nudgeOriginals.set(id, { x: node.x, y: node.y })
+ const node = ctx.graph.getNode(id)
+ if (node) nudgeOriginals.set(id, { x: node.x, y: node.y })
}
}
diff --git a/packages/core/src/figma-api/index.ts b/packages/core/src/figma-api/index.ts
index 5978d2b3a..dc22f011d 100644
--- a/packages/core/src/figma-api/index.ts
+++ b/packages/core/src/figma-api/index.ts
@@ -384,7 +384,7 @@ export class FigmaAPI implements NodeProxyHost {
}
notify(message: string): { cancel: () => void } {
- if (typeof console !== 'undefined') console.log(`[figma.notify] ${message}`)
+ if (typeof console !== 'undefined') console.warn(`[figma.notify] ${message}`)
// eslint-disable-next-line no-empty-function
return { cancel() {} }
}
diff --git a/packages/core/src/scene-graph/index.ts b/packages/core/src/scene-graph/index.ts
index 2ea633130..817f142bc 100644
--- a/packages/core/src/scene-graph/index.ts
+++ b/packages/core/src/scene-graph/index.ts
@@ -811,8 +811,9 @@ export class SceneGraph {
if (cached) return cached
const node = this.getNode(id)
+ if (!node) return { x: 0, y: 0 }
- const result = getAbsolutePosition(node!, this)
+ const result = getAbsolutePosition(node, this)
this.absPosCache.set(id, result)
return result
}
diff --git a/packages/mcp/src/stdio.ts b/packages/mcp/src/stdio.ts
index 929261ed4..b3598d9ab 100644
--- a/packages/mcp/src/stdio.ts
+++ b/packages/mcp/src/stdio.ts
@@ -32,7 +32,11 @@ function connect() {
ws.on('message', (raw) => {
try {
- const msg = JSON.parse(String(raw)) as {
+ let text: string
+ if (Buffer.isBuffer(raw)) text = raw.toString('utf8')
+ else if (Array.isArray(raw)) text = Buffer.concat(raw).toString('utf8')
+ else text = Buffer.from(raw).toString('utf8')
+ const msg = JSON.parse(text) as {
type: string
id?: string
token?: string
diff --git a/src/automation/server.ts b/src/automation/server.ts
index 51434346a..547ecb168 100644
--- a/src/automation/server.ts
+++ b/src/automation/server.ts
@@ -211,7 +211,7 @@ export function connectAutomation(getStore: () => EditorStore, authToken: string
}
ws.onopen = () => {
- console.log('[Automation] WebSocket connected to MCP server')
+ console.debug('[Automation] WebSocket connected to MCP server')
ws?.send(JSON.stringify({ type: 'register', token }))
}