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

SUGGESTION: enable forceConsistentCasingInFileNames by default #17542

Closed
breathe opened this issue Aug 1, 2017 · 10 comments · Fixed by #33614
Closed

SUGGESTION: enable forceConsistentCasingInFileNames by default #17542

breathe opened this issue Aug 1, 2017 · 10 comments · Fixed by #33614
Labels
Good First Issue Well scoped, documented and has the green light Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@breathe
Copy link

breathe commented Aug 1, 2017

I just spent pretty much the whole day trying to get vscode debugger to stop on breakpoints set in typescript files.

The issue ended up being that one of the files in my project was importing a resource from a file using wrong file casing (and it just so happened to be that this file was the one I was trying to set breakpoints in) ...

import { foo } from "../bar/Awesomebaz"

With the target file actually named 'AwesomeBaz.ts'.

No warnings or execution problems occurred from this mistake ... Everything seemed to work except my debugging experience was myseriously broken in a very hard to understand way. It took a long time to discover the forceConsistentNaming compiler flag and get the idea to try turning it on which led immediately to the correct fix.

I think having this flag off is a bad default -- I would like to suggest turning it on by default instead. Or at least turn it on when strict: true ...

@DanielRosenwasser DanielRosenwasser added In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Aug 1, 2017
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Aug 1, 2017

First off, really sorry you had a lot of frustration there. The option wasn't initially built into TypeScript which is why it's not the default. This would likely be a breaking change for users, so we'd need to discuss it.

@aluanhaddad
Copy link
Contributor

aluanhaddad commented Aug 1, 2017

I forget the specific issue number but the --forceConsistentCasingInFileNames option does not appear to work correctly with --paths. I would like to use it outside of NodeJS projects but I always get --paths errors even though my imports are all consistent. Someone filed a bug about this recently, I will try to hunt it down.

@stephenbrady
Copy link

I'm seeing the same issue as @aluanhaddad, but I'm not able to the find the issue referred to. If the issue has not actually been filed, I'd be happy to.

@stephenbrady
Copy link

@aluanhaddad I tried reproducing our issue in a minimal setup. At first, I could not, but after setting up configuration inheritance with extends, I was able to expose the issue. While this could be a red herring, I'm wondering if your setup also leverages extends.

@stephenbrady
Copy link

FYI, issue filed: #17617
cc @aluanhaddad

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this and removed In Discussion Not yet reached consensus labels Oct 10, 2017
@RyanCavanaugh RyanCavanaugh added this to the Community milestone Oct 10, 2017
@RyanCavanaugh RyanCavanaugh added the Good First Issue Well scoped, documented and has the green light label Oct 10, 2017
Almenon added a commit to Almenon/TypeScript that referenced this issue Sep 30, 2018
This implements microsoft#17542 enable forceConsistentCasingInFileNames by default which fixes cross-platform compatability issues due to typescript not reporting different cases as an error in windows.
Almenon added a commit to Almenon/TypeScript that referenced this issue Sep 30, 2018
Almenon added a commit to Almenon/TypeScript that referenced this issue Sep 30, 2018
Almenon added a commit to Almenon/TypeScript that referenced this issue Sep 30, 2018
This implements microsoft#17542 enable forceConsistentCasingInFileNames by default which fixes cross-platform compatability issues due to typescript not reporting different cases as an error in windows.

(making change in right branch this time)
Almenon added a commit to Almenon/TypeScript that referenced this issue Sep 30, 2018
This implements microsoft#17542 enable forceConsistentCasingInFileNames by default which fixes cross-platform compatability issues due to typescript not reporting different cases as an error in windows.

Making change in right repo & branch this time >_<
@Almenon
Copy link

Almenon commented Oct 13, 2018

I've submitted a pull request for this by the way @RyanCavanaugh. Enabling this by default would help prevent people from running into cross-platform issues with casing.

@RyanCavanaugh RyanCavanaugh modified the milestones: Community, Backlog Mar 7, 2019
@RyanCavanaugh
Copy link
Member

Note: Accepting PRs here only for changing what gets created in tsc --init's tsconfig.json (see comments in #18394). We still don't want to change the default value due to breaking change concerns.

mheiber pushed a commit to bloomberg/TypeScript that referenced this issue Sep 26, 2019
… 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>
RyanCavanaugh pushed a commit that referenced this issue Sep 27, 2019
… configs (#39) (#33614)

*Issue number of the reported bug or feature request: #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>
@timreichen
Copy link

Im interested if this died ad infinitum or if there is a plan having this implemented with a declared breaking change at some point? I just ran into the same problem using Deno. As Deno grows I could imagine there will be more and more complaints with the exact same problem.

@RyanCavanaugh
Copy link
Member

Our general policy is that the default values of commandline values never change unless there's a very compelling reason to; I don't think this would qualify. tsc --init is our "good" set of commandline options.

@timreichen
Copy link

timreichen commented Jul 24, 2020

I think it would, as well as strict. The most compelling reason to me is exactly that we need an extra --init command to have it override the defaults.
forceConsistentCasingInFileNames feels more like a patch instead of a design choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Well scoped, documented and has the green light Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants