UNPKG

3.62 kBMarkdownView Raw
1# tsconfig
2
3[![NPM Version](https://badge.fury.io/js/%40chatie%2Ftsconfig.svg)](https://www.npmjs.com/package/@chatie/tsconfig)
4[![npm (tag)](https://img.shields.io/npm/v/%40chatie/tsconfig/next.svg)](https://www.npmjs.com/package/@chatie/tsconfig?activeTab=versions)
5[![Build Status](https://travis-ci.com/Chatie/tsconfig.svg?branch=master)](https://travis-ci.com/Chatie/tsconfig)
6[![Greenkeeper badge](https://badges.greenkeeper.io/Chatie/tsconfig.svg)](https://greenkeeper.io/)
7
8![tsconfig.json](https://chatie.github.io/tsconfig/images/typescript-tsconfig-json.jpg)
9
10> Picture: [What is tsconfig.json](https://www.kunal-chowdhury.com/2018/05/typescript-tutorial-tsconfig-json.html)
11
12Reusable TypeScript configuration files to extend from.
13
14This module enables other module to inheritance tsconfig.json via Node.js packages
15
16## USAGE
17
18Extends from `@chatie/tsconfig` from your tsconfig.json, to have the chatie version of the TypeScript Configuration.
19
20It aim the following goals:
21
221. Support the latest `esnext` ECMAScript
231. Targeting for `ES6`
241. Strict for everything
251. Aiming for Convenience, including the `esModuleInterop` and `resolveJsonModule` etc.
26
27### CAUTION
28
29Do not put any directory related configurations into this module.
30Only put directory related configurations to the consumer of this module.
31
32Because all directory in tsconfig.json is related to the curfrent directory.
33
34## SEE ALSO
35
36- [TypeScript 3.2 - tsconfig.json inheritance via Node.js packages](https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#tsconfigjson-inheritance-via-nodejs-packages)
37
38> TypeScript 3.2 now resolves tsconfig.jsons from node_modules. When using a bare path for the "extends" field in tsconfig.json, TypeScript will dive into node_modules packages for us.
39>
40> ```json
41> {
42> "extends": "@my-team/tsconfig-base",
43> "include": ["./**/*"]
44> "compilerOptions": {
45> // Override certain options on a project-by-project basis.
46> "strictBindCallApply": false,
47> }
48> }
49> ```
50>
51> Here, TypeScript will climb up node_modules folders looking for a @my-team/tsconfig-base package. For each of those packages, TypeScript will first check whether package.json contains a "tsconfig" field, and if it does, TypeScript will try to load a configuration file from that field. If neither exists, TypeScript will try to read from a tsconfig.json at the root. This is similar to the lookup process for .js files in packages that Node uses, and the .d.ts lookup process that TypeScript already uses.
52>
53> This feature can be extremely useful for bigger organizations, or projects with lots of distributed dependencies.
54>
55
56## DEPENDENCES
57
58This module will run a unit test before it could be able to publish to NPM.
59
60The unit test load tsconfig schema from [JSON Schema Store](http://schemastore.org/) and then use [is-my-json-valid](https://www.npmjs.com/package/is-my-json-valid) to validate it.
61
62## HISTORY
63
64### v0.7 (master)
65
66### v0.6 June 08 2019
67
681. Auto generate `tsconfig.json` in project root directory after install if it not exists.
69
70### v0.4 May 14 2019
71
721. Only publish `tsconfig.json` to NPM to prevent strange bugs
731. Create a tsconfig base setting module for sharing across projects
74
75## AUTHOR
76
77[Huan LI (李卓桓)](http://linkedin.com/in/zixia) <zixia@zixia.net>
78
79[![Profile of Huan LI (李卓桓) on StackOverflow](https://stackexchange.com/users/flair/265499.png)](https://stackexchange.com/users/265499)
80
81## COPYRIGHT & LICENSE
82
83- Code & Docs © 2019 - now Huan LI <zixia@zixia.net>
84- Code released under the Apache-2.0 License
85- Docs released under Creative Commons