Skip to content

Latest commit

 

History

History
55 lines (29 loc) · 1.13 KB

formatSourceWithoutFile.md

File metadata and controls

55 lines (29 loc) · 1.13 KB

APIs Documentation


Function: formatSourceWithoutFile()

formatSourceWithoutFile(text, extension, config, options?): Promise<undefined | string>

Format given source text without knowing the source 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

extension

Extension

File extension to reveal the source language

config

Configuration

Base config

options?

FormatOptions

Internal/testing options

Returns

Promise<undefined | string>

Promise of the result text or undefined if nothing changes.

See

formatSourceWithoutFile.sync

Defined in

format/main/index.ts:107