mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
feat: ban useVirtualList from @vueuse/core via ESLint (#10643)
## Summary
Add ESLint `no-restricted-imports` rule to prevent usage of
`useVirtualList` from `@vueuse/core`.
## Changes
- **What**: New ESLint config block banning `useVirtualList` in
`**/*.{ts,vue}` files. The team standardized on TanStack Virtual (via
Reka UI virtualizer or `@tanstack/vue-virtual`) for all virtualization.
`useVirtualList` requires uniform item heights and is no longer desired.
This is a preventive ban — no existing usage exists.
## Review Focus
Straightforward lint rule addition following the existing
`no-restricted-imports` pattern in `eslint.config.ts`.
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-10643-feat-ban-useVirtualList-from-vueuse-core-via-ESLint-3316d73d365081d5adf0ec926aab6e28)
by [Unito](https://www.unito.io)
---------
Co-authored-by: Benjamin Lu <benjaminlu1107@gmail.com>
This commit is contained in:
@@ -64,6 +64,13 @@ const commonParserOptions = {
|
||||
extraFileExtensions
|
||||
} as const
|
||||
|
||||
const useVirtualListRestriction = {
|
||||
name: '@vueuse/core',
|
||||
importNames: ['useVirtualList'],
|
||||
message:
|
||||
'useVirtualList requires uniform item heights. Use TanStack Virtual (via Reka UI virtualizer or @tanstack/vue-virtual) instead.'
|
||||
} as const
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
ignores: [
|
||||
@@ -378,7 +385,8 @@ export default defineConfig([
|
||||
importNames: ['t', 'd', 'te'],
|
||||
message:
|
||||
"In Vue components, use `const { t } = useI18n()` instead of importing from '@/i18n'."
|
||||
}
|
||||
},
|
||||
useVirtualListRestriction
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -398,10 +406,23 @@ export default defineConfig([
|
||||
importNames: ['useI18n'],
|
||||
message:
|
||||
"useI18n() requires Vue setup context. Use `import { t } from '@/i18n'` instead."
|
||||
}
|
||||
},
|
||||
useVirtualListRestriction
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
// Preserve the useVirtualList ban for files excluded from the useI18n rule.
|
||||
{
|
||||
files: ['**/use[A-Z]*.ts', '**/*.test.ts', 'src/i18n.ts'],
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [useVirtualListRestriction]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user