🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

no-use-data

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

no-use-data

获取定义在data中而没有使用的key

latest
npmnpm
Version
1.0.9
Version published
Weekly downloads
18
260%
Maintainers
1
Weekly downloads
 
Created
Source

扫描小程序项目指定目录,过滤出在data中定义但未在wxml中使用的变量,生成到指定的json文件中

背景

小程序评分--最佳实践(setData 操作会引起框架处理一些渲染界面相关的工作,一个未绑定的变量意味着与界面渲染无关,传入 setData 会造成不必要的性能消耗。得分条件:setData 传入的所有数据都在模板渲染中有相关依赖)



使用方式

1、项目安装 no-use-data 依赖

  第一个参数:需要检测的目录  第二个参数:定义输出文件的地址及文件名称
  "scripts": {
    "no-use-data": " node ./node_modules/no-use-data/index.js   \"./src\" \"./result.json\""
  }

在项目根目录下运行命令 npm run no-use-data 或者 yarn no-use-data


2、全局安装 no-use-data

第一个参数:需要检测的目录 第二个参数:定义输出文件的地址及文件名称

在项目根目录下运行命令 getNoUseData "./scr" "./script/result.json"


Keywords

node

FAQs

Package last updated on 02 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts