npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

eslint-plugin-bf-eslint-plugin

v1.0.14

Published

bf es plugin

Downloads

111

Readme

eslint-plugin-bf-eslint-plugin

bf es plugin

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-bf-eslint-plugin:

npm install eslint-plugin-bf-eslint-plugin --save-dev

Usage

In your configuration file, import the plugin eslint-plugin-bf-eslint-plugin and add bf-eslint-plugin to the plugins key:

import bf-eslint-plugin from "eslint-plugin-bf-eslint-plugin";

export default [
    {
        plugins: {
            bf-eslint-plugin
        }
    }
];

Then configure the rules you want to use under the rules key.

import bf-eslint-plugin from "eslint-plugin-bf-eslint-plugin";

export default [
    {
        plugins: {
            bf-eslint-plugin
        },
        rules: {
            "bf-eslint-plugin/rule-name": "warn"
        }
    }
];

run single test

node  test/lib/rules/XXXX.js

run all the test

npm run test

规则说明

bf-utility-function-jsdoc

该规则强制复杂工具函数必须包含完整的JSDoc注释。

工具函数定义:

  • 函数名称包含工具关键字(如 Utilconverthandleformat 等)
  • 驼峰命名段数超过2段(如 formatUserDataToJson

注释要求:

  • 必须包含功能说明(非标签的描述文本)
  • 只有当函数有参数时才必须包含 @param 标签(描述参数)
  • 只有当函数有返回值时才必须包含 @return 标签(描述返回值)

配置选项:

  • utilityKeywords: 工具函数关键字数组,默认为 ["Util", "convert", "handle", "format"]
  • reportIdNode: 是否报告ID节点而不是整个函数节点,默认为 true

示例:

// ✓ 正确 - 有参数和返回值
/**
 * 生成安全的用户ID工具函数
 * @param {string} prefix 用户ID前缀
 * @param {number} length ID长度
 * @return {string} 生成的用户ID
 */
function generateSafeUserIdUtil(prefix, length) {
  return prefix + Math.random();
}

// ✓ 正确 - 无参数,无返回值
/**
 * 格式化日期
 */
function formatUserDate() {
  console.log(new Date());
}

// ✗ 错误 - 缺少 @param 标签
/**
 * 处理用户数据转换
 * @return {Object} 处理后的数据
 */
function handleUserDataConversion(userData) {
  return userData;
}

git-diff-process 说明

假设原文件的的内容是:

function printHello() {
    console.log("Hello2");
    console.log("Hello2");
}

然后修改为如下内容:

function printHello() {
    console.log("Hello3");
}


function sum(a: number, b: number): number {
    return a + b;
}

则输出的git diff信息为

  {
    "old_path": "assets/test.ts",
    "new_path": "assets/test.ts",
    "a_mode": "100644",
    "b_mode": "100644",
    "new_file": false,
    "renamed_file": false,
    "deleted_file": false,
    "diff": "@@ -1,4 +1,8 @@\n function printHello() {\n-    console.log(\"Hello2\");\n-    console.log(\"Hello2\");\n+    console.log(\"Hello3\");\n+}\n+\n+\n+function sum(a: number, b: number): number {\n+    return a + b;\n }\n"
  }

通过库gitdiff-parser解析之后,输出

[
  {
    "hunks": [
      {
        "content": "@@ -1,4 +1,8 @@",
        "oldStart": 1,
        "newStart": 1,
        "oldLines": 4,
        "newLines": 8,
        "changes": [
          {
            "content": "function printHello() {",
            "type": "normal",
            "isNormal": true,
            "oldLineNumber": 1,
            "newLineNumber": 1
          },
          {
            "content": "    console.log(\"Hello2\");",
            "type": "delete",
            "isDelete": true,
            "lineNumber": 2
          },
          {
            "content": "    console.log(\"Hello2\");",
            "type": "delete",
            "isDelete": true,
            "lineNumber": 3
          },
          {
            "content": "    console.log(\"Hello3\");",
            "type": "insert",
            "isInsert": true,
            "lineNumber": 2
          },
          {
            "content": "}",
            "type": "insert",
            "isInsert": true,
            "lineNumber": 3
          },
          {
            "content": "",
            "type": "insert",
            "isInsert": true,
            "lineNumber": 4
          },
          {
            "content": "",
            "type": "insert",
            "isInsert": true,
            "lineNumber": 5
          },
          {
            "content": "function sum(a: number, b: number): number {",
            "type": "insert",
            "isInsert": true,
            "lineNumber": 6
          },
          {
            "content": "    return a + b;",
            "type": "insert",
            "isInsert": true,
            "lineNumber": 7
          },
          {
            "content": "}",
            "type": "normal",
            "isNormal": true,
            "oldLineNumber": 4,
            "newLineNumber": 8
          }
        ]
      }
    ],
    "oldEndingNewLine": true,
    "newEndingNewLine": true,
    "oldPath": "assets/test.ts",
    "newPath": "assets/test.ts",
    "oldRevision": "1234567",
    "newRevision": "abcdefg",
    "newMode": "100644",
    "oldMode": "100644",
    "type": "modify"
  }
]

可以得出几个信息

  1. 新增是insert
  2. 修改本质是先delete,再insert