fix(lint): resolve all linting warnings and errors

- scene-graph: replace non-null assertion with guard
- figma-api: console.log → console.warn for notify()
- editor/nodes: replace non-null assertion with guard
- automation/server: console.log → console.debug
- mcp/stdio: proper Buffer/ArrayBuffer/Buffer[] UTF-8 decoding
- design-jsx/render: suppress no-implied-eval for Function constructor

0 warnings, 0 errors.
This commit is contained in:
Danila Poyarkov 2026-04-22 18:01:52 +03:00
parent 84c5e0dded
commit d2d6a89448
6 changed files with 12 additions and 6 deletions

View file

@ -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
}

View file

@ -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 })
}
}

View file

@ -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() {} }
}

View file

@ -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
}

View file

@ -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

View file

@ -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 }))
}