React开发模板

一个基于React、TypeScript和Vite的最小化开发模板,提供HMR和ESLint规则支持。

  • by KOHEI183
  • CSS
  • 本地部署
  • 更新于
在 GitHub 查看 kohei183/figma-mcp-server

使用说明

React+TypeScript+Vite

这个模板提供了一个最小的设置,让React在Vite中使用HMR和一些ESLint规则。

目前,有两个官方插件可用:

扩展ESLint配置

如果您正在开发生产应用程序,我们建议更新配置以启用类型感知的lint规则:

export default tseslint.config({
  extends: [
    // Remove ...tseslint.configs.recommended and replace with this
    ...tseslint.configs.recommendedTypeChecked,
    // Alternatively, use this for stricter rules
    ...tseslint.configs.strictTypeChecked,
    // Optionally, add this for stylistic rules
    ...tseslint.configs.stylisticTypeChecked,
  ],
  languageOptions: {
    // other options...
    parserOptions: {
      project: ['./tsconfig.node.json', './tsconfig.app.json'],
      tsconfigRootDir: import.meta.dirname,
    },
  },
})

您还可以安装 eslint-plugin-react-x 和 eslint插件反应dom 对于React特定的lint规则:

// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default tseslint.config({
  plugins: {
    // Add the react-x and react-dom plugins
    'react-x': reactX,
    'react-dom': reactDom,
  },
  rules: {
    // other rules...
    // Enable its recommended typescript rules
    ...reactX.configs['recommended-typescript'].rules,
    ...reactDom.configs.recommended.rules,
  },
})