回复
     鸿蒙高质量代码静态检测200条三 原创
龙儿筝
 发布于 2024-11-13 12:33
 浏览
 0收藏
- @performance/hp-arkts-no-use-any-export-current
 
- 避免使用export * 导出当前module中定义的类型和数据
 
- @performance/hp-arkts-no-use-any-export-other
 
- 避免使用export * 导出其他module中定义的类型和数据
 
- @performance/hp-arkui-avoid-empty-callback
 
- 避免设置空的系统回调监听
 
- @performance/hp-arkui-avoid-update-auto-state-var-in-aboutToReuse
 
- 避免在aboutToReuse中对自动更新值的状态变量进行更新
 
- @performance/hp-arkui-combine-same-arg-animateto
 
- 建议动画参数相同时使用同一个animateTo
 
- @performance/hp-arkui-image-async-load
 
- 建议大图片使用异步加载
 
- @performance/hp-arkui-load-on-demand
 
- 建议使用按需加载
 
- @performance/hp-arkui-no-func-as-arg-for-reusable-component
 
- 避免使用函数作为复用的自定义组件创建时的入参
 
- @performance/hp-arkui-no-state-var-access-in-loop
 
- 避免在for、while等循环逻辑中频繁读取状态变量
 
- @performance/hp-arkui-no-stringify-in-lazyforeach-key-generator
 
- 在使用LazyForEach进行组件复用的key生成器函数里,不要使用stringify
 
- @performance/hp-arkui-reduce-pangesture-distance
 
- 建议设置合理的拖动距离
 
- @performance/hp-arkui-remove-container-without-property
 
- 建议尽量减少视图嵌套层次
 
- @performance/hp-arkui-remove-redundant-nest-container
 
- 避免冗余的嵌套
 
- @performance/hp-arkui-remove-redundant-state-var
 
- 建议移除不关联UI组件的状态变量设置
 
- @performance/hp-arkui-remove-unchanged-state-var
 
- 建议移除未改变的状态变量设置
 
- @performance/hp-arkui-replace-nested-reusable-component-by-builder
 
- 建议使用@Builder替代嵌套的自定义组件
 
- @performance/hp-arkui-set-cache-count-for-lazyforeach-grid
 
- 建议在Grid下使用LazyForEach时设置合理的cacheCount
 
- @performance/hp-arkui-suggest-cache-avplayer
 
- 建议缓存AVPlayer实例減少起播时延
 
- @performance/hp-arkui-suggest-reuseid-for-if-else-reusable-component
 
- 建议使用reuseId标记不同结构的组件构成
 
- @performance/hp-arkui-suggest-use-effectkit-blur
 
- 建议使用effectKit.createEffect实现模糊效果
 
- @performance/hp-arkui-suggest-use-get-anonymousid-async
 
- 建议在主线程中通过异步获取IFAA免密认证的匿名化ID
 
- @performance/hp-arkui-use-attributeUpdater-control-refresh-scope
 
- 建议使用attributeUpdater精准控制组件属性的刷新
 
- @performance/hp-arkui-use-grid-layout-options
 
- 建议在指定位置时使用GridLayoutOptions提升Grid性能
 
- @performance/hp-arkui-use-id-in-get-resource-sync-api
 
- 建议在使用API getColorSync和getStringSync时建议使用带id版本
 
- @performance/hp-arkui-use-id-in-get-resource-sync-api
 
- 建议在使用API getColorSync和getStringSync时建议使用带id版本
 
- @performance/hp-arkui-use-local-var-to-replace-state-var
 
- 建议使用临时变量替换状态变量
 
- @performance/hp-arkui-use-object-link-to-replace-prop
 
- 建议使用@ObjectLink代替@Prop减少不必要的深拷贝
 
- @performance/hp-arkui-use-onAnimationStart-for-swiper-preload
 
- 建议Swiper预加载机制搭配 OnAnimationStart 接口回调使用
 
- @performance/hp-arkui-use-reusable-component
 
- 建议复杂组件的定义,尽量使用组件复用
 
- @performance/hp-arkui-use-row-column-to-replace-flex
 
- 建议使用Column/Row替代Flex
 
- @performance/hp-arkui-use-scale-to-replace-attr-animateto
 
- 建议组件布局改动时使用图形变换属性动画
 
- @performance/hp-arkui-use-taskpool-for-web-request
 
- 建议网络资源的请求和返回使用taskpool线程池异步处理
 
- @performance/hp-arkui-use-transition-to-replace-animateto
 
- 建议组件转场动画使用transition
 
- @performance/hp-arkui-use-word-break-to-replace-zero-width-space
 
- 建议使用word-break替换零宽空格(\u200b)
 
- @performance/hp-performance-no-closures
 
- 建议函数内部变量尽量使用参数传递
 
- @performance/lottie-animation-destroy-check
 
- 该规则检测使用lottie加载的动画是否都正确销毁
 
- @performance/no-high-loaded-frame-rate-range
 
- 不允许锁定最高帧率运行
 
- @performance/number-init-check
 
- 该规则将检查number是否正确使用
 
- @performance/sparse-array-check
 
- 建议避免使用稀疏数组
 
- @performance/start-window-icon-check
 
- 启动页图标分辨率建议不超过256 * 256
 
- @performance/timezone-interface-check
 
- 在获取非本地时间时,建议使用统一标准的i18n.Calendar接口获取时间时区相关信息
 
- @performance/typed-array-check
 
- 数值数组推荐使用TypedArray
 
- @performance/waterflow-data-preload-check
 
- 建议对waterflow子组件进行数据预加载
 
- @performance/multiple-associations-state-var-check
 
- 多个组件关联同一数据时,建议在组件中使用@Watch装饰器添加更新条件,避免不必要的组件更新
 
- @performance/constant-property-referencing-check-in-loops
 
- 在循环如需频繁访问某个常量,且该属性引用常量在循环中不会改变,建议提取到循环外部,减少属性访问的次数
 
- @performance/foreach-args-check
 
- 建议在ForEach参数中设置keyGenerator
 
- @previewer/mandatory-default-value-for-local-initialization
 
- 如果组件的属性支持本地初始化,需要设置一个合法的不依赖运行时的默认值
 
- @previewer/no-page-method-on-preview-component
 
- 禁止在非路由组件上实例化onPageShow、onPageHide、onBackPress等页面级方法
 
- @previewer/no-unallowed-decorator-on-root-component
 
- 对于@Entry组件,不允许使用@Consume、@Link、@ObjectLink、@Prop注解;对于@Preview组件,建议使用一个定义了完整的、合法的、不依赖运行时的默认值的父组件作为预览该组件的容器
 
- @cross-device-app-dev/color-value
 
- 颜色值应当使用“$r”从color.json中引用,以适配不同的系统颜色模式,禁止使用固定的值
 
- @cross-device-app-dev/font-size-unit
 
- 字体大小单位建议使用fp,以适配系统字体设置
 
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
  标签 
   
        赞
        
 
        收藏 
      
 回复
  相关推荐
 



















