mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
fix: resolve all lint warnings (#9972)
Resolve all lint warnings (3 oxlint + 1 eslint). ## Changes - Replace `it.todo` with `it.skip` in subgraph tests (`warn-todo`) - Move `vi.mock` to top-level in `firebaseAuthStore.test.ts` (`hoisted-apis-on-top`) - Rename `DOMPurify` default import to `dompurify` (`no-named-as-default`) --- ### The Villager Who Ignored the Warnings Once there lived a villager whose compiler whispered of lint. "They are only *warnings*," she said, and went about her day. One warning became three. Three became thirty. The yellow text grew like ivy across the terminal, until no one could tell the warnings from the errors. One morning a real error appeared — a misplaced mock, a shadowed import — but nobody noticed, for the village had long since learned to stop reading. The build shipped. The users wept. And the warning, faithful to the last, sat quietly in the log where it had always been. *Moral: Today's warning is tomorrow's incident report.* ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9972-fix-resolve-all-lint-warnings-3246d73d3650810a89cde5d05e79d948) by [Unito](https://www.unito.io) Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import DOMPurify from 'dompurify'
|
||||
import dompurify from 'dompurify'
|
||||
|
||||
import type {
|
||||
ContextMenuDivElement,
|
||||
@@ -16,7 +16,7 @@ const ALLOWED_STYLE_PROPS = new Set([
|
||||
'border-left'
|
||||
])
|
||||
|
||||
DOMPurify.addHook('uponSanitizeAttribute', (_node, data) => {
|
||||
dompurify.addHook('uponSanitizeAttribute', (_node, data) => {
|
||||
if (data.attrName === 'style') {
|
||||
const sanitizedStyle = data.attrValue
|
||||
.split(';')
|
||||
@@ -33,7 +33,7 @@ DOMPurify.addHook('uponSanitizeAttribute', (_node, data) => {
|
||||
})
|
||||
|
||||
function sanitizeMenuHTML(html: string): string {
|
||||
return DOMPurify.sanitize(html, {
|
||||
return dompurify.sanitize(html, {
|
||||
ALLOWED_TAGS,
|
||||
ALLOWED_ATTR: ['style']
|
||||
})
|
||||
|
||||
@@ -206,7 +206,7 @@ describe.skip('Subgraph Serialization', () => {
|
||||
})
|
||||
|
||||
describe.skip('Subgraph Known Issues', () => {
|
||||
it.todo('should enforce MAX_NESTED_SUBGRAPHS limit', () => {
|
||||
it.skip('should enforce MAX_NESTED_SUBGRAPHS limit', () => {
|
||||
// This test documents that MAX_NESTED_SUBGRAPHS = 1000 is defined
|
||||
// but not actually enforced anywhere in the code.
|
||||
//
|
||||
|
||||
@@ -48,7 +48,7 @@ describe.skip('SubgraphEdgeCases - Recursion Detection', () => {
|
||||
expect(firstLevel.isSubgraphNode()).toBe(true)
|
||||
})
|
||||
|
||||
it.todo('should use WeakSet for cycle detection', () => {
|
||||
it.skip('should use WeakSet for cycle detection', () => {
|
||||
// TODO: This test is currently skipped because cycle detection has a bug
|
||||
// The fix is to pass 'visited' directly instead of 'new Set(visited)' in SubgraphNode.ts:299
|
||||
const subgraph = createTestSubgraph({ nodeCount: 1 })
|
||||
|
||||
@@ -98,6 +98,7 @@ vi.mock('@/stores/toastStore', () => ({
|
||||
|
||||
// Mock useDialogService
|
||||
vi.mock('@/services/dialogService')
|
||||
vi.mock('@/platform/distribution/types', () => mockDistributionTypes)
|
||||
|
||||
// Mock apiKeyAuthStore
|
||||
const mockApiKeyGetAuthHeader = vi.fn().mockReturnValue(null)
|
||||
@@ -185,7 +186,6 @@ describe('useFirebaseAuthStore', () => {
|
||||
describe('token refresh events', () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules()
|
||||
vi.mock('@/platform/distribution/types', () => mockDistributionTypes)
|
||||
|
||||
vi.mocked(firebaseAuth.onIdTokenChanged).mockImplementation(
|
||||
(_auth, callback) => {
|
||||
|
||||
Reference in New Issue
Block a user