TSLint-ESLint 规则项目教程

TSLint-ESLint 规则项目教程

tslint-eslint-rulesImprove your TSLint with the missing ESLint rules项目地址:https://gitcode.com/gh_mirrors/ts/tslint-eslint-rules

1. 项目的目录结构及介绍

tslint-eslint-rules/
├── src/
│   ├── rules/
│   │   ├── index.ts
│   │   └── ... (其他规则文件)
│   └── index.ts
├── tests/
│   ├── rules/
│   │   └── ... (测试文件)
│   └── index.ts
├── .gitignore
├── .npmignore
├── .travis.yml
├── LICENSE
├── package.json
├── README.md
└── tsconfig.json
  • src/: 包含所有规则的源代码。
    • rules/: 包含各个具体的规则文件。
    • index.ts: 规则的入口文件。
  • tests/: 包含所有规则的测试代码。
    • rules/: 包含各个规则的测试文件。
    • index.ts: 测试的入口文件。
  • .gitignore: Git 忽略文件配置。
  • .npmignore: npm 发布时忽略的文件配置。
  • .travis.yml: Travis CI 配置文件。
  • LICENSE: 项目许可证。
  • package.json: 项目依赖和脚本配置。
  • README.md: 项目说明文档。
  • tsconfig.json: TypeScript 编译配置。

2. 项目的启动文件介绍

项目的启动文件位于 src/index.ts,该文件主要负责导出所有规则,使得其他项目可以通过引入该文件来使用这些规则。

// src/index.ts
import * as rules from './rules';

export = {
  rules: rules
};

3. 项目的配置文件介绍

package.json

package.json 文件包含了项目的依赖、脚本和其他元数据。

{
  "name": "tslint-eslint-rules",
  "version": "5.4.0",
  "description": "TSLint rules for ESLint users",
  "main": "index.js",
  "scripts": {
    "test": "npm run build && mocha",
    "build": "tsc"
  },
  "keywords": [
    "tslint",
    "eslint",
    "rules"
  ],
  "author": "Efren Aguirre",
  "license": "MIT",
  "devDependencies": {
    "@types/chai": "^4.1.4",
    "@types/mocha": "^5.2.5",
    "chai": "^4.1.2",
    "mocha": "^5.2.0",
    "tslint": "^5.11.0",
    "typescript": "^3.0.3"
  }
}

tsconfig.json

tsconfig.json 文件包含了 TypeScript 编译的配置。

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "outDir": "./dist",
    "rootDir": "./src",
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "esModuleInterop": true
  },
  "include": [
    "src/**/*"
  ]
}

通过以上配置,项目可以顺利编译和运行,同时也方便了开发者对规则的维护和扩展。

tslint-eslint-rulesImprove your TSLint with the missing ESLint rules项目地址:https://gitcode.com/gh_mirrors/ts/tslint-eslint-rules

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

喻昊沙Egerton

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值