FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
babel/scripts/utils/formatCode.js at main · javascriptit/babel · GitHub
javascriptit
babel
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
babel
/
scripts
/
utils
/
formatCode.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
9 lines (7 loc) · 315 Bytes
Breadcrumbs
babel
/
scripts
/
utils
/
formatCode.js
Copy path
File metadata and controls
9 lines (7 loc) · 315 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
import
prettier
from
"prettier"
;
export
default
function
formatCode
(
code
,
filename
)
{
const
prettierConfig
=
prettier
.
resolveConfig
.
sync
(
filename
)
;
prettierConfig
.
filepath
=
filename
;
prettierConfig
.
parser
=
filename
.
endsWith
(
".ts"
)
?
"babel-ts"
:
"babel"
;
return
prettier
.
format
(
code
,
prettierConfig
)
;
}
Back
|
FazBrowse Home
|
New Git URL