mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 17:03:15 +00:00
fix(deps): narrow Lucide icon types and lower the lint baseline
Keep the typed icon lookup aligned with the runtime namespace and record the three removed test assertions.
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
},
|
||||
"tests": {
|
||||
"@typescript-eslint/no-explicit-any": 484,
|
||||
"@typescript-eslint/no-non-null-assertion": 1848,
|
||||
"@typescript-eslint/no-non-null-assertion": 1845,
|
||||
"@typescript-eslint/no-misused-promises": 22,
|
||||
"@typescript-eslint/no-unused-vars": 48,
|
||||
"@typescript-eslint/no-floating-promises": 33,
|
||||
|
||||
@@ -4,9 +4,17 @@ import * as LucideIcons from 'lucide-react';
|
||||
import { legacyLucideIcons } from './legacyLucideIcons';
|
||||
|
||||
const icons = Object.create(null) as Record<string, LucideIcon | undefined>;
|
||||
const forwardRef = Symbol.for('react.forward_ref');
|
||||
|
||||
for (const [name, component] of Object.entries(LucideIcons)) {
|
||||
if (/^[A-Z][A-Za-z0-9]*$/.test(name) && name !== 'Icon' && typeof component === 'object' && component !== null) {
|
||||
for (const [name, component] of Object.entries<unknown>(LucideIcons)) {
|
||||
if (
|
||||
/^[A-Z][A-Za-z0-9]*$/.test(name) &&
|
||||
name !== 'Icon' &&
|
||||
typeof component === 'object' &&
|
||||
component !== null &&
|
||||
'$$typeof' in component &&
|
||||
component.$$typeof === forwardRef
|
||||
) {
|
||||
icons[name] = component as LucideIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ function serialize(node: unknown): string {
|
||||
return `<${type}${serializeProps(props)}>${serialize(props.children)}</${type}>`
|
||||
}
|
||||
if (type === Icon && props.icon) {
|
||||
return serializeLucideIcon(props as LucideElementProps)
|
||||
return serializeLucideIcon({ ...props, icon: props.icon as LucideIconData })
|
||||
}
|
||||
if (typeof type === 'object' && type !== null && (type as ForwardRefComponent).$$typeof === FORWARD_REF) {
|
||||
return serialize((type as ForwardRefComponent).render(props, null))
|
||||
|
||||
Reference in New Issue
Block a user