Skip to content

Latest commit

 

History

History
55 lines (29 loc) · 1.03 KB

formatSourceFromFile.md

File metadata and controls

55 lines (29 loc) · 1.03 KB

APIs Documentation


Function: formatSourceFromFile()

formatSourceFromFile(text, fileName, config, options?): Promise<undefined | string>

Format given source text from a file, asynchronously.

This function will try to find tsconfig.json and ESLint config relating to the source file, and merge them to the base config provided.

options can be used to change tsconfig.json and ESLint config loading behavior for testing purpose.

Parameters

text

string

Source text

fileName

string

Source file name

config

Configuration

Base config

options?

FormatOptions

Internal/testing options

Returns

Promise<undefined | string>

Promise of the result text or undefined if nothing changes.

See

formatSourceFromFile.sync

Defined in

format/main/index.ts:42