
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
rokid-flint
Advanced tools
rokid-flint 是前端规约 Lint 工具,可以为项目一键接入规约、一键扫描和修复规约问题,保障项目的编码规范和代码质量。
引入了多个业界流行的 Linter 作为规约配套,并根据规约内容定制了规则包,它们包括:
| 规约 | Lint 工具 | 规则包 |
|---|---|---|
| 《JavaScript 编码规约》 《TypeScript 编码规约》 《React 编码规约》 《Node.js 开发规约》 | ESLint | eslint-config-airbnb |
| 《CSS 编码规约》 | stylelint | stylelint-config-standard |
| 《Git 规约》 | commitlint |
可以看到这些 Linter 和规则包众多且零散,全部安装它们会给项目增加十几个依赖,接入和升级成本都比较高。
rokid-flint 收敛屏蔽了这些依赖和配置细节,提供简单的 CLI 和 Node.js API,让项目能够一键接入、一键扫描、一键修复、一键升级,并为项目配置 git commit 卡口,降低项目接入规约的成本。
在终端执行:
npm install rokid-flint -g
安装完成后,可执行 rokid-flint -h 以验证安装成功。
rokid-flint init:一键接入在项目根目录执行 rokid-flint init,即可一键接入规约,为项目安装规约 Lint 所需的依赖和配置。

具体会做以下事情:
.eslintrc.js、.eslintignore.stylelintrc.js、.stylelintignore.cz-config.jscommitlint.config.js.prettierrc.js:符合规约的 Prettier 配置.editorconfig:符合规约的 editorconfig.vscode/extensions.json:写入规约相关的 VSCode 插件推荐,包括 ESLint、stylelint、markdownlint、prettier 等.vscode/settings.json:写入规约相关的 VSCode 设置,设置 ESLint 和 stylelint 插件的 validate 及保存时自动运行 fix,如果选择使用 Prettier,会同时将 prettier-vscode 插件设置为各前端语言的 defaultFormatter,并配置保存时自动格式化rokid-flint.config.js:rokid-flint 包的一些配置,如启用的功能等rokid-flint commit-file-scan 和 rokid-flint commit-msg-scan 分别对提交文件和提交信息进行规约检查。rokid-flint commit-file-scan 默认仅对 error 问题卡口,如果你想对 warn 问题也卡口,可以增加 --strict 参数以开启严格模式注 1:如果项目已经配置过 ESLint、stylelint 等 Linter,执行
rokid-flint init将会提示存在冲突的依赖和配置,并在得到确认后进行覆盖:注 2:如果项目的 .vscode/ 目录被 .gitignore 忽略,可以在拉取项目后单独执行
rokid-flint init --vscode命令写入.vscode/extensions.json和.vscode/settings.json配置文件
rokid-flint scan:一键扫描在项目的根目录执行命令,即可扫描项目的规约问题:

支持下列参数:
-q --quiet 仅报告 error 级别的问题-o --output-report 输出扫描出的规约问题日志-i --include <dirpath> 指定要进行规约扫描的目录--no-ignore 忽略 eslint 的 ignore 配置文件和 ignore 规则注 1:事实上,你可以在任意目录执行
rokid-flint scan,rokid-flint 会根据文件类型、JSON 等特征嗅探项目类型。但我们还是推荐在执行过rokid-flint init的项目根目录执行rokid-flint scan,以得到最准确的扫描结果。注 2:rokid-flint 会根据项目内有无 eslint 和 stylelint 配置文件判断使用项目的配置文件还是 rokid-flint 默认配置进行扫描。若使用项目的,在未安装依赖时会帮其安装(执行 npm i)。若使用项目配置扫描失败,则使用默认配置扫描
rokid-flint fix:一键修复在项目的根目录执行命令,即可修复部分规约问题:

支持下列参数:
-i --include <dirpath> 指定要进行修复扫描的目录--no-ignore 忽略 eslint 的 ignore 配置文件和 ignore 规则注意请 review 下修复前后的代码,以免工具误修的情况。
rokid-flint commit-file-scan 提交文件扫描在 git commit 时对提交文件进行规约问题扫描,需配合 git 的 pre-commit 钩子使用。
支持下列参数:
-s --strict 严格模式,对 warn 和 error 问题都卡口,默认仅对 error 问题卡口rokid-flint commit-msg-scan 提交信息扫描git commit 时对 commit message 的格式进行扫描(使用 commitlint),需配合 husky 的 commit-msg 钩子使用。
FAQs
The npm package rokid-flint receives a total of 5 weekly downloads. As such, rokid-flint popularity was classified as not popular.
We found that rokid-flint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.