React Eslint 格式化插件

安装插件

npm
yarn
pnpm
bun
npm add @empjs/eslint-config-react -D

配置插件

package.json
{
    "eslintConfig": {
    "extends": [
      "@empjs/eslint-config-react"
    ]
  },
}

vscode 建议配置

.vscode/settings.json
{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
  },
  "typescript.tsdk": "node_modules/typescript/lib",
  "typescript.enablePromptUseWorkspaceTsdk": true,
  "eslint.probe": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "html",
    "vue",
    "markdown",
    "json"
  ],
  "javascript.format.enable": false,
  "typescript.format.enable": false
}
💡 TIP

vscode中,需要搭配VS Code ESLint extension使用,无需安装Prettier Formatter for Visual Studio Code