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

eslint-plugin-antd-feedback

v0.1.1

Published

用于约束 Ant Design 静态反馈 API 的 ESLint 插件

Readme

eslint-plugin-antd-feedback

用于约束 Ant Design 静态反馈 API 的 ESLint 插件。当前提供 no-static-feedback-api 规则,避免静态 messagenotificationModal 方法脱离 React Context。

安装

pnpm add -D eslint-plugin-antd-feedback

该插件要求 ESLint 9.0.0 或更高版本,并使用 ESLint flat config。

推荐配置

import antdFeedback from 'eslint-plugin-antd-feedback';
import { defineConfig } from 'eslint/config';

export default defineConfig([
  ...antdFeedback.configs.recommended,
]);

推荐配置会以 error 级别启用 antd-feedback/no-static-feedback-api

手动配置

import antdFeedback from 'eslint-plugin-antd-feedback';

export default [
  {
    plugins: { 'antd-feedback': antdFeedback },
    rules: {
      'antd-feedback/no-static-feedback-api': 'error',
    },
  },
];

no-static-feedback-api

禁止直接使用以下 Ant Design 静态反馈 API:

  • antd 导入的 message
  • antd 导入的 notification
  • Modal.confirmModal.errorModal.infoModal.successModal.warning
  • 通过 import * as antd 访问的对应 API

Modal 组件和 Modal.useModal() 不受限制。反馈实例可通过 App.useApp() 获取,也可通过 Modal.useModal() 获取带有 contextHoldermodal 实例。

示例

import { App, Modal } from 'antd';

const { message, notification, modal } = App.useApp(); // 允许
const [hookModal, contextHolder] = Modal.useModal(); // 允许

message.success('操作完成'); // 允许
notification.info({ message: '处理进度' }); // 允许
modal.confirm({ title: '确认操作' }); // 允许
hookModal.warning({ title: '注意' }); // 允许

Modal.confirm({ title: '确认操作' }); // 报错

选项

| 选项 | 默认值 | 说明 | | --- | --- | --- | | modal | true | 检查 Modal 静态反馈方法;传入 false 时关闭 | | message | true | 检查 message 导入与命名空间访问;传入 false 时关闭 | | notification | true | 检查 notification 导入与命名空间访问;传入 false 时关闭 |

每个选项可传入布尔值,也可通过对象中的 message 设置自定义提示文案。提示文案支持 {{name}} 占位符:

import antdFeedback from 'eslint-plugin-antd-feedback';

export default [
  {
    plugins: { 'antd-feedback': antdFeedback },
    rules: {
      'antd-feedback/no-static-feedback-api': [
        'error',
        {
          modal: {
            message: '禁止使用 Modal.{{name}} 静态方法,请改用上下文中的 modal 实例。',
          },
          message: true,
          notification: false,
        },
      ],
    },
  },
];

不传入选项时,所有检查默认启用。

开发

corepack pnpm install
corepack pnpm check

发布前可检查实际打包内容:

npm pack --dry-run