Skip to content

Commit 37a0731

Browse files
jsjoeiojohnnyreilly
authored andcommitted
Fix Underscores in Headings (#1045)
* fix: propose table under heading * chore: update docs * fix: move options from heading into tables * chore: update docs * fix: remove extra colon in heading * chore: update docs
1 parent 232babc commit 37a0731

File tree

1 file changed

+108
-45
lines changed

1 file changed

+108
-45
lines changed

README.md

+108-45
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,28 @@
4545
* [`baseUrl` / `paths` module resolution](#baseurl--paths-module-resolution)
4646
* [Options](#options)
4747
* [Loader Options](#loader-options)
48-
+ [transpileOnly _(boolean) (default=false)_](#transpileonly-_boolean-defaultfalse_)
49-
+ [happyPackMode _(boolean) (default=false)_](#happypackmode-_boolean-defaultfalse_)
50-
+ [resolveModuleName and resolveTypeReferenceDirective:](#resolvemodulename-and-resolvetypereferencedirective)
51-
+ [getCustomTransformers _( (program: Program) => { before?: TransformerFactory[]; after?: TransformerFactory[]; } )_](#getcustomtransformers-_-program-program---before-transformerfactory-after-transformerfactory--_)
52-
+ [logInfoToStdOut _(boolean) (default=false)_](#loginfotostdout-_boolean-defaultfalse_)
53-
+ [logLevel _(string) (default=warn)_](#loglevel-_string-defaultwarn_)
54-
+ [silent _(boolean) (default=false)_](#silent-_boolean-defaultfalse_)
55-
+ [ignoreDiagnostics _(number[]) (default=[])_](#ignorediagnostics-_number-default_)
56-
+ [reportFiles _(string[]) (default=[])_](#reportfiles-_string-default_)
57-
+ [compiler _(string) (default='typescript')_](#compiler-_string-defaulttypescript_)
58-
+ [configFile _(string) (default='tsconfig.json')_](#configfile-_string-defaulttsconfigjson_)
59-
+ [colors _(boolean) (default=true)_](#colors-_boolean-defaulttrue_)
60-
+ [errorFormatter _((message: ErrorInfo, colors: boolean) => string) (default=undefined)_](#errorformatter-_message-errorinfo-colors-boolean--string-defaultundefined_)
61-
+ [compilerOptions _(object) (default={})_](#compileroptions-_object-default_)
62-
+ [instance _(string)_](#instance-_string_)
63-
+ [appendTsSuffixTo _(RegExp[]) (default=[])_](#appendtssuffixto-_regexp-default_)
64-
+ [appendTsxSuffixTo _(RegExp[]) (default=[])_](#appendtsxsuffixto-_regexp-default_)
65-
+ [onlyCompileBundledFiles _(boolean) (default=false)_](#onlycompilebundledfiles-_boolean-defaultfalse_)
66-
+ [allowTsInNodeModules _(boolean) (default=false)_](#allowtsinnodemodules-_boolean-defaultfalse_)
67-
+ [context _(string) (default=undefined)_](#context-_string-defaultundefined_)
68-
+ [experimentalFileCaching _(boolean) (default=true)_](#experimentalfilecaching-_boolean-defaulttrue_)
69-
+ [projectReferences _(boolean) (default=false)_](#projectreferences-_boolean-defaultfalse_)
48+
+ [transpileOnly](#transpileonly)
49+
+ [happyPackMode](#happypackmode)
50+
+ [resolveModuleName and resolveTypeReferenceDirective](#resolvemodulename-and-resolvetypereferencedirective)
51+
+ [getCustomTransformers](#getcustomtransformers)
52+
+ [logInfoToStdOut](#loginfotostdout)
53+
+ [logLevel](#loglevel)
54+
+ [silent](#silent)
55+
+ [ignoreDiagnostics](#ignorediagnostics)
56+
+ [reportFiles](#reportfiles)
57+
+ [compiler](#compiler)
58+
+ [configFile](#configfile)
59+
+ [colors](#colors)
60+
+ [errorFormatter](#errorformatter)
61+
+ [compilerOptions](#compileroptions)
62+
+ [instance](#instance)
63+
+ [appendTsSuffixTo](#appendtssuffixto)
64+
+ [appendTsxSuffixTo](#appendtsxsuffixto)
65+
+ [onlyCompileBundledFiles](#onlycompilebundledfiles)
66+
+ [allowTsInNodeModules](#allowtsinnodemodules)
67+
+ [context](#context)
68+
+ [experimentalFileCaching](#experimentalfilecaching)
69+
+ [projectReferences](#projectreferences)
7070
* [Usage with webpack watch](#usage-with-webpack-watch)
7171
* [Hot Module replacement](#hot-module-replacement)
7272
- [Contributing](#contributing)
@@ -283,7 +283,10 @@ module.exports = {
283283

284284
### Loader Options
285285

286-
#### transpileOnly _(boolean) (default=false)_
286+
#### transpileOnly
287+
| Type | Default Value |
288+
|------|--------------|
289+
| `boolean` | `false`|
287290

288291
If you want to speed up compilation significantly you can set this flag.
289292
However, many of the benefits you get from static type checking between
@@ -311,7 +314,10 @@ module.exports = {
311314
}
312315
```
313316

314-
#### happyPackMode _(boolean) (default=false)_
317+
#### happyPackMode
318+
| Type | Default Value |
319+
|------|--------------|
320+
| `boolean` | `false`|
315321

316322
If you're using [HappyPack](https://github.com/amireh/happypack) or [thread-loader](https://github.com/webpack-contrib/thread-loader) to parallise your builds then you'll need to set this to `true`. This implicitly sets `*transpileOnly*` to `true` and **WARNING!** stops registering **_all_** errors to webpack.
317323

@@ -325,37 +331,55 @@ This will ensure that the plugin checks for both syntactic errors (eg `const arr
325331

326332
Also, if you are using `thread-loader` in watch mode, remember to set `poolTimeout: Infinity` so workers don't die.
327333

328-
#### resolveModuleName and resolveTypeReferenceDirective:
334+
#### resolveModuleName and resolveTypeReferenceDirective
329335

330336
These options should be functions which will be used to resolve the import statements and the `<reference types="...">` directives instead of the default TypeScript implementation. It's not intended that these will typically be used by a user of `ts-loader` - they exist to facilitate functionality such as [Yarn Plug’n’Play](https://yarnpkg.com/en/docs/pnp).
331337

332-
#### getCustomTransformers _( (program: Program) => { before?: TransformerFactory<SourceFile>[]; after?: TransformerFactory<SourceFile>[]; } )_
338+
#### getCustomTransformers
339+
| Type |
340+
|------|
341+
| ` (program: Program) => { before?: TransformerFactory<SourceFile>[]; after?: TransformerFactory<SourceFile>[]; } ` |
333342

334343
Provide custom transformers - only compatible with TypeScript 2.3+ (and 2.4 if using `transpileOnly` mode). For example usage take a look at [typescript-plugin-styled-components](https://github.com/Igorbek/typescript-plugin-styled-components) or our [test](test/comparison-tests/customTransformer).
335344

336345
You can also pass a path string to locate a js module file which exports the function described above, this useful especially in `happyPackMode`. (Because forked processes cannot serialize functions see more at [related issue](https://github.com/Igorbek/typescript-plugin-styled-components/issues/6#issue-303387183))
337346

338-
#### logInfoToStdOut _(boolean) (default=false)_
347+
#### logInfoToStdOut
348+
| Type | Default Value |
349+
|------|--------------|
350+
| `boolean` | `false`|
339351

340352
This is important if you read from stdout or stderr and for proper error handling.
341353
The default value ensures that you can read from stdout e.g. via pipes or you use webpack -j to generate json output.
342354

343-
#### logLevel _(string) (default=warn)_
355+
#### logLevel
356+
| Type | Default Value |
357+
|------|--------------|
358+
| `string` | `warn` |
344359

345360
Can be `info`, `warn` or `error` which limits the log output to the specified log level.
346361
Beware of the fact that errors are written to stderr and everything else is written to stderr (or stdout if logInfoToStdOut is true).
347362

348-
#### silent _(boolean) (default=false)_
363+
#### silent
364+
| Type | Default Value |
365+
|------|--------------|
366+
| `boolean` | `false`|
349367

350368
If `true`, no console.log messages will be emitted. Note that most error
351369
messages are emitted via webpack which is not affected by this flag.
352370

353-
#### ignoreDiagnostics _(number[]) (default=[])_
371+
#### ignoreDiagnostics
372+
| Type | Default Value |
373+
|------|--------------|
374+
| `number[]` | `[]`|
354375

355376
You can squelch certain TypeScript errors by specifying an array of diagnostic
356377
codes to ignore.
357378

358-
#### reportFiles _(string[]) (default=[])_
379+
#### reportFiles
380+
| Type | Default Value |
381+
|------|--------------|
382+
| `string[]` | `[]`|
359383

360384
Only report errors on files matching these glob patterns.
361385

@@ -370,12 +394,18 @@ Only report errors on files matching these glob patterns.
370394

371395
This can be useful when certain types definitions have errors that are not fatal to your application.
372396

373-
#### compiler _(string) (default='typescript')_
397+
#### compiler
398+
| Type | Default Value |
399+
|------|--------------|
400+
| `string` | `'typescript'`|
374401

375402
Allows use of TypeScript compilers other than the official one. Should be
376403
set to the NPM name of the compiler, eg [`ntypescript`](https://github.com/basarat/ntypescript).
377404

378-
#### configFile _(string) (default='tsconfig.json')_
405+
#### configFile
406+
| Type | Default Value |
407+
|------|--------------|
408+
| `string` | `'tsconfig.json'`|
379409

380410
Allows you to specify where to find the TypeScript configuration file.
381411

@@ -388,11 +418,17 @@ You may provide
388418
Please note, that if the configuration file is outside of your project directory, you might need to set the `context` option to avoid TypeScript issues (like TS18003).
389419
In this case the `configFile` should point to the `tsconfig.json` and `context` to the project root.
390420

391-
#### colors _(boolean) (default=true)_
421+
#### colors
422+
| Type | Default Value |
423+
|------|--------------|
424+
| `boolean` | `true`|
392425

393426
If `false`, disables built-in colors in logger messages.
394427

395-
#### errorFormatter _((message: ErrorInfo, colors: boolean) => string) (default=undefined)_
428+
#### errorFormatter
429+
| Type | Default Value |
430+
|------|--------------|
431+
| `(message: ErrorInfo, colors: boolean) => string` | `undefined`|
396432

397433
By default `ts-loader` formats TypeScript compiler output for an error or a warning in the style:
398434

@@ -435,20 +471,32 @@ Does not compute.... code: 2307,severity: error,content: Cannot find module 'com
435471

436472
And the bit after "Does not compute.... " would be red.
437473

438-
#### compilerOptions _(object) (default={})_
474+
#### compilerOptions
475+
| Type | Default Value |
476+
|------|--------------|
477+
| `object` | `{}`|
439478

440479
Allows overriding TypeScript options. Should be specified in the same format
441480
as you would do for the `compilerOptions` property in tsconfig.json.
442481

443-
#### instance _(string)_
482+
#### instance
483+
| Type | Default Value |
484+
|------|--------------|
485+
| `string` | `TODO`|
444486

445487
Advanced option to force files to go through different instances of the
446488
TypeScript compiler. Can be used to force segregation between different parts
447489
of your code.
448490

449-
#### appendTsSuffixTo _(RegExp[]) (default=[])_
491+
#### appendTsSuffixTo
492+
| Type | Default Value |
493+
|------|--------------|
494+
| `RegExp[]` | `[]`|
450495

451-
#### appendTsxSuffixTo _(RegExp[]) (default=[])_
496+
#### appendTsxSuffixTo
497+
| Type | Default Value |
498+
|------|--------------|
499+
| `RegExp[]` | `[]`|
452500

453501
A list of regular expressions to be matched against filename. If filename matches one of the regular expressions, a `.ts` or `.tsx` suffix will be appended to that filename.
454502

@@ -551,7 +599,10 @@ Or if you want to use only tsx, just use the `appendTsxSuffixTo` option only:
551599
{ test: /\.tsx$/, loader: 'babel-loader!ts-loader', options: { appendTsxSuffixTo: [/\.vue$/] } }
552600
```
553601

554-
#### onlyCompileBundledFiles _(boolean) (default=false)_
602+
#### onlyCompileBundledFiles
603+
| Type | Default Value |
604+
|------|--------------|
605+
| `boolean` | `false`|
555606

556607
The default behavior of `ts-loader` is to act as a drop-in replacement for the `tsc` command,
557608
so it respects the `include`, `files`, and `exclude` options in your `tsconfig.json`, loading
@@ -560,7 +611,10 @@ loading only those files that are actually bundled by webpack, as well as any `.
560611
by the `tsconfig.json` settings. `.d.ts` files are still included because they may be needed for
561612
compilation without being explicitly imported, and therefore not picked up by webpack.
562613

563-
#### allowTsInNodeModules _(boolean) (default=false)_
614+
#### allowTsInNodeModules
615+
| Type | Default Value |
616+
|------|--------------|
617+
| `boolean` | `false`|
564618

565619
By default, `ts-loader` will not compile `.ts` files in `node_modules`.
566620
You should not need to recompile `.ts` files there, but if you really want to, use this option.
@@ -591,7 +645,10 @@ And in your `tsconfig.json`:
591645
}
592646
```
593647

594-
#### context _(string) (default=undefined)_
648+
#### context
649+
| Type | Default Value |
650+
|------|--------------|
651+
| `string` | `undefined`|
595652

596653
If set, will parse the TypeScript configuration file with given **absolute path** as base path.
597654
Per default the directory of the configuration file is used as base path. Relative paths in the configuration
@@ -624,14 +681,20 @@ Extending `tsconfig.json`:
624681

625682
Note that changes in the extending file while not be respected by `ts-loader`. Its purpose is to satisfy the code editor.
626683

627-
#### experimentalFileCaching _(boolean) (default=true)_
684+
#### experimentalFileCaching
685+
| Type | Default Value |
686+
|------|--------------|
687+
| `boolean` | `true`|
628688

629689
By default whenever the TypeScript compiler needs to check that a file/directory exists or resolve symlinks it makes syscalls. It does not cache the result of these operations and this may result in many syscalls with the same arguments ([see comment](https://github.com/TypeStrong/ts-loader/issues/825#issue-354725524) with example).
630690
In some cases it may produce performance degradation.
631691

632692
This flag enables caching for some FS-functions like `fileExists`, `realpath` and `directoryExists` for TypeScript compiler. Note that caches are cleared between compilations.
633693

634-
#### projectReferences _(boolean) (default=false)_
694+
#### projectReferences
695+
| Type | Default Value |
696+
|------|--------------|
697+
| `boolean` | `false`|
635698

636699
ts-loader has opt-in support for [project references](https://www.typescriptlang.org/docs/handbook/project-references.html). With this configuration option enabled, `ts-loader` will incrementally rebuild upstream projects the same way `tsc --build` does. Otherwise, source files in referenced projects will be treated as if they’re part of the root project.
637700

@@ -656,7 +719,7 @@ We do not support HMR as we did not yet work out a reliable way how to set it up
656719

657720
If you want to give `webpack-dev-server` HMR a try, follow the official [webpack HMR guide](https://webpack.js.org/guides/hot-module-replacement/), then tweak a few config options for `ts-loader`:
658721

659-
1. Set `transpileOnly` to `true` (see [transpileOnly](#transpileonly-boolean-defaultfalse) for config details and recommendations above).
722+
1. Set `transpileOnly` to `true` (see [transpileOnly](#transpileonly) for config details and recommendations above).
660723
2. Inside your HMR acceptance callback function, maybe re-require the module that was replaced.
661724

662725
## Contributing

0 commit comments

Comments
 (0)