Comfy-Org / Comfy-Org/ComfyUI_frontend

CI guard: lint rule banning bare `string` typings for `nodeId` parameters

Open
#11,844 0 comments 0 reactions 0 assignees View on GitHub
area:CI/CD developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

Follow-up to #11428 (canonical type landed in #11839, sweeps tracked in #11840 / #11841 / #11842 / [components issue]).

Once the sweep PRs land, add a lint rule (custom ESLint rule, \`no-restricted-syntax\`, or similar) that flags bare \`string\` / \`number | string\` typings on parameters/fields named \`nodeId\` or \`node_id\`. Goal: prevent regression and keep the canonical \`NodeId\` type from drifting back into ad-hoc \`string\` declarations.

## Suggested approach

A \`no-restricted-syntax\` rule can match \`TSPropertySignature\` and \`Identifier\` parameters with \`name === 'nodeId'\` and a \`TSStringKeyword\` annotation, with a message pointing contributors to import \`NodeId\` from \`@/lib/litegraph/src/LGraphNode\`.

A custom rule (in \`tools/eslint-rules/\` or similar) gives a cleaner message and is preferable if the project already has custom rules.

## Acceptance

- [ ] Rule lands behind a meaningful name (e.g. \`comfyui/use-canonical-node-id\`)
- [ ] Allow-list for the renderer's intentionally-narrower \`NodeId = string\` declarations in \`src/renderer/core/layout/types.ts\`
- [ ] Documentation comment in the rule pointing to #11428
- [ ] \`pnpm lint\` passes on \`main\` after the sweep PRs land

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11844-CI-guard-lint-rule-banning-bare-string-typings-for-nodeId-parameters-3546d73d365081318375fcc70cf59126) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Research direction

Start by inspecting tools/eslint-rules/ or the existing ESLint configuration, then review the renderer exception in src/renderer/core/layout/types.ts. Define the canonical nodeId rule with its #11428 documentation comment and allow-list, and run pnpm lint after the sweep PRs land to confirm the guard passes on main.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, typescript
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.