版本
入门指南

ESLint

目的

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

设置

package.json

  • 确保已安装 ESLint v9 或更高版本

eslint.config.js

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

export default [
  ...tanstackConfig,
  {
    // 自定义规则写在此处
  },
]
import { tanstackConfig } from '@tanstack/eslint-config'
// 或
import { tanstackConfig } from '@tanstack/config/eslint'

export default [
  ...tanstackConfig,
  {
    // 自定义规则写在此处
  },
]

插件

规则

您可以通过运行 pnpm dlx @eslint/config-inspector 或浏览源代码来查看启用的规则。每条规则都附有注释说明其被包含在共享配置中的原因。

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.