switch order of params so the last one can be omitted

This commit is contained in:
Ashley Engelund (weedySeaDragon @ github)
2022-09-07 14:15:09 -07:00
parent 48b0076ea5
commit 6376c9ae43

View File

@@ -100,9 +100,9 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => {
* documentation directory. Default is `false` * documentation directory. Default is `false`
*/ */
const copyTransformedContents = ( const copyTransformedContents = (
file: string, filename: string,
transformedContent?: string, doCopy: boolean = false,
doCopy: boolean = false transformedContent?: string
) => { ) => {
const fileInFinalDocDir = changeToFinalDocDir(file); const fileInFinalDocDir = changeToFinalDocDir(file);
const existingBuffer = existsSync(fileInFinalDocDir) const existingBuffer = existsSync(fileInFinalDocDir)
@@ -152,6 +152,7 @@ const transformMarkdown = (file: string) => {
copyTransformedContents( copyTransformedContents(
file, file,
!verifyOnly,
prettier.format(transformed, { prettier.format(transformed, {
parser: 'markdown', parser: 'markdown',
useTabs: false, useTabs: false,
@@ -159,8 +160,7 @@ const transformMarkdown = (file: string) => {
endOfLine: 'auto', endOfLine: 'auto',
printWidth: 100, printWidth: 100,
singleQuote: true, singleQuote: true,
}), })
!verifyOnly
); );
}; };
@@ -191,7 +191,7 @@ const transformHtml = (filename: string) => {
}; };
const transformedHTML = insertAutoGeneratedComment(filename); const transformedHTML = insertAutoGeneratedComment(filename);
copyTransformedContents(filename, transformedHTML, !verifyOnly); copyTransformedContents(filename, !verifyOnly, transformedHTML);
}; };
/** Main method (entry point) */ /** Main method (entry point) */
@@ -214,8 +214,7 @@ const transformHtml = (filename: string) => {
dot: includeFilesStartingWithDot, dot: includeFilesStartingWithDot,
}); });
otherFiles.forEach((file: string) => { otherFiles.forEach((file: string) => {
const transformedContents = readSyncedUTF8file(file); // no transformation is done; just get the contents copyTransformedContents(file, !verifyOnly); // no transformation
copyTransformedContents(file, transformedContents, !verifyOnly);
}); });
if (filesWereTransformed) { if (filesWereTransformed) {