Skip to content

Commit

Permalink
feat: remove "incremental: true" from ts default options (#444)
Browse files Browse the repository at this point in the history
As incremental mode has some assumptions regarding changes that can occur in the project, sometimes the user has to remove .tsbuildinfo files manually to fix it. Because of that, we should not enable incremental mode by default - it should be a conscious choice of the user.

BREAKING CHANGE: 🧨 Remove "incremental: true" from default typescript options
  • Loading branch information
piotr-oles committed Jun 12, 2020
1 parent 188d44d commit d056616
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
24 changes: 12 additions & 12 deletions README.md
Expand Up @@ -153,18 +153,18 @@ Options passed to the plugin constructor will overwrite options from the cosmico

Options for the TypeScript checker (`typescript` option object).

| Name | Type | Default value | Description |
| -------------------- | --------- | ---------------------------------------------------------------------------------------------------------- | ----------- |
| `enabled` | `boolean` | `true` | If `true`, it enables TypeScript checker. |
| `memoryLimit` | `number` | `2048` | Memory limit for the checker process in MB. If the process exits with the allocation failed error, try to increase this number. |
| `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
| `configOverwrite` | `object` | `{ compilerOptions: { skipLibCheck: true, sourceMap: false, inlineSourceMap: false, incremental: true } }` | This configuration will overwrite configuration from the `tsconfig.json` file. Supported fields are: `extends`, `compilerOptions`, `include`, `exclude`, `files`, and `references`. |
| `context` | `string` | `dirname(configuration.configFile)` | The base path for finding files specified in the `tsconfig.json`. Same as the `context` option from the [ts-loader](https://github.com/TypeStrong/ts-loader#context). Useful if you want to keep your `tsconfig.json` in an external package. Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `fork-ts-checker-webpack-plugin` and `tsc`. When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file referenced in option `configFile`. |
| `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
| `mode` | `'readonly'` or `'write-tsbuildinfo'` or `'write-references'` | `'write-tsbuildinfo'` | If you use the `babel-loader`, it's recommended to use `write-references` mode to improve initial compilation time. If you use `ts-loader`, it's recommended to use `write-tsbuildinfo` mode to not overwrite filed emitted by the `ts-loader`. |
| `diagnosticsOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. |
| `extensions` | `object` | `{}` | See [TypeScript extensions options](#typescript-extensions-options). |
| `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |
| Name | Type | Default value | Description |
| -------------------- | --------- | -------------------------------------------------------------------------------------------------------------- | ----------- |
| `enabled` | `boolean` | `true` | If `true`, it enables TypeScript checker. |
| `memoryLimit` | `number` | `2048` | Memory limit for the checker process in MB. If the process exits with the allocation failed error, try to increase this number. |
| `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
| `configOverwrite` | `object` | `{ compilerOptions: { skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false } }` | This configuration will overwrite configuration from the `tsconfig.json` file. Supported fields are: `extends`, `compilerOptions`, `include`, `exclude`, `files`, and `references`. |
| `context` | `string` | `dirname(configuration.configFile)` | The base path for finding files specified in the `tsconfig.json`. Same as the `context` option from the [ts-loader](https://github.com/TypeStrong/ts-loader#context). Useful if you want to keep your `tsconfig.json` in an external package. Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `fork-ts-checker-webpack-plugin` and `tsc`. When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file referenced in option `configFile`. |
| `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
| `mode` | `'readonly'` or `'write-tsbuildinfo'` or `'write-references'` | `'write-tsbuildinfo'` | If you use the `babel-loader`, it's recommended to use `write-references` mode to improve initial compilation time. If you use `ts-loader`, it's recommended to use `write-tsbuildinfo` mode to not overwrite filed emitted by the `ts-loader`. |
| `diagnosticsOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. |
| `extensions` | `object` | `{}` | See [TypeScript extensions options](#typescript-extensions-options). |
| `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |

#### TypeScript extensions options

Expand Down
3 changes: 0 additions & 3 deletions src/typescript-reporter/TypeScriptReporterConfiguration.ts
Expand Up @@ -50,9 +50,6 @@ function createTypeScriptReporterConfiguration(
if (semver.gte(ts.version, '2.9.0')) {
defaultCompilerOptions.declarationMap = false;
}
if (semver.gte(ts.version, '3.4.0')) {
defaultCompilerOptions.incremental = true;
}

return {
enabled: options !== false,
Expand Down
Expand Up @@ -18,7 +18,6 @@ describe('typescript-reporter/TypeScriptsReporterConfiguration', () => {
sourceMap: false,
inlineSourceMap: false,
declarationMap: false,
incremental: true,
},
},
context: path.normalize(path.dirname(path.resolve(context, 'tsconfig.json'))),
Expand Down Expand Up @@ -85,7 +84,6 @@ describe('typescript-reporter/TypeScriptsReporterConfiguration', () => {
sourceMap: false,
inlineSourceMap: false,
declarationMap: false,
incremental: true,
strict: true,
},
include: ['src'],
Expand Down

0 comments on commit d056616

Please sign in to comment.