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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vexjs/forbid-lint

v0.0.4

Published

一个用于前端工程中禁止修改lint文件的插件

Readme

English Docs

forbid-lint

一个用于前端工程中禁止修改 lint 文件的插件,由于本插件目的是避免各种 lint 文件的修改,所以目前只支持配置项目根目录的配置文件名,后续会支持配置子级文件名~

使用插件

  1. 安装

全局安装

npm install @vexjs/forbid-lint -g
or
pnpm install @vexjs/forbid-lint -g
or
yarn add @vexjs/forbid-lint -g

项目内安装(建议采用这种方式)

npm install @vexjs/forbid-lint -D
or
pnpm install @vexjs/forbid-lint -D
or
yarn add @vexjs/forbid-lint -D
  1. 使用

有两种使用方式,先介绍第一种:


手动创建配置文件方式

  1. 在项目的根目录创建.forbidrc.json文件,写入如下配置
// 将不希望被修改的文件名写入到lintFiles中
{
  "lintFiles": [
    ".eslintrc.js",
    ".eslintrc.json",
    ".eslintrc.yml",
    xxx
  ]
}

TIP:如果不创建该文件,将以如下默认配置的文件名进行校验

# 默认禁止修改文件

.eslintrc.js
.eslintrc.cjs
.eslintrc.yaml
.eslintrc.yml
.eslintrc.json
eslint.config.js
eslint.config.mjs
eslint.config.cjs
eslint.config.ts
eslint.config.mts
eslint.config.cts
  1. 安装 husky 并配置 husky 的pre-commit钩子,安装配置 husky 比较简单,可自行参考husky guide,在 pre-commitgound 钩子中添加如下内容
npx forbid-lint check
  1. git 提交时,将在 pre-commit 钩子中执行 forbid-lint check 命令,如果检测到有文件被修改,则提示不允许修改,并退出 git 提交流程

cli 使用

cli 命令介绍

forbid-lint cli

  1. forbid-lint init 进行初始化

  2. forbid-lint check 检测暂存区是否存在禁止修改的文件

TIP: 如何在运行cli指令时提示sh: xxx/bin/forbid-lint: Permission denied,可运行如下指令进行修复:

chmod +x xxx/forbid-lint/bin/forbid-lint

cli 创建配置文件方式

  1. 运行如下 cli 命令进行初始化
# 全局安装运行
forbid-lint init

# 项目内安装运行
npx forbid-lint init
  1. 根据 cli 工具的提示选择是否自动生成如下配置

    2.1 husky:自动安装husky(9.1.7)插件,自动创建.husky目录,自动生成pre-commit钩子,并自动配置该钩子为forbid-lint check 【也可以选择拒绝自动安装,选择自己安装husky】
    
    2.2 .frobidrc.json:自动在项目根目录生成.forbidrc.json文件,并写入如下内容{"lintFiles": [".eslintrc.js", ".eslintrc.json", ".eslintrc.yml"]}

开发

pnpm dev

启动 Node 服务,并运行 src/index.ts

测试

pnpm test
  1. 监听 src 中 ts 文件修改
  2. demo目录动态更新 forbid-lint 库

打包

pnpm build

单元测试

pnpm jest

发布

pnpm publishCI [x.y.z]

整体流程图

整体流程图