File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @codama/renderers-js ' : patch
3+ ---
4+
5+ Fix Prettier config resolution by providing file path instead of directory
Original file line number Diff line number Diff line change 1- import { mapRenderMapContentAsync , RenderMap } from '@codama/renderers-core' ;
1+ import { joinPath , mapRenderMapContentAsync , RenderMap } from '@codama/renderers-core' ;
22import { format , Plugin , resolveConfig } from 'prettier' ;
33import * as estreePlugin from 'prettier/plugins/estree' ;
44import * as typeScriptPlugin from 'prettier/plugins/typescript' ;
@@ -43,5 +43,10 @@ async function resolvePrettierOptions(packageFolder: string | undefined): Promis
4343 }
4444
4545 if ( ! packageFolder ) return null ;
46- return await resolveConfig ( packageFolder ) ;
46+
47+ // Prettier expects a file path to resolve, not just its directory.
48+ // Therefore we must append a filename (any will do) to ensure the
49+ // provided directory is searched for config files.
50+ const filePathToResolve = joinPath ( packageFolder , 'package.json' ) ;
51+ return await resolveConfig ( filePathToResolve ) ;
4752}
You can’t perform that action at this time.
0 commit comments