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

@huaiyou/config-eslint

v1.0.0

Published

Shared ESLint configuration with flat config (ESLint 9.x)

Readme

@huaiyou/config-eslint

基于 ESLint 9.x Flat Config 的共享 ESLint 配置,支持 TypeScript 和 React。

📦 安装

pnpm add -D @huaiyou/config-eslint eslint typescript

🚀 快速开始

Base 配置(TypeScript 项目)

创建 eslint.config.js 文件:

import { base } from '@huaiyou/config-eslint';

export default base;

React 配置

对于 React 项目:

import { react } from '@huaiyou/config-eslint';

export default react;

✨ 特性

Base 配置

  • ESLint 9.x Flat Config: 使用最新的配置格式
  • TypeScript 支持: 完整的 TypeScript 类型检查
  • Import 排序: 自动排序和组织 import 语句
  • Prettier 集成: 与 Prettier 完美配合,无冲突
  • 严格规则: 推荐的最佳实践和代码规范

React 配置

继承 Base 配置,额外包含:

  • React 规则: React 最佳实践
  • Hooks 检查: React Hooks 使用规范
  • JSX 支持: 完整的 JSX 语法支持
  • 自动检测: 自动检测 React 版本

📋 规则说明

TypeScript 规则

| 规则 | 设置 | 说明 | | -------------------------------------------- | ----- | --------------------------------- | | @typescript-eslint/no-unused-vars | error | 禁止未使用的变量(忽略 _ 开头) | | @typescript-eslint/no-explicit-any | warn | 警告使用 any 类型 | | @typescript-eslint/consistent-type-imports | error | 强制使用 type import | | @typescript-eslint/no-misused-promises | error | 防止错误使用 Promise |

Import 规则

| 规则 | 设置 | 说明 | | ----------------------------- | ----- | ---------------------- | | import/order | error | 强制 import 顺序和分组 | | import/no-duplicates | error | 禁止重复 import | | import/newline-after-import | error | import 后需要空行 |

React 规则

| 规则 | 设置 | 说明 | | ----------------------------- | ----- | ------------------------- | | react/prop-types | off | 关闭 PropTypes(使用 TS) | | react/react-in-jsx-scope | off | React 17+ 不需要 | | react-hooks/rules-of-hooks | error | Hooks 使用规则 | | react-hooks/exhaustive-deps | warn | Hooks 依赖检查 |

🔧 自定义配置

扩展配置

import { base } from '@huaiyou/config-eslint';

export default [
  ...base,
  {
    rules: {
      // 你的自定义规则
      '@typescript-eslint/no-explicit-any': 'error',
    },
  },
];

忽略文件

import { base } from '@huaiyou/config-eslint';

export default [
  ...base,
  {
    ignores: ['dist/**', 'build/**', '*.config.js'],
  },
];

针对特定文件的规则

import { react } from '@huaiyou/config-eslint';

export default [
  ...react,
  {
    files: ['**/*.test.{ts,tsx}'],
    rules: {
      '@typescript-eslint/no-explicit-any': 'off',
    },
  },
];

📝 配合 package.json 使用

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

🔄 从 ESLint 8.x 迁移

ESLint 9.x 使用全新的 Flat Config 格式,主要变化:

  1. 配置文件: .eslintrc.*eslint.config.js
  2. 格式: 对象配置 → 数组配置
  3. extends: 移除,使用数组展开
  4. plugins: 新的插件系统

详见 ESLint Migration Guide

🤝 贡献

欢迎提交 Issue 和 Pull Request 来改进配置。

📄 License

MIT