webstorm设置

settings >> TypeScript >> TSLint, 勾选 Enable ,选取 tslint包路径...npm\node_modules\tslint,这里webstorm基本会自动读取

配置tslint.json

{
"rules": {
// TS特性
"member-access": true, // 设置成员对象的访问权限(public,private,protect)
"member-ordering": [// 设置修饰符顺序
true,
{
"order": [
"public-static-field",
"public-static-method",
"protected-static-field",
"protected-static-method",
"private-static-field",
"private-static-method",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"public-constructor",
"protected-constructor",
"private-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
]
}
],
"no-empty-interface":true,// 不允许空接口
"no-parameter-reassignment":true,// 不允许修改方法输入参数
"prefer-for-of":true,// 如果for循环中没有使用索引,建议是使用for-of // 功能特性
"await-promise":true,// 不允许没有Promise的情况下使用await
"curly":true,// if/for/do/while强制使用大括号
"forin":true,// 使用for in语句时,强制进行hasOwnProperty检查
"no-arg":true,// 不允许使用arguments.callee
// "no-bitwise":true, // 不允许使用特殊运算符 &, &=, |, |=, ^, ^=, <<, <<=, >>, >>=, >>>, >>>=, ~
"no-conditional-assignment":true,// do while/for/if/while 语句中将会对例如if(a=b)进行检查
// "no-console":true,// 不允许使用console对象
"no-debugger":true,// 不允许使用debugger
"no-duplicate-super":true,// 不允许super() 两次使用在构造函数中
"no-empty":true,// 函数体不允许空
"no-eval":true,// 不允许使用eval
"no-for-in-array":true,// 不允许对Array使用for-in
"no-invalid-template-strings":true,// 只允许在模板字符串中使用${
"no-invalid-this":true,// 不允许在class之外使用this
"no-null-keyword":true,// 不允许使用null,使用undefined代替null,指代空指针对象
"no-sparse-arrays":true,// 不允许array中有空元素
"no-string-throw":true,// 不允许throw一个字符串
"no-switch-case-fall-through":true,// 不允许case段落中在没有使用breack的情况下,在新启一段case逻辑
"no-unsafe-finally":true,// 不允许在finally语句中使用return/continue/break/throw
"no-unused-expression":true,// 不允许使用未使用的表达式
"no-use-before-declare":true,// 在使用前必须声明
"no-var-keyword":true,// 不允许使用var
"radix":true,// parseInt时,必须输入radix精度参数
"restrict-plus-operands":true,// 不允许自动类型转换,如果已设置不允许使用关键字var该设置无效
"triple-equals":true,// 必须使用恒等号,进行等于比较
"use-isnan":true,// 只允许使用isNaN方法检查数字是否有效 // 维护性功能
"indent":[true, "spaces", 4],// 每行开始以4个空格符开始
"linebreak-style":[true,"CR/LF"],// 换行符格式 CR/LF可以通用使用在windows和osx
"max-classes-per-file":[true,1],// 每个文件中可定义类的个数
"max-file-line-count":[true,500],// 定义每个文件代码行数
"max-line-length":[true,120],// 定义每行代码数
"no-default-export":true,// 禁止使用export default关键字,因为当export对象名称发生变化时,需要修改import中的对象名。https://github.com/palantir/tslint/issues/1182#issue-151780453
"no-duplicate-imports":true,// 禁止在一个文件内,多次引用同一module // 格式
"align":[true,"parameters","arguments","statements","members","elements"],// 定义对齐风格
"array-type":[true,"array"],// 建议使用T[]方式声明一个数组对象
"class-name":true,// 类名以大驼峰格式命名
"comment-format":[true, "check-space"],// 定义注释格式
"encoding":true,// 定义编码格式默认utf-8
"import-spacing":true,// import关键字后加空格
"interface-name":[true,"always-prefix"],// interface必须以I开头
"jsdoc-format":true,// 注释基于jsdoc风格
"new-parens":true,// 调用构造函数时需要用括号
"no-consecutive-blank-lines":[true,2],// 不允许有空行
"no-trailing-whitespace": [// 不允许空格结尾
true,
"ignore-comments",
"ignore-jsdoc"
],
"no-unnecessary-initializer":true,// 不允许没有必要的初始化
"variable-name":[true,"check-format",// 定义变量命名规则
"allow-leading-underscore",
"allow-trailing-underscore",
"ban-keywords"]
}
}

webstorm tslint配置的更多相关文章

  1. 浅入深出Vue:工具准备之WebStorm安装配置

    浅入深出Vue之工具准备(一):WebStorm安装配置 工欲善其事必先利其器,让我们先做好准备工作吧 导航篇 WebStorm安装配置 所有工具的下载地址都可以在导航篇中找到,这里我们下载的是最新版 ...

  2. 在webstorm中配置sass的自动编译,并且可以指定编译后的css的目录.

    参考: WebStorm-2018.2-Help-Sass, Less, and SCSS 作者:tobyDing链接:https://www.jianshu.com/p/0fe52f149cab來源 ...

  3. WebStorm中配置node.js(Windows)

    WebStorm中配置node.js(Windows) 一.node 1.下载安装包 32 位 : https://nodejs.org/dist/v4.4.3/node-v4.4.3-x86.msi ...

  4. Hbuider sass配置 webstorm scss配置

    --no-cache %FileName% ../css/%FileBaseName%.css   sass编译后保存到css目录下 webstorm scss配置 C:\Ruby22-x64\bin ...

  5. node.js + webstorm :配置开发环境

    一.配置开发环境: 1.先安装node (1).访问http://nodejs.org打开安装包,正常安装,点击next即可. 为了测试是否安装成功,打开命令提示符,输入node,则进入node.js ...

  6. WebStorm常用配置

    设置 快捷键设置 可以采用多种风格,这里采用Visual Studio风格,便于习惯使用其它IDE的用户迁移. JavaScript版本设置 JavaScript的主流版本已升至ESMAScript6 ...

  7. WebStorm里面配置运行React Native的方案

    以前开发react native项目总是需要打开WebStorm编写代码,Xcode跑项目.显得有点多余. 今天教大家如何直接使用WebStorm这个IDE直接完成编码+运行项目工作.这样就可以不用打 ...

  8. webstorm 10 配置

    小弟以前都是用sublime,sublime是一款轻量级的文本编辑器.但是现在要隆重介绍的前端开发工具webstorm,为什么说它是前端开发工具,而不是前端开发编辑器呢?它具备的功能,不只只是编辑器这 ...

  9. webstorm 如何配置git

    2016-09-22 15:00:25 补充js 操作后 发现工具自动生成了两个文件,如果提交到git上 会造成不必要的麻烦,看看怎么去掉产生这个的原因吧! 去掉对应的监听:http://fronte ...

随机推荐

  1. WePY框架 input,checkbox-group,radio-group等change 一般处理方法

    布局搞定了,接下来就是数据处理方面了 form表单中常用标签,绑定change方法: 方法的具体实现 根据打印出来e的结果可以看到,e指代当前标签对象,包含属性方法等 从detail中可以获取多选框选 ...

  2. Ali_Cloud++:阿里云服务器防火墙相关命令

    systemctl start firewalld ##启动Firewall systemctl stop firewalld ##关闭Firewall systemctl restart firew ...

  3. kerberos系列之flink认证配置

    大数据安全系列的其它文章 https://www.cnblogs.com/bainianminguo/p/12548076.html-----------安装kerberos https://www. ...

  4. 改进ls的实现

    一.要求 参见附图,改进你的ls的实现.提交代码运行截图和码云链接 二.步骤 目录 ls 功能:列出目录内容,显示文件信息 ls -l:显示当前工作目录下包含目录及属性详细信息(共7列) 第一列:文件 ...

  5. 延时对象promise的使用

    promise是ES6(ECMA Script6)的新标准,只能在支持ES6的浏览器中使用 Promise是一个延时对象,创建延时对象时需要传入一个函数类型的参数 这个函数有两个参数:resolve和 ...

  6. 不可被忽视的操作系统( FreeRTOS )【2】

    本文章总结基于官方FreeRTOS手册,测试系统为ESP32的IDF 4.0 本篇续上一篇<不可被忽视的操作系统( FreeRTOS )[1]> 其中上一篇主要内容为: FreeRTOS介 ...

  7. jvm的类加载机制总结

    类的加载机制分为如下三个阶段:加载,连接,初始化.其中连接又分为三个小阶段:验证,准备,解析. 加载阶段 将类的.class文件中的二进制数据读入到内存中,将其放在运行时数据区的方法区内,然后再堆内创 ...

  8. # H - H HDU - 2066 (多起点、多终点问题)

    H - H HDU - 2066 (多源点.多汇点问题) 一个图上,有M条边,Z个出发点,Y个终止点.求一条最短路,其中起点是Z中的任意一点,终点是Y中任意一点. Input 输入数据有多组,输入直到 ...

  9. eclipse常用功能及快捷键

    1.更改默认字体 Window->Preferences->General->Appearance->Colorsand Fonts ->Basics->Text ...

  10. 1030 Travel Plan (30分)(dijkstra 具有多种决定因素)

    A traveler's map gives the distances between cities along the highways, together with the cost of ea ...