@afuteam-nx/plugin-exec-eslint
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

plugin-exec-eslint

对代码仓库执行代码质量检查,支持批量项目。 输出结果包含仓库的 eslint错误数 空行数 代码行数 注释行数 复杂度统计(不包含switchcase类型)

环境

本插件基于 nx 开发,请在对应初始化好的 your-app 中使用

本插件的输入文件建议使用 @afuteam-nx/plugin-add-eslint-type生成的文件

本插件受益于 @afuteam/eslint-plugin-fe 提供代码 eslint 规则

关于复杂度,使用了自定义的规则,过滤了 switch case 类型的统计

安装

pnpm i @afuteam-nx/plugin-exec-eslint -D

配置

# 在 apps/your-app/project.json 中配置
"targets": {
  "fetch-repos": {
    "executor": "@afuteam-nx/plugin-exec-eslint:run",
    "options": {
      "localFileReposWithAFULintTypePath": "项目清单需要有 AFULintType 字段, allProjectsWithLinType.json",
      "localAllReposCodePath": "本地的要执行 eslint 源代码路径",
      "resultPath": "结果输出路径 文件名 allProjectsLintResult.json"
    }
  }
}

使用

nx run your-app:exec-eslint

文件数据结构

allProjectsWithLinType.json

[
  {
    "id": 28612,
    "created_at": "2023-11-21T15:23:21.637+08:00",
    "last_activity_at": "2024-03-04T20:41:10.727+08:00",
    "name": "sky",
    "AFULintType": {
      "root": "react-ts"
    },
    "web_url": "https://gitlab.com/afuteam/sky"
  }
]

allProjectsLintResult.json

[
  {
    "errors": 0,
    "warnings": 0,
    "total": 0,
    "blank_lines": 667,
    "comment_lines": 399,
    "code_lines": 14146,
    "complexity_data_ength": 0,
    "repo_created_at": "2023-11-07T15:07:46.337+08:00",
    "repo_last_activity_at": "2024-05-20T15:43:34.501+08:00",
    "repo_id": 28516,
    "repo_name": "gogogo"
  }
]

Package Sidebar

Install

npm i @afuteam-nx/plugin-exec-eslint

Weekly Downloads

57

Version

0.0.7

License

none

Unpacked Size

27.2 kB

Total Files

14

Last publish

Collaborators

  • eyea