ESLint

目的

此包统一了所有 TanStack 项目中使用的共享 ESLint 配置。它被设计为框架无关的,并且不包含任何特定于框架的插件。

设置

package.json

  • 确保您已安装 ESLint v9+

eslint.config.js

js
import { tanstackConfig } from '@tanstack/eslint-config'
// OR
import { tanstackConfig } from '@tanstack/config/eslint'

export default [
  ...tanstackConfig,
  {
    // Custom rules go here
  },
]
import { tanstackConfig } from '@tanstack/eslint-config'
// OR
import { tanstackConfig } from '@tanstack/config/eslint'

export default [
  ...tanstackConfig,
  {
    // Custom rules go here
  },
]

插件

规则

您可以通过运行 pnpm dlx @eslint/config-inspector 来检查启用的规则,或者通过浏览 此处 的源代码。每个规则都有一个注释解释了为什么它包含在共享配置中。

订阅 Bytes

您的每周 JavaScript 新闻。每周一免费发送给超过 10 万名开发者。

Bytes

没有垃圾邮件。随时取消订阅。