AlloyTeam / eslint-config-alloy

Progressive ESLint config for your React/Vue/TypeScript projects
https://alloyteam.github.io/eslint-config-alloy/
2.64k stars 315 forks source link

无法自动检测代码是否符合规则 #187

Closed Popxie closed 3 years ago

Popxie commented 3 years ago

按照使用文档说明, 安装了依赖,生成了.eslintrc文件(默认数据),然后启动项目,在代码中刻意输入不符合规则的代码,为啥没有任何提示且项目依旧正常运行?最开始使用vue项目自动配置的eslint时,会直接报错,结果改用eslint-config-alloy时没有任何效果、请问是我哪里出了问题嘛?此时vscode我没有进行任何设置。是我哪里姿势不对嘛?????

xcatliu commented 3 years ago

创建一个 .vscode/settings.json 文件,然后贴入以下内容

{
  // 统一使用 \n 换行符
  "files.eol": "\n",
  // 缩进宽度为 2
  "editor.tabSize": 2,
  // 保存时自动格式化
  "editor.formatOnSave": true,
  // 默认使用 Prettier 格式化
  // "editor.defaultFormatter": "esbenp.prettier-vscode",
  // ESLint 配置
  "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
  "editor.codeActionsOnSave": {
    // 保存时自动修复 ESLint 错误
    "source.fixAll.eslint": true
  },
  // 使用项目的 ts 版本
  "typescript.tsdk": "node_modules/typescript/lib",
  // "deno.enable": false
}