Skip to content

Commit 38adb7f

Browse files
prakashtinatemheiber
authored andcommitted
Enable forceConsistentCasingInFileNames by default in newly generated configs (#39)
*Issue number of the reported bug or feature request: microsoft#17542* **Describe your changes** Enabled `forceConsistentCasingInFileNames` in newly generated `tsconfig.json`s created by `tsc --init`. **Testing performed** The configuration option changed in the related tests. **Additional context** n/a Signed-off-by: Prakash Lalwani <plalwani4@bloomberg.net>
1 parent 3dd7b84 commit 38adb7f

File tree

10 files changed

+36
-10
lines changed

10 files changed

+36
-10
lines changed

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,8 @@ namespace ts {
986986
module: ModuleKind.CommonJS,
987987
target: ScriptTarget.ES5,
988988
strict: true,
989-
esModuleInterop: true
989+
esModuleInterop: true,
990+
forceConsistentCasingInFileNames: true
990991
};
991992

992993
let optionNameMapCache: OptionNameMap;

tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
// "types": [], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,5 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
}
6366
}

tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
/* Advanced Options */
6464
"noErrorTruncation": true, /* Do not truncate error messages. */
6565
"declarationDir": "lib", /* Output directory for generated declaration files. */
66-
"skipLibCheck": true /* Skip type checking of declaration files. */
66+
"skipLibCheck": true, /* Skip type checking of declaration files. */
67+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6768
}
6869
}

tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
// "types": [], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,5 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
}
6366
}

tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
// "types": [], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,5 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
}
6366
}

tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
// "types": [], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,6 +59,9 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
},
6366
"files": [
6467
"file0.st",

tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
// "types": [], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,5 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
}
6366
}

tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
// "types": [], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,5 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
}
6366
}

tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
// "types": [], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,5 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
}
6366
}

tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
"types": ["jquery","mocha"], /* Type declaration files to be included in compilation. */
4848
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5050
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5151
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5252

@@ -59,5 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
63+
/* Advanced Options */
64+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
6265
}
6366
}

0 commit comments

Comments
 (0)