日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達者為師

網(wǎng)站首頁 編程語言 正文

如何解決用ESLint驗證導(dǎo)致報錯的問題

作者:艾米家的貓兒(傻鋼) 更新時間: 2021-12-02 編程語言

報錯一:

ESLint: Missing return type on function.(@typescript-eslint/explicit-module-boundary-types)

解決方法:在.eslintrc.js 里面 加上

 "rules": {
     "@typescript-eslint/explicit-module-boundary-types": "off"  
  },

報錯二:

ESLint: Type string trivially inferred from a string literal, remove type annotation.(@typescript-eslint/no-inferrable-types)

解決方法:在.eslintrc.js 里面 加上

 "rules": {
     "@typescript-eslint/no-inferrable-types": "off"   
  },

報錯三:

ESLint: Require statement not part of import statement. eslint@typescript-eslint/no-var-requires

解決方法:在.eslintrc.js 里面 加上

 "rules": {
    '@typescript-eslint/no-var-requires': 0 
  },

報錯四:

ESLint: Forbidden non-null assertion.(@typescript-eslint/no-non-null-assertion)

解決方法:在.eslintrc.js 里面 加上

 "rules": {
    '@typescript-eslint/no-non-null-assertion': 'off'
  },

報錯五:

ESLint: ‘xxx’ is not defined.(no-undef) //說明全局變量未定義

解決方法:在.eslintrc.js 里面 添加代碼塊

 "rules": {
    ...
  },
    "globals":{
    "xxx": true//xxx 為你的全局變量
  }

原文鏈接:https://blog.csdn.net/qq_731335498/article/details/122111386

欄目分類
最近更新