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

@tarsiidae/eslint-config

v1.0.17

Published

Custom ESLint configuration for ESLint 9 with TypeScript and React support

Readme

ESLint Config

自定义 ESLint 配置,支持 TypeScript 和 React。

安装

npm install --save-dev @tarsiidae/eslint-config

使用方法

在你的项目根目录创建 .eslintrc.js 文件:

module.exports = {
  extends: ['@tarsiidae/eslint-config']
};

或者在 package.json 中添加:

{
  "eslintConfig": {
    "extends": ["@tarsiidae/eslint-config"]
  }
}

TypeScript 支持

这个包包含完整的 TypeScript 类型定义,在使用 TypeScript 的项目中会获得完整的类型提示:

// 在 TypeScript 项目中,你会获得完整的类型提示
import type { Linter } from 'eslint'

const config: Linter.Config = {
  extends: ['@tarsiidae/eslint-config']
}

特性

  • TypeScript 支持
  • React 支持
  • React Hooks 规则
  • Import/Export 规则
  • 常用的代码质量规则
  • 完整的 TypeScript 类型定义

自定义规则

这个配置包含以下自定义规则:

Store 相关规则

  • snake-case-store-properties: Store 接口中的属性必须是下划线连接且以 g_ 开头
  • disallow-optional-store-properties: 禁止在 Store 接口中设置可选属性
  • store-key-prefix-and-type-check: Store 键名前缀和类型检查

API 相关规则

  • api-method-name: API 请求方法必须以 'Api' 结尾
  • no-api-request-in-useeffect: 禁止在 useEffect 中进行 API 请求
  • api-functions-usage: 强制使用 useRequest 进行 API 调用
  • no-incorrect-userequest-args: 确保 useRequest 参数正确
  • run-alias-must-be-run-apiName: useRequest 的 run 函数别名规范

React 相关规则

  • use-set-prefix-naming-convention: useState 设置函数必须以 'set' 开头
  • require-useeffect-deps: useEffect 必须有依赖数组
  • react-component-must-use-memo: React 组件必须使用 memo
  • use-useMemoizedFn: 强制使用 useMemoizedFn 替代 useCallback
  • use-useMount: 使用 useMount 替代空依赖的 useEffect
  • use-useUnmount: 建议使用 useUnmount
  • no-run-in-usemount: 禁止在 useMount 中使用 run 函数
  • no-return-in-use-mount: 禁止在 useMount 中使用 return

存储相关规则

  • no-direct-localstorage: 禁止直接使用 localStorage
  • no-direct-sessionstorage: 禁止直接使用 sessionStorage
  • no-direct-emitter-on: 禁止直接使用 emitter.on
  • no-direct-useNavigate-import: 禁止直接导入 useNavigate

代码质量规则

  • no-export-import-in-d-ts: 禁止在 *.d.ts 文件中使用 export 和 import
  • no-json-parse-stringify-deep-copy: 禁止使用 JSON.parse(JSON.stringify()) 进行深拷贝
  • no-import-paths-with-spaces: import 路径中不能含有空格
  • no-any-or-unknown-in-api-index: 禁止在 api/index.ts 中使用 any 或 unknown
  • interface-type-naming: 接口和类型命名规范

图片相关规则

  • allowed-image-formats: 限制图片格式
  • image-filename-must-end-with-img: 图片变量必须以 'Img' 结尾

其他规则

  • use-s-pattern: useOkStore 使用规范
  • no-use-state-in-store: 禁止在 store 中使用特定状态
  • enforce-useRequest-destructuring: 强制 useRequest 使用解构
  • require-lazy-import-for-tsx: 要求 TSX 组件使用懒加载
  • chinese-comment-spacing: 中文注释间距规范

规则说明

本配置包含以下主要规则:

  • 禁止使用 console(除了 warn 和 error)
  • 禁止使用 debugger
  • 未使用的变量检查
  • React 相关规则优化
  • TypeScript 类型检查

开发

构建

npm run build

类型检查

npm run type-check

测试

npm test

发布到 npm

  1. 确保你已经登录到 npm:
npm login
  1. 发布包:
npm publish

License

ISC