Skip to content

Commit ce771de

Browse files
committed
Update Prettier + TSLint section
1 parent 51daf4d commit ce771de

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,54 @@ For developing with Storybook, read the docs I maintain over here: <https://stor
439439

440440
We have an active discussion on Linting [here](https://github.com/sw-yx/react-typescript-cheatsheet/issues/7).
441441

442+
To user prettier with TSLint you will need [`tslint-config-prettier`](https://github.com/alexjoverm/tslint-config-prettier) which disables all conflicting rules and optionally [`tslint-plugin-prettier`](https://github.com/ikatyang/tslint-plugin-prettier) which will highlight differences as TSLint issues.
443+
444+
Example configuration:
445+
446+
<table>
447+
<tr>
448+
<th>
449+
<strong>tslint.json</strong>
450+
</th>
451+
<th>
452+
<strong>.prettierrc</strong>
453+
</th>
454+
</tr>
455+
<tr>
456+
<td>
457+
<pre>
458+
{
459+
"rulesDirectory": ["tslint-plugin-prettier"],
460+
"extends": [
461+
"tslint:recommended",
462+
"tslint-config-prettier"
463+
],
464+
"linterOptions": {
465+
"exclude": ["node_modules/**/*.ts"]
466+
},
467+
"rules": {
468+
"prettier": true
469+
}
470+
}
471+
</pre>
472+
</td>
473+
<td>
474+
<pre>
475+
{
476+
"printWidth": 89,
477+
"tabWidth": 2,
478+
"useTabs": false,
479+
"semi": true,
480+
"singleQuote": true,
481+
"trailingComma": "all",
482+
"bracketSpacing": true,
483+
"jsxBracketSameLine": false
484+
}
485+
</pre>
486+
</td>
487+
</tr>
488+
</table>
489+
442490
## Working with Non-Typescript Libraries (writing your own index.d.ts)
443491

444492
*Not written yet.*

0 commit comments

Comments
 (0)