Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
fix (instructions): don't rely on the presence of editorconfig (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgalbu committed May 19, 2022
1 parent 6b863d2 commit ba7ed76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,24 @@ function getStub(...relativePaths: string[]) {
async function getIntendationConfigForTsMorph(projectRoot: string) {
const indentConfig = await parseEditorConfig(projectRoot + "/.editorconfig");

let indentationText;
let indentationText:IndentationText;
if (indentConfig.indent_style === "space" && indentConfig.indent_size === 2) {
indentationText = IndentationText.TwoSpaces;
} else if (indentConfig.indent_style === "space" && indentConfig.indent_size === 4) {
indentationText = IndentationText.FourSpaces;
} else if (indentConfig.indent_style === "tab") {
indentationText = IndentationText.Tab;
} else {
indentationText = IndentationText.FourSpaces;
}

let newLineKind;
let newLineKind:NewLineKind;
if (indentConfig.end_of_line === "lf") {
newLineKind = NewLineKind.LineFeed;
} else if (indentConfig.end_of_line === "crlf") {
newLineKind = NewLineKind.CarriageReturnLineFeed;
} else {
newLineKind = NewLineKind.LineFeed;
}

return { indentationText, newLineKind };
Expand Down

0 comments on commit ba7ed76

Please sign in to comment.