1. require('xx-xx') 不能用时

https://stackoverflow.com/questions/31173738/typescript-getting-error-ts2304-cannot-find-name-require

  1. "compilerOptions": {
  2. // other options
  3. "types": [
  4. "node"
  5. ]
  6. }

2.第三方 type 用不到时, 比如 hammerjs

https://github.com/angular/material2/issues/1944

  1. {
  2. "compilerOptions": {
  3. // other typescript options
  4. "types": [
  5. "hammerjs"
  6. ]
  7. }
  8. }

3. tslint auto fix

ctrl + shift + p, TSLint: Fix all auto fix ...

4. tslint error

the selector of compoent should have prefix 'xx'

去 tslint.json, 放下面这个就不检查了, 要检查就 true 然后后面写你的 logic

"directive-selector": [false, "attribute", "myprefix", "camelCase"],
"component-selector": [false, "element", "myprefix", "kebab-case"],
 
let x :string = null! 
如果你清楚自己在干嘛的话可以无视这个检查的.
"no-non-null-assertion": false,
 
如果你不喜欢 const 的话
use const instead of let
"prefer-const": false 
 
 
5.
yarn global add tslint typescript
yarn add tslint typescript --dev
tslint --fix -c ./tslint.json 'projects/admin/**/*{.ts,.tsx}'
 
  1. {
  2. "rulesDirectory": [
  3. "node_modules/codelyzer"
  4. ],
  5. "rules": {
  6. "arrow-return-shorthand": true,
  7. "callable-types": true,
  8. "class-name": true,
  9. "comment-format": [
  10. true,
  11. "check-space"
  12. ],
  13. "curly": true,
  14. "deprecation": {
  15. "severity": "warn"
  16. },
  17. "eofline": true,
  18. "forin": true,
  19. "import-blacklist": [
  20. true,
  21. "rxjs/Rx"
  22. ],
  23. "import-spacing": true,
  24. "indent": [
  25. true,
  26. "spaces"
  27. ],
  28. "interface-over-type-literal": true,
  29. "label-position": true,
  30. "max-line-length": [
  31. false,
  32. 140
  33. ],
  34. "member-access": false,
  35. "member-ordering": [
  36. true,
  37. {
  38. "order": [
  39. "static-field",
  40. "instance-field",
  41. "static-method",
  42. "instance-method"
  43. ]
  44. }
  45. ],
  46. "no-arg": true,
  47. "no-bitwise": true,
  48. "no-console": [
  49. true,
  50. "debug",
  51. "info",
  52. "time",
  53. "timeEnd",
  54. "trace"
  55. ],
  56. "no-construct": true,
  57. "no-debugger": true,
  58. "no-duplicate-super": true,
  59. "no-empty": false,
  60. "no-empty-interface": true,
  61. "no-eval": true,
  62. "no-inferrable-types": [
  63. true,
  64. "ignore-params"
  65. ],
  66. "no-misused-new": true,
  67. "no-non-null-assertion": false,
  68. "no-shadowed-variable": true,
  69. "no-string-literal": false,
  70. "no-string-throw": true,
  71. "no-switch-case-fall-through": true,
  72. "no-trailing-whitespace": true,
  73. "no-unnecessary-initializer": true,
  74. "no-unused-expression": true,
  75. "no-use-before-declare": true,
  76. "no-var-keyword": true,
  77. "object-literal-sort-keys": false,
  78. "one-line": [
  79. true,
  80. "check-open-brace",
  81. "check-catch",
  82. "check-else",
  83. "check-whitespace"
  84. ],
  85. "prefer-const": true,
  86. "quotemark": [
  87. true,
  88. "single"
  89. ],
  90. "radix": true,
  91. "semicolon": [
  92. true,
  93. "always"
  94. ],
  95. "triple-equals": [
  96. false,
  97. "allow-null-check"
  98. ],
  99. "typedef-whitespace": [
  100. true,
  101. {
  102. "call-signature": "nospace",
  103. "index-signature": "nospace",
  104. "parameter": "nospace",
  105. "property-declaration": "nospace",
  106. "variable-declaration": "nospace"
  107. }
  108. ],
  109. "unified-signatures": true,
  110. "variable-name": false,
  111. "whitespace": [
  112. true,
  113. "check-branch",
  114. "check-decl",
  115. "check-operator",
  116. "check-separator",
  117. "check-type"
  118. ],
  119. "no-output-on-prefix": true,
  120. "use-input-property-decorator": true,
  121. "use-output-property-decorator": true,
  122. "use-host-property-decorator": true,
  123. "no-input-rename": true,
  124. "no-output-rename": true,
  125. "use-life-cycle-interface": true,
  126. "use-pipe-transform-interface": true,
  127. "component-class-suffix": true,
  128. "directive-class-suffix": true,
  129. "directive-selector": [false, "attribute", "myprefix", "camelCase"],
  130. "component-selector": [false, "element", "myprefix", "kebab-case"]
  131. }
  132. }
 
 
 
 
 

不会 tsconfig | tslint 常遇到的问题的更多相关文章

  1. Karma与TSLint

    TSLint TSLint是一个可扩展的静态分析工具,用于检查TypeScript代码的可读性,可维护性和功能性错误.收到现代编辑和构建系统的广泛支持,并且可以使用您自己的路由,配置和格式化. 安装 ...

  2. React Native工程中TSLint静态检查工具的探索之路

    建立的代码规范没人遵守,项目中遍地风格迥异的代码,你会不会抓狂? 通过测试用例的程序还会出现Bug,而原因仅仅是自己犯下的低级错误,你会不会抓狂? 某种代码写法存在问题导致崩溃时,只能全工程检查代码, ...

  3. tsconfig.json配置说明

    配置 tsconfig.json tsconfig.json 所包含的属性并不多,只有 7 个,ms 官方也给出了它的定义文件.但看起来并不怎么舒服,这里就翻译整理一下.(若有误,还请指出) file ...

  4. Typescript + TSLint + webpack 搭建 Typescript 的开发环境

    (1)初始化项目 新建一个文件夹“client-side”,作为项目根目录,进入这个文件夹: 我们先使用 npm 初始化这个项目: 这时我们看到了在根目录下已经创建了一个 package.json 文 ...

  5. JS中常遇到的浏览器兼容问题和解决方法

    今天整理了一下浏览器对JS的兼容问题,希望能给你们带来帮助,我没想到的地方请留言给我,我再加上: 常遇到的关于浏览器的宽高问题: //以下均可console.log()实验 var winW=docu ...

  6. 常看常遇见之一——BS架构VS CS架构

    常看常遇见之一——BS架构VS CS架构 1.BS架构 即Browser/Server(浏览器/服务器)结构,是随着Internet技术的兴起,对C/S结构的一种变化或者改进的结构.在这种结构下,用户 ...

  7. JS中常遇到的浏览器兼容问题和解决方法【转】

    今天整理了一下浏览器对JS的兼容问题,希望能给你们带来帮助,我没想到的地方请留言给我,我再加上: 常遇到的关于浏览器的宽高问题: //以下均可console.log()实验 var winW=docu ...

  8. 在package.json中配置Script执行npm run tslint报错问题

    今天在学习tslint的时候,按照git clone下angular2-webpack-starter的代码执行npm run lint时,虽然代码进行了检测,但检测完成后npm始终报错, //pac ...

  9. TSLint提示错误

    要成为优秀的TS开发人员,必须直接禁用TS的不良特性. 为此,道爷亲自操刀编写了TSLint工具,用来分析我们的TS代码,把潜在的Bug和不良代码全部找出来. 目的是为了保证TS的质量,但是存在的问题 ...

随机推荐

  1. java热加载之springloaded

    https://github.com/spring-projects/spring-loaded/wiki

  2. 20165310 NstSec2019 Week1 Exp0 Kali安装

    20165310 NstSec2019 Week1 Exp0 Kali安装 Kali下载与安装 进入Kali官网 ,进入Download选项,选择Kali Linux 64 bit VMware VM ...

  3. git博客好的例子

    01: https://github.com/Gaohaoyang/gaohaoyang.github.io 02: https://gaohaoyang.github.io/2018/06/01/a ...

  4. 题说proxy

    昨天在和群友讨论时遇到一题是这样的. 题目描述 //Tomy非常敏感,不喜欢别人碰他的东西.一旦有人碰他就会大喊Don't Touch Me. //完成tomy这个对象,禁止对tomy的内容进行修改( ...

  5. Duilib嵌入CEF出现窗口显示不正常

    参考资料:https://www.aliyun.com/zixun/wenji/1247250.html 转载:https://www.cnblogs.com/gongxijun/p/4857977. ...

  6. vector at()函数比 []运算符操作安全

    转载:https://blog.csdn.net/chenjiayi_yun/article/details/18507659 []操作符的源码 reference operator[](size_t ...

  7. 尚硅谷面试第一季-11MyBatis中当实体类中的属性名和表中的字段名不一样怎么办

    问题: MyBatis中当实体类中的属性名和表中的字段名不一样 ,怎么办 ? 解决方案: 1.写sql语句时起别名 <!-- id属性:必须是接口中方法的方法名 resultType属性:必须是 ...

  8. Python3基础 list append 向尾部添加一个元素

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  9. selinux权限问题【转】

    本文转载自:https://blog.csdn.net/u011386173/article/details/83339770 版权声明:本文为博主原创文章,未经博主允许不得转载. https://b ...

  10. 解决Win10 Git图标不显示问题

    升级系统到win10 1803版本以后发现TortoiseGit的忽略图标不显示了 开始以为是版本问题,将TortoiseGit版本进行了升级还是不行 网上查找以后发现 Windows Explore ...