不会 tsconfig | tslint 常遇到的问题
1. require('xx-xx') 不能用时
https://stackoverflow.com/questions/31173738/typescript-getting-error-ts2304-cannot-find-name-require
"compilerOptions": {
// other options
"types": [
"node"
]
}
2.第三方 type 用不到时, 比如 hammerjs
https://github.com/angular/material2/issues/1944
{
"compilerOptions": {
// other typescript options
"types": [
"hammerjs"
]
}
}
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
yarn global add tslint typescript
yarn add tslint typescript --dev
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
false,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": false,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
false,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"no-output-on-prefix": true,
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"directive-selector": [false, "attribute", "myprefix", "camelCase"],
"component-selector": [false, "element", "myprefix", "kebab-case"]
}
}
不会 tsconfig | tslint 常遇到的问题的更多相关文章
- Karma与TSLint
TSLint TSLint是一个可扩展的静态分析工具,用于检查TypeScript代码的可读性,可维护性和功能性错误.收到现代编辑和构建系统的广泛支持,并且可以使用您自己的路由,配置和格式化. 安装 ...
- React Native工程中TSLint静态检查工具的探索之路
建立的代码规范没人遵守,项目中遍地风格迥异的代码,你会不会抓狂? 通过测试用例的程序还会出现Bug,而原因仅仅是自己犯下的低级错误,你会不会抓狂? 某种代码写法存在问题导致崩溃时,只能全工程检查代码, ...
- tsconfig.json配置说明
配置 tsconfig.json tsconfig.json 所包含的属性并不多,只有 7 个,ms 官方也给出了它的定义文件.但看起来并不怎么舒服,这里就翻译整理一下.(若有误,还请指出) file ...
- Typescript + TSLint + webpack 搭建 Typescript 的开发环境
(1)初始化项目 新建一个文件夹“client-side”,作为项目根目录,进入这个文件夹: 我们先使用 npm 初始化这个项目: 这时我们看到了在根目录下已经创建了一个 package.json 文 ...
- JS中常遇到的浏览器兼容问题和解决方法
今天整理了一下浏览器对JS的兼容问题,希望能给你们带来帮助,我没想到的地方请留言给我,我再加上: 常遇到的关于浏览器的宽高问题: //以下均可console.log()实验 var winW=docu ...
- 常看常遇见之一——BS架构VS CS架构
常看常遇见之一——BS架构VS CS架构 1.BS架构 即Browser/Server(浏览器/服务器)结构,是随着Internet技术的兴起,对C/S结构的一种变化或者改进的结构.在这种结构下,用户 ...
- JS中常遇到的浏览器兼容问题和解决方法【转】
今天整理了一下浏览器对JS的兼容问题,希望能给你们带来帮助,我没想到的地方请留言给我,我再加上: 常遇到的关于浏览器的宽高问题: //以下均可console.log()实验 var winW=docu ...
- 在package.json中配置Script执行npm run tslint报错问题
今天在学习tslint的时候,按照git clone下angular2-webpack-starter的代码执行npm run lint时,虽然代码进行了检测,但检测完成后npm始终报错, //pac ...
- TSLint提示错误
要成为优秀的TS开发人员,必须直接禁用TS的不良特性. 为此,道爷亲自操刀编写了TSLint工具,用来分析我们的TS代码,把潜在的Bug和不良代码全部找出来. 目的是为了保证TS的质量,但是存在的问题 ...
随机推荐
- atomic 原子操作
原子操作:操作仅由一个独立的CPU指令代表和完成.保证并发环境下原子操作的绝对安全 标准库代码包:sync/atomic atomic是最轻量级的锁,在一些场景下直接使用atomic包还是很有效的 C ...
- mysql 5.7多源复制(用于生产库多主库合并到一个查询从库)
目前我们使用的是主从+分库分表的系统架构,主库有N个分库,从库为多个slave做负载均衡,所以数据库端的架构是下面这样的: 因为差不多有一年半没有专门搞技术为主了,顺带回顾下. 这就涉及到多个主库数据 ...
- centos6下jbd2进程占用大量IO处理
刚在尝试重现一个bug时,好像在killed mysql一段时间之后,io一直很高,如下: 12:40:01 PM CPU %user %nice %system %iowait %steal %id ...
- 【题解】Luogu P1503 鬼子进村
平衡树好题 原题传送门 这道题要用Splay,我博客里有对Splay的详细介绍 这道题思维有点难,要把被摧毁的节点插入平衡树,而不是把没有摧毁的节点插入 先把0和n+1插入平衡树,作为边界 操作1:摧 ...
- json排序 及替换在字符串中全部替换某字符串
var roadLine = '@ViewBag.RoadLine'; var jsonRoadLine = JSON.parse(roadLine.replace(/"/g, '\&quo ...
- 用Navicat for Mysql导入.sql文件
1.在左边右键新建一个数据库 2.字符集选gbk(不 题) 3.打开数据库,把它变成绿色. 4.把.sql文件拖到这数据库上.会出现下边的运行SQL文件对话框,按开始,等运行完后就可以关掉了. 5.最 ...
- 使用Selenium+Java+Juint实现移动web端自动化的代码实现
浏览器: Chrome 首先通过developer模式查看Chrome浏览器支持哪些手机,如图: 在代码中使用ChromeOptions对象的addArguments方法来设置参数,如下代码所示: p ...
- 设置Eclipse具有字母自动联想
Window->Preferences->Java->Editor->ContentAssist(内容助手)里面的Enable auto activation里面第二行再加上a ...
- repo forall -c 用法【转】
本文转载自:https://blog.csdn.net/u010164190/article/details/78332484 .repo forall命令 # repo forall -help # ...
- js变量按照存储方式区分,有哪些类型,并表述其特点
// 值类型 拷贝形式 不像引用类型是指针指向,共用空间 值类型有 undefined string number Boolean var a = 100; var b = a; var a = 20 ...