Version
入門指南

ESLint

目的

此套件統一了所有 TanStack 專案中共享的 ESLint 配置。它被設計為與框架無關,不包含任何特定框架的外掛 (plugins)。

設定

package.json

  • 確保已安裝 ESLint v9 以上版本

eslint.config.js

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

export default [
  ...tanstackConfig,
  {
    // 自訂規則放在這裡
  },
]
import { tanstackConfig } from '@tanstack/eslint-config'
// OR
import { tanstackConfig } from '@tanstack/config/eslint'

export default [
  ...tanstackConfig,
  {
    // 自訂規則放在這裡
  },
]

外掛 (Plugins)

規則

您可以透過執行 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.