From 0a0f78f144fa3e4b1087550785d7dc90f356fde2 Mon Sep 17 00:00:00 2001 From: Foxandxss Date: Mon, 23 May 2016 15:39:55 +0200 Subject: [PATCH] docs(style-guide): make barrels a consider closes #1482 --- public/docs/ts/latest/guide/style-guide.jade | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/public/docs/ts/latest/guide/style-guide.jade b/public/docs/ts/latest/guide/style-guide.jade index 244ee86f62..37586f1cce 100644 --- a/public/docs/ts/latest/guide/style-guide.jade +++ b/public/docs/ts/latest/guide/style-guide.jade @@ -1175,13 +1175,13 @@ a(href="#toc") Back to top #### Style 04-10 -.s-rule.do +.s-rule.consider :marked - **Do** create a file that imports, aggregates, and re-exports items. We call this technique a **barrel**. + **Consider** creating a file that imports, aggregates, and re-exports items. We call this technique a **barrel**. -.s-rule.do +.s-rule.consider :marked - **Do** name this barrel file `index.ts`. + **Consider** naming this barrel file `index.ts`. .s-why :marked @@ -1190,6 +1190,14 @@ a(href="#toc") Back to top .s-why :marked **Why?** A barrel reduces the number of imports a file may need. + +.s-why + :marked + **Why?** A barrel provides a consistent pattern to import everything exported in the barrel from a folder. + +.s-why + :marked + **Why?** This is consistent with a pattern from Node, which imports the index.js|ts file from a folder. .s-why.s-why-last :marked