fix linting

This commit is contained in:
Ron Rennick 2023-11-30 17:20:36 -04:00
parent e7b1af8a06
commit 35fdf3286f
2 changed files with 6 additions and 4 deletions

View File

@ -11,7 +11,7 @@ import yaml from 'js-yaml';
*/
export const generatePostFrontMatter = (
fileContents: string,
includeContent: boolean = false
includeContent: false
): {
[ key: string ]: unknown;
} => {
@ -34,8 +34,10 @@ export const generatePostFrontMatter = (
},
} );
const content = frontMatter.content.split( '\n' );
const headings = content.filter( ( line ) => line.substring( 0, 2 ) === '# ' );
const title = headings[0]?.substring( 2 ).trim();
const headings = content.filter(
( line ) => line.substring( 0, 2 ) === '# '
);
const title = headings[ 0 ]?.substring( 2 ).trim();
frontMatter.data.post_title = frontMatter.data.post_title ?? title;
if ( includeContent ) {

View File

@ -54,7 +54,7 @@ async function processDirectory(
const categoryFolder = path.basename( subDirectory );
const categoryTitle = categoryFolder
.split( '-' )
.map( ( slugPart ) => slugPart.charAt( 0 ).toUpperCase() + slugPart.slice( 1 ) )
.map( ( slugPart) => slugPart.charAt( 0 ).toUpperCase() + slugPart.slice( 1 ) )
.join( ' ' );
category.category_slug = category.category_slug ?? categoryFolder;
category.category_title = category.category_title ?? categoryTitle;