ts-barrelr automates the production of index.ts barrel files.
ts-barrelr will produce an index.ts containing all files and folders within the folder containing the current file open in the editor window.
There are two ways to trigger barrelr:
- Select the barrel action from the actions menu or use the keybinds
ctrl-alt-b
/cmd-alt-b
with a file open to create anindex.ts
in the folder of the currently open file:
Running the command again will update the barrel with any new or changed files.
By default barrelr will include any files with a .ts
or .tsx
extension but this can be configured via the setting barrelr.fileExtensionRegex
By default ts-barrelr will use single quotes as the default quotemark for imports in index.ts files. This can be changed to double quotes using the setting: barrelr.useDoubleQuotes
By default ts-barrelr will add semi colons at the end of each line, if you want to disable this you can use the setting: barrelr.useSemiColons
By default ts-barrelr will use Windows style line endings CRLF
, if you want to use Linux style use LF
: barrelr.lineEnding
By default ts-barrelr will exclude any files containing .spec., .e2e. or .test. This can be changed as a regular expression by changing the setting: barrelr.excludeFileRegex