0.3.1 • Published 1 year ago

@xcube/mini-lint-linux v0.3.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Cube 小程序 Lint 工具

Cube 小程序实现了支付宝小程序语法的子集,本工具是针对小程序工程目录进行代码检查的命令行工具(CLI)。

安装方式

Mac 平台

npm install -g @xcube/mini-lint-mac

Linux 平台

npm install -g @xcube/mini-lint-linux

使用

最简单的方式

直接在支付宝小程序源代码目录(mini.project.json所在目录)中执行命令,不需任何额外参数

cubelint

指定小程序项目路径

在任意目录下执行命令,以指定路径作为小程序项目的根目录路径

cubelint app --project="/path/to/mini-proj/"

对小程序项目中一个指定的页面进行lint检测

cubelint page --project="/path/to/mini-proj/" --page="pages/index/index"

检查过程中,指定特定的 node_modules 目录

说明:在小程序开发中经常会依赖一些通过 npm 安装的三方 component ,它们会位于 node_modules 目录中。 cubelint 工具默认会在 app.json 所在目录中查找 node_modules 目录并查找这些三方依赖。 但是对于一些 monorepo 项目,往往会出现小程序工程依赖的 node_modules 不在当前 project 目录中,所以 cubelint 提供了单独指定 node_modules 目录路径的能力

lint 整个 App 时指定 node_modules 路径:

cubelint app --project="/path/to/mini-proj/" --node-modules="/path/to/mini-proj/node_modules"

lint 整个某个 Page 时指定 node_modules 路径:

cubelint page --project="/path/to/mini-proj/" --page="pages/index/index" --node-modules="/path/to/mini-proj/node_modules"

检测报告文件输出

加入如下参数,可以csv文件格式输出lint结果(而非直接在命令行显示)

--report="/path/to/report_dir"

也支持json格式输出检测报告:

--report-json="/path/to/report_dir"
0.3.0

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.8

1 year ago

0.3.1

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago