Skip to content

Commit

Permalink
set allowSyntheticDefaultImports to true by default for jsconfig.json
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengbli committed Sep 22, 2016
1 parent 1fd0a8c commit 12578a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/compiler/commandLineParser.ts
Expand Up @@ -901,7 +901,9 @@ namespace ts {
function convertCompilerOptionsFromJsonWorker(jsonOptions: any,
basePath: string, errors: Diagnostic[], configFileName?: string): CompilerOptions {

const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {};
const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }
: {};
convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
Expand Down
8 changes: 6 additions & 2 deletions src/harness/unittests/convertCompilerOptionsFromJson.ts
Expand Up @@ -404,6 +404,7 @@ namespace ts {
compilerOptions: <CompilerOptions>{
allowJs: true,
maxNodeModuleJsDepth: 2,
allowSyntheticDefaultImports: true,
module: ModuleKind.CommonJS,
target: ScriptTarget.ES5,
noImplicitAny: false,
Expand Down Expand Up @@ -431,6 +432,7 @@ namespace ts {
compilerOptions: <CompilerOptions>{
allowJs: false,
maxNodeModuleJsDepth: 2,
allowSyntheticDefaultImports: true,
module: ModuleKind.CommonJS,
target: ScriptTarget.ES5,
noImplicitAny: false,
Expand All @@ -453,7 +455,8 @@ namespace ts {
compilerOptions:
{
allowJs: true,
maxNodeModuleJsDepth: 2
maxNodeModuleJsDepth: 2,
allowSyntheticDefaultImports: true
},
errors: [{
file: undefined,
Expand All @@ -473,7 +476,8 @@ namespace ts {
compilerOptions:
{
allowJs: true,
maxNodeModuleJsDepth: 2
maxNodeModuleJsDepth: 2,
allowSyntheticDefaultImports: true
},
errors: <Diagnostic[]>[]
}
Expand Down

0 comments on commit 12578a5

Please sign in to comment.