vscode配置文件之.eslintrc.json

2023-05-16

.eslintrc.json

{
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": [
    "plugin:react/recommended",
    "plugin:react-hooks/recommended",
    "plugin:prettier/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "plugins": ["@typescript-eslint", "formatjs", "prettier"],
  "settings": {
    "react": {
      "version": "detect"
    }
  },
  "rules": {
    "@typescript-eslint/no-unused-vars": "error",
    "import/prefer-default-export": "off",
    "react/prop-types": "off",
    "react/jsx-uses-react": "off",
    "react/react-in-jsx-scope": "off",
    "@typescript-eslint/no-non-null-assertion": "off",
    "@typescript-eslint/no-require-imports": "warn",
    "@typescript-eslint/no-this-alias": "error",
    "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
    "@typescript-eslint/no-unnecessary-qualifier": "error",
    "@typescript-eslint/no-unused-expressions": "error",
    "@typescript-eslint/no-var-requires": "error",
    "@typescript-eslint/prefer-for-of": "error",
    "@typescript-eslint/prefer-function-type": "error",
    "@typescript-eslint/prefer-namespace-keyword": "error",
    "@typescript-eslint/prefer-readonly": "error",
    "@typescript-eslint/promise-function-async": "warn",
    "@typescript-eslint/quotes": "off",
    "@typescript-eslint/restrict-plus-operands": "warn",
    "react/display-name": "off",
    "no-redeclare": "off",
    "id-blacklist": [
      "error",
      "any",
      "String",
      "string",
      "Boolean",
      "boolean",
      "Undefined",
      "undefined"
    ],
    "one-var": ["error", "never"],
    "prefer-const": "error",
    "prefer-object-spread": "error",
    "prefer-template": "error",
    "quote-props": "off",
    "radix": "off",
    "react/jsx-boolean-value": "error",
    "react/jsx-key": "error",
    "prettier/prettier": [
      "error",
      {
        "endOfLine": "auto"
      }
    ]
  }
}

.eslintignore

node_modules
.DS_Store
dist
dist-ssr
*.local
vite.config.ts
tsconfig.json
src/**/*.d.ts
scripts
mocks

.prettierignore

*.styl
.*ignore
.npmrc
.umi/
.DS_Store
CODEOWNERS
*.ejs
src/assets
!.*.js
dist/
nginx.conf
Dockerfile
Jenkinsfile
*.png
*.xml
*.styl.d.ts
/.docz

.gitignore

node_modules
.DS_Store
dist
dist-ssr
*.local
yarn-error.log
.vscode

tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "types": ["vite/client"],
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "baseUrl": "./src",
    "forceConsistentCasingInFileNames": true,
    "module": "ESNext",
    "sourceMap": true,
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": ["./src"],
  "exclude": ["node_modules"]
}

vite.config.ts

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
import fs from 'fs'
import getThemeVariables from '@ant-design/aliyun-theme/'
import { viteMockServe } from 'vite-plugin-mock'

const paths = fs.readdirSync(path.resolve(__dirname, 'src'))
const alias = paths
  .filter((p) => {
    const stat = fs.statSync(path.resolve(__dirname, 'src/', p))
    return stat.isDirectory()
  })
  .map((p) => ({
    find: p,
    replacement: path.resolve(__dirname, 'src/', p),
  }))

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react({
      jsxRuntime: 'classic',
      babel: {
        plugins: [
          ['@emotion'],
          [
            'formatjs',
            {
              idInterpolationPattern: '[sha512:contenthash:base64:6]', // formatjs id规则
              removeDefaultMessage: true,
            },
          ],
        ],
      },
    }),
    viteMockServe({
      // default
      mockPath: './mocks',
      localEnabled: !!process.env.VITE_APP_MOCK,
    }),
  ],
  resolve: {
    alias: [...alias, { find: /^~/, replacement: '' }],
  },
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: getThemeVariables,
        javascriptEnabled: true,
      },
    },
  },
  esbuild: {},
  server: {
    hmr: {
      protocol: 'ws',
      host: 'localhost',
      port: 3001,
    },
    port: 3001,
    proxy: process.env.VITE_APP_MOCK
      ? null
      : {
          '/api/': {
            target: '项目IP:端口号 或者网址',
            secure: false,
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/api/, ''),
          },
        },
  },
})

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

vscode配置文件之.eslintrc.json 的相关文章

随机推荐

  • Gitlab权限说明

    Gitlab权限管理 Gitlab用户在组中有五种权限 xff1a Guest Reporter Developer Master Owner Guest xff1a 可以创建issue 发表评论 xff0c 不能读写版本库 Reporte
  • 二进制的浪漫

    0 基本性质 0 1 交换律 相同运算符下可任意交换 xff0c 不同的运算符不可交换 0 2 结合律 相同运算符是可结合的 0 3 分配律 a amp b
  • (九)分支限界法

    分支限界法 xff08 branch and bound method xff09 按广度优先策略搜索问题的解空间树 xff0c 在搜索过程中 xff0c 对待处理的节点根据限界函数估算目标函数的可能取值 xff0c 从中选取使目标函数取得
  • (七)贪心法

    贪心法比较简单 xff0c 从这个算法的名字看来差不多都了解了 xff0c 贪心 xff0c 贪心的人是只顾一时的利益 xff0c 不顾长远的利益 贪心法把一个问复杂问题分解为一系列较为简单的局部最优选择 xff0c 每一步选择都是对当前的
  • Struts旅程(一)Struts简介和原理

    struts 简介 Struts 是 Apache 软件基金会 xff08 ASF xff09 赞助的一个开源项目 它最初是 jakarta 项目中的一 个子项目 xff0c 并在 2004 年 3 月成为 ASF 的顶级项目 它通过采用
  • Struts旅程(六)Struts页面转发控制ActionForward和ActionMapping

    上篇讲述了 struts 控制器 Action 和 DispatchAction 以及 LookupDispatchAction xff0c 本篇主要说说 struts 中的页面转发控制 xff0c struts 提供了 ActionFor
  • Hibernate旅程(四)Hibernate对数据库删除、查找、更新操作

    上篇 xff0c 我们以向数据库添加操作来演示 hibernate 持久化对象的三种状态 本节继续 hibernate 对数据库的其他操作 xff0c 删除 查询 修改 Hibernate 对数据删除操作 删除 User 表中个一条数据 x
  • 二分查找算法(递归与非递归两种方式)

    首先说说二分查找法 二分查找法是对一组有序的数字中进行查找 xff0c 传递相应的数据 xff0c 进行比较查找到与原数据相同的数据 xff0c 查找到了返回对应的数组下标 xff0c 没有找到返回 1 xff1b 如下示例 xff0c 其
  • 调用微信高级群发接口--视频群发接口出问题(微信官方文档错误纠正)

    这几天在弄项目与微信对接 xff0c 我主要负责将素材 xff08 视频 xff0c 图片 xff0c 缩略图 xff0c 音频 xff09 材料上传到微信服务器上 xff0c 并推送到所关注本平台的用户中 xff0c 从获取accessT
  • (七)Intellij 中的git操作

    git原理以后会分章节介绍 xff0c 本次主要说一下intellij怎样操作git intellij有很好的git操作界面 xff0c 可以拉取代码 xff0c 拉取分支详情 xff0c 提交代码到本地仓库 xff0c 提交代码到远程仓库
  • git 远程代码回滚master

    人总是会有犯错的时候 xff0c 所以我们的代码有时候就需要回滚 当我们要回滚的代码还没有提交到远程的时候 xff0c 可以进行本地回滚 xff0c 较为简单 一 本地回滚 git reset 回退内容到上一个版本 就像现在的自己为成年人
  • Java相对路径、绝对路径的概述(自用)

    绝对路径 xff1a 绝对路径 xff1a 绝对路径是指文件在硬盘上真正存在的路径 例如 1 txt 这个文件是存放在硬盘的 C Users Desktop 目录下 xff0c 那么 1 txt 这个文档的绝对路径就是 C Users De
  • (2)mysql--查询部门人数最多的部门

    简述 xff1a 找出部门人数大于或等于10个人的部门 要点 在上一篇的基础上 xff0c 考察having的使用 上篇链接 xff1a http blog csdn net lovesummerforever article detail
  • ll -bash: ls: command not found

    问题简单描述 xff1a centos6安装软件的时候 不知道执行了啥操作 ll ls 命令都不好用了 问题所在 在centos6系统上安装jdk 配置 etc profile 只配置了jdk的环境变量 忘记加入系统的变量 1 网上查了查是
  • (3)mysql index

    生活中的索引 最常见的书籍是有目录的 xff0c 也可以叫做为索引 为啥用索引 xff1f 为快不破 xff0c 为了快速的查找到我们想要的东西 xff0c 书中的索引可以快速查询到我们想看的章节内容 DB中的索引亦是如此 索引本质 本质就
  • 博客乔迁

    开通了个人博客网站 欢迎访问 http www codingfuns com 博客地址http www codingfuns com 刚开通多有不足之处 请留言哈 非常感谢 最近更新的一些文章 xff1a 文章题目文章链接地址更新日期com
  • 好书好人生--读书的步骤

    写在开始 xff1a 作为一名IT人士 xff0c 我们要经常接触新的技术 xff0c 也要多读一些技术的书和生活的书 xff0c 怎样读书最重要 xff0c 读书并不是读得多就好 xff0c 读书就像吃牛肉一样 xff0c 我们要吃了吸收
  • 年终工作总结:给新手程序员的几个建议

    转自 xff1a 伯乐在线 马上到年末了 xff0c 自己也对今年做了一下总结 xff0c 自己有哪些优点 xff0c 有哪些还需要加强 每当我想到今年比较满意的地方 xff0c 对比之前 xff0c 就会有这样一个思考 xff1a 如果以
  • 解决Mac M1架构系统无法调试go的问题

    背景 xff1a 周末在新Mac 使用 Goland 断点调试 go程序 xff0c 发现无法调试报错 xff0c 最终发现问题是 xff1a xcode select 版本的问题 xff0c 更新完后完美解决 xff1b 最近买了台202
  • vscode配置文件之.eslintrc.json

    eslintrc json span class token punctuation span span class token string 34 env 34 span span class token operator span sp