File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "es5",
4
+ "semi": false
5
+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React from 'react'
2
2
import { join } from 'node:path'
3
3
import { readFile , writeFile } from 'node:fs/promises'
4
4
import type { SourceFile } from 'ts-morph'
5
- import { format } from 'prettier'
5
+ import { format , resolveConfig } from 'prettier'
6
6
import { isJsxOnly } from '../utils/is-jsx-only'
7
7
import { getHighlighter , type Theme } from './highlighter'
8
8
import { project } from './project'
@@ -109,10 +109,10 @@ export async function Code({
109
109
110
110
// Format JavaScript code blocks.
111
111
if ( isJavaScriptLanguage ) {
112
- finalValue = await format ( finalValue , {
113
- filepath : filename ,
114
- printWidth : 60 ,
115
- } )
112
+ const config = await resolveConfig ( filename )
113
+ config . filepath = filename
114
+ config . printWidth = 60
115
+ finalValue = await format ( finalValue , config )
116
116
}
117
117
118
118
// Scope code block source files since they can conflict with other files on disk.
You can’t perform that action at this time.
0 commit comments