-
Notifications
You must be signed in to change notification settings - Fork 36
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
Non-indented lines are ignored when calculating minimum indentation #20
Comments
The dedent package seems to be dead. I ran into this issue which has been open for 4 years and seems pretty serious: dmnd/dedent#20 Replace the package with string-dedent, an alternative maintained by the author of the TC39 String.dedent proposal.
Hmm, I'm not sure that this is correct actually. Arguably, having a line without any indentation indicates that the string is already dedented, no? Does anybody have a good use case of why this should be changed? |
Thinking more deeply - seems reasonable that many would consider this a bug. Now that we have options (#65) we could take in an option to preserve the old behavior. import dedent from 'dedent';
// test
// test2
dedent`
test
test2
`;
// test
// test2
dedent.withOptions({ ignoreNonIndentedLines })`
test
test2
`; cc @G-Rath & @Haroenv since you've been active in this repo recently 👋 |
Makes sense to me, the default behaviour (maybe breaking change again) should be what's described in issue and consider that when something isn't indented, we shouldn't dedent anything (although at that point, I'm not even sure why someone would still use the template string, function could make sense) |
Explicitly marking as |
I've hit this bug when I use I could make an attempt to fix this issue, would it be preferable to have a breaking change with a an option to preserve the old behaviour or an option to opt-in for the new behaviour? EDIT: Personally I believe it should be the default behaviour (breaking) |
The problem with breaking changes is that Let's consider turning the option on by default as a separate followup from this. |
Consider this example
Outputs
Regex in line 43 (
l.match(/^(\s+)\S+/);
) should probably read\s*
instead of\s+
.The text was updated successfully, but these errors were encountered: