Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force noEmit compiler option to be false #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The default `tsconfig.json` file used by the plugin looks like this:
```json
{
"compilerOptions": {
"noEmit": false,
"preserveConstEnums": true,
"strictNullChecks": true,
"sourceMap": true,
Expand All @@ -47,7 +48,7 @@ The default `tsconfig.json` file used by the plugin looks like this:
}
```

> Note 1: The `outDir` and `rootDir` options cannot be overwritten.
> Note 1: The `outDir`, `rootDir` and `noEmit` options cannot be overwritten.

> Note 2: Don't confuse the [`tsconfig.json`](tsconfig.json) in this repository with the one mentioned above.

Expand Down
11 changes: 9 additions & 2 deletions src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as path from 'path'

export function makeDefaultTypescriptConfig() {
const defaultTypescriptConfig: ts.CompilerOptions = {
noEmit: false,
preserveConstEnums: true,
strictNullChecks: true,
sourceMap: true,
Expand Down Expand Up @@ -120,12 +121,18 @@ export function getTypescriptConfig(
logger.log(`Using local tsconfig.json`)
}

// disallow overrriding rootDir
// disallow overriding rootDir
if (configParseResult.options.rootDir && path.resolve(configParseResult.options.rootDir) !== path.resolve(cwd) && logger) {
logger.log('Warning: "rootDir" from local tsconfig.json is overriden')
logger.log('Warning: "rootDir" from local tsconfig.json is overridden')
}
configParseResult.options.rootDir = cwd

// disallow overriding noEmit
if (configParseResult.options.noEmit !== false) {
logger.log('Warning: "noEmit" from local tsconfig.json is overridden')
}
configParseResult.options.noEmit = false

return configParseResult.options
}

Expand Down