0.2.5 • Published 4 years ago

tslint-config-ali v0.2.5

Weekly downloads
10
License
MIT
Repository
-
Last release
4 years ago

注意:本包已废弃(由于 TSLint 被已废弃并迁移至 ESLint),请使用 eslint-config-ali/typescript 替代

Usage

1.依赖说明

本包依赖 typescripttslinttslint-react

2. 安装

npm install --save-dev tslint-config-ali

3. tslint.json 文件

支持的包

  • tslint-config-ali or tslint-config-ali/es6: ES6 相关语法规则
  • tslint-config-ali/react: React 相关语法规则(包含 ES6 相关语法规则)
  • tslint-config-ali/es5: ES5 相关语法规则
  • tslint-config-ali/common: 一些通用的语法规则,通常作为内部依赖包,不建议在项目中直接引用

找到工程的 tslint.json 以使用本包提供的 tslint 配置:

{
  "extends": ["tslint-config-ali"]
}

4. 自定义实现的规则

均未开启,需要手动开启 1. common/aliI18NRule:检测代码中的中文,防止国际化时遗漏 1. es6/aliMethodLengthRule:检测文件箭头函数的长度, 超过一定长度时, 给与相关提示。 控制代码行数,提高代码可阅读性。 1. es6/aliVariableStatementPositionRule:检测类前面定义的变量长度,超过一定值时,提醒放到类定义后面,提高diamante的阅读性 1. react/aliKeyRule:检测 react map 迭代 是否有 key, 如果没有, 给与相关提示, 防止没有 key 造成的数据没有重新渲染

5. 开发说明

  1. 自定义的 Rule,可以按照分类放在对应的目录中
rules
  ├── common
  ├── es5
  ├── es6
  └── react
  1. 入口文件为 src/rules 下的 json 文件,目前有
  • common.json
  • es5.json
  • es6.json 别名 index.json
  • react.json
  1. 命令行
  • 构建命令:npm run build
  • 发布命令:npm publish build/注意只发布 build 下的内容
0.2.5

4 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1-beta.1

5 years ago