规则概览
Lynx Doctor 规则来自 Lynx 社区 skills 的可执行化整理。规则包含一级 category 和二级 subcategory。
CLI 的 category 使用一级领域:reactlynx、lynx-ui、rspeedy 或 lynx-css。
reactlynx
Source skill:reactlynx-best-practices
Additional sources: lynx-typescript · lynx-api-docs
threading
reactlynx/background-only-api:检测不在明确 background-only 上下文中的lynx.getJSModule和NativeModules。
lifecycle
reactlynx/avoid-use-layout-effect:标记useLayoutEffect,它在 ReactLynx 中不具备 React DOM 的同步布局语义。
events
reactlynx/main-thread-handler-directive:检查main-thread:*事件 handler 是否指向带顶层"main thread"directive 的函数。
configuration
reactlynx/global-props-event-mode:当globalPropsMode为event时,直接读取lynx.__globalProps且没有使用useGlobalPropsChanged会触发 warning。reactlynx/typescript-jsx-import-source:检查tsconfig.json中 ReactLynx 和 Rspeedy 需要的jsxImportSource与isolatedModules设置。reactlynx/types-package-missing:提示 ReactLynx package 没有声明@lynx-js/types。
performance
reactlynx/lazy-without-suspense:检测同文件中没有明显Suspense边界的 lazy component loading。
elements 和 packaging
reactlynx/no-dom-elements:提示 Lynx 源码中的常见 Web 元素。reactlynx/native-element-events:检查已知原生元素上的 Web 事件属性。reactlynx/library-runtime-entry:提示组件库把 TS/TSX 暴露为常规运行时入口。reactlynx/library-missing-artifact:使用--package时,检查构建后的运行时和声明入口文件。
lynx-ui
Source skill:lynx-ui
imports
lynx-ui/prefer-public-aggregate-import:提示代码直接从@lynx-js/lynx-ui-*组件包 import。
component-api
lynx-ui/button-uses-on-click:检测Button使用原生bind*或catch*tap handler,而不是文档化的onClickprop。
gestures
lynx-ui/gesture-components-enable-new-gesture:提示使用手势驱动的 lynx-ui 组件时没有开启enableNewGesture: true。
rspeedy
Source skill:rspeedy-bundle-size
bundle-size
rspeedy/no-export-star-barrels:检测可能影响 tree-shaking、把额外代码带进 rspeedy bundle 的export *barrel 文件。rspeedy/no-eval-in-bundle-code:检测源码中的eval(),因为它可能影响生产 bundle 的 name mangling。
查看本地规则:
解释单条规则:
lynx-css
CSS 兼容性 包含 lynx-css/unsupported、lynx-css/requires-newer-version 和 lynx-css/conditional-support,并说明目标版本配置和未知覆盖情况。
