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

Ignore single space indents #31

Merged
merged 3 commits into from
May 28, 2021

Conversation

brandon93s
Copy link
Contributor

@brandon93s brandon93s commented May 24, 2021

Fixes #30

@brandon93s brandon93s mentioned this pull request May 24, 2021
let indents = makeIndentsMap(string, true);
if (indents.size === 0) {
indents = makeIndentsMap(string, false);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm protecting against introduction of another edge case here where a file truly is single space indented intentionally. Since makeIndentsMap calculates relative indents accounting for this inline would've sacrificed code clarity. Trading off for a second parsing run here in the interest of limiting complexity.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this as a code comment?

@sindresorhus sindresorhus changed the title Ignore Single Spaces Ignore single space May 24, 2021
@sindresorhus sindresorhus changed the title Ignore single space Ignore single space indents May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore 1-space indents
2 participants