UNPKG

3.87 kBMarkdownView Raw
1# tslint-config-prettier
2
3[![npm](https://img.shields.io/npm/v/tslint-config-prettier.svg)](https://www.npmjs.com/package/tslint-config-prettier)
4[![Travis](https://img.shields.io/travis/alexjoverm/tslint-config-prettier.svg)](https://travis-ci.org/alexjoverm/tslint-config-prettier)
5[![downloads](https://img.shields.io/npm/dm/tslint-config-prettier.svg)](https://www.npmjs.com/package/tslint-config-prettier)
6[![David](https://img.shields.io/david/alexjoverm/tslint-config-prettier.svg)]()
7[![David](https://img.shields.io/david/dev/alexjoverm/tslint-config-prettier.svg)]()
8[![Greenkeeper badge](https://badges.greenkeeper.io/alexjoverm/tslint-config-prettier.svg)](https://greenkeeper.io/)
9
10<h3> :cop: tslint + :nail_care: prettier = :heart_eyes: </h3>
11
12Do you want to use [tslint](https://palantir.github.io/tslint/) and [prettier](https://github.com/prettier/prettier) without conflicts? tslint-config-prettier disables all conflicting rules that may cause such problems. Prettier takes care of the formatting whereas tslint takes care of all the other things.
13
14> Check how it works in **[this tutorial](https://alexjoverm.github.io/2017/06/12/Use-Prettier-with-TSLint-and-be-happy/)**.
15
16### Get started
17
18```bash
19npm install -D tslint-config-prettier
20```
21
22Make sure you've already set up [tslint](https://palantir.github.io/tslint/) and [prettier](https://github.com/prettier/prettier).
23
24Then, extend your `tslint.json`, and make sure `tslint-config-prettier` is **at the end**:
25
26```json
27{
28 "extends": [
29 "tslint:latest",
30 "tslint-config-prettier"
31 ]
32}
33```
34
35### More configuration
36
37`tslint-config-prettier` also turns off formatting rules from the following rulesets, so you can use them safely.
38
39- [codelyzer](https://github.com/mgechev/codelyzer)
40- [tslint](https://github.com/palantir/tslint)
41- [tslint-consistent-codestyle](https://github.com/ajafff/tslint-consistent-codestyle)
42- [tslint-divid](https://github.com/jonaskello/tslint-divid)
43- [tslint-eslint-rules](https://github.com/buzinas/tslint-eslint-rules)
44- [tslint-immutable](https://github.com/jonaskello/tslint-immutable)
45- [tslint-microsoft-contrib](https://github.com/Microsoft/tslint-microsoft-contrib)
46- [tslint-misc-rules](https://github.com/jwbay/tslint-misc-rules)
47- [tslint-plugin-ikatyang](https://github.com/ikatyang/tslint-plugin-ikatyang)
48- [tslint-react](https://github.com/palantir/tslint-react)
49- [vrsource-tslint-rules](https://github.com/vrsource/vrsource-tslint-rules)
50
51```json
52{
53 "extends": [
54 "tslint:latest",
55 "tslint-react",
56 "tslint-eslint-rules",
57 "tslint-config-prettier"
58 ]
59}
60```
61
62### CLI helper tool
63
64`tslint-config-prettier` is shipped with a little CLI tool to help you check if your configuration contains any rules that are in conflict with Prettier. (require `tslint` installed)
65
66In order to execute the CLI tool, first add a script for it to `package.json`:
67
68```json
69{
70 "scripts": {
71 "tslint-check": "tslint-config-prettier-check ./tslint.json"
72 }
73}
74```
75
76Then run `npm run tslint-check`.
77
78### Tutorials
79
80- [Using TSlint with Prettier](https://alexjoverm.github.io/2017/06/12/Use-Prettier-with-TSLint-and-be-happy/)
81- [Use Prettier with TSLint without conflicts (video)](https://egghead.io/lessons/typescript-use-prettier-with-tslint-without-conflicts-c39670eb/)
82
83### Contributing
84
85Please read [CONTRIBUTING.md](https://github.com/alexjoverm/tslint-config-prettier/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
86
87### Related
88
89- [tslint-plugin-prettier](https://github.com/ikatyang/tslint-plugin-prettier) - Runs Prettier as a TSLint rule and reports differences as individual TSLint issues.
90
91### Credits
92
93Made with :heart: by [@alexjoverm](https://twitter.com/alexjoverm) and all its [contributors](https://github.com/alexjoverm/tslint-config-prettier/graphs/contributors)