设置ESLint

设置ESLint

  1. 安装组件

    npm i eslint prettier eslint-config-prettier eslint-plugin-prettier  eslint-config-airbnb eslint-plugin-node eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react --save-dev
    
  2. 设置规则

    控制off,warn,error
    具体参数设置可以参考官方文档,报错的时候vscode有直接跳转的

    {
      "extends": ["airbnb", "prettier", "plugin:node/recommended"],
      "plugins": ["prettier"],
      "rules": {
        "prettier/prettier": ["error", {}],
        "spaced-comment": "off",
        "no-console": ["warn", { "allow": ["log"], "no-semi": true }],
        "consistent-return": "off",
        "func-names": "off",
        "object-shorthand": "off",
        "no-process-exit": "off",
        "no-param-reassign": "off",
        "no-return-await": "off",
        "no-underscore-dangle": "off",
        "class-methods-use-this": "off",
        "prefer-destructuring": ["error", { "object": true, "array": false }],
        "no-unused-vars": ["error", { "argsIgnorePattern": "req|res|next|val|err" }]
      }
    }
    
    
posted @   kihyun  阅读(64)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
点击右上角即可分享
微信分享提示