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

@nxlibs/eslint-config

v1.0.3

Published

ESLint配置集合,包含基础TypeScript、React和Next.js配置,采用分层设计提供更灵活的代码规范控制。

Readme

@nxlibs/eslint-config

ESLint配置集合,包含基础TypeScript、React和Next.js配置,采用分层设计提供更灵活的代码规范控制。

安装

# npm
npm install --save-dev @nxlibs/eslint-config eslint

# pnpm
pnpm add -D @nxlibs/eslint-config eslint

# yarn
yarn add -D @nxlibs/eslint-config eslint

特性

  • ✅ 分层设计:基础、React和Next.js三层配置
  • ✅ TypeScript支持:针对TypeScript项目优化
  • ✅ 导入排序:自动组织和格式化导入语句
  • ✅ 与Prettier兼容:避免与代码格式化工具冲突
  • ✅ 现代实践:遵循最新的React和Next.js最佳实践

使用方法

基础配置(TypeScript项目)

适用于所有TypeScript项目的基础配置,包含TypeScript规则和导入排序。

// .eslintrc.js
module.exports = {
	extends: ['@nxlibs/eslint-config'], // 默认就是引入 base
	// 或明确指定基础配置
	// extends: ['@nxlibs/eslint-config/base'],
	rules: {
		// 自定义规则
	},
};

React配置

包含React、React Hooks和JSX可访问性规则。

// .eslintrc.js
module.exports = {
	extends: ['@nxlibs/eslint-config/react'],
	rules: {
		// 自定义规则
	},
};

Next.js配置

针对Next.js项目的专用配置,包含性能和最佳实践规则。

// .eslintrc.js
module.exports = {
	extends: ['@nxlibs/eslint-config/next'],
	rules: {
		// 自定义规则
	},
};

配置层级关系

配置采用继承结构,确保规则的一致性和可扩展性:

base(基础) → react(React扩展) → next(Next.js扩展)

每个层级都专注于特定领域:

  • base: 基础TypeScript语法和导入规则
  • react: 继承base并添加React特定规则
  • next: 继承react并添加Next.js特定规则

包含的主要规则

基础配置 (base)

  • TypeScript规则

    • @typescript-eslint/no-explicit-any: 警告使用any类型
    • @typescript-eslint/no-unused-vars: 警告未使用的变量(忽略下划线开头的参数)
    • @typescript-eslint/no-non-null-assertion: 允许非空断言操作符
  • 导入排序规则

    • 按分组排序:内置模块 → 外部依赖 → 内部模块 → 父级目录 → 同级目录 → 索引文件
    • 组间添加空行
    • 按字母顺序排序(忽略大小写)

React配置 (react)

  • React核心规则

    • react/react-in-jsx-scope: 关闭(React 17+不需要导入React)
    • react/prop-types: 关闭(使用TypeScript类型代替)
    • react/jsx-curly-brace-presence: 禁止不必要的花括号
  • React Hooks规则

    • react-hooks/rules-of-hooks: 强制执行Hooks规则
    • react-hooks/exhaustive-deps: 警告依赖数组不完整
  • 可访问性规则

    • 确保链接元素符合可访问性标准
    • 自定义组件(如Link)也需遵循规则

Next.js配置 (next)

  • Next.js优化规则

    • @next/next/no-html-link-for-pages: 强制使用Next.js的Link组件
    • @next/next/no-img-element: 鼓励使用Next.js的Image组件
  • 性能优化

    • 融合了next/core-web-vitals配置
    • 针对Next.js应用优化的导入排序

依赖项

自定义配置

可以通过扩展现有配置并添加自己的规则:

// .eslintrc.js
module.exports = {
	extends: ['@nxlibs/eslint-config/react'],
	rules: {
		// 覆盖内置规则
		'@typescript-eslint/no-explicit-any': 'error',

		// 添加自定义规则
		'no-console': ['warn', { allow: ['warn', 'error'] }],
	},
};