Skip to main content
Module

x/deno_fmt/mod.ts>Options

Programmatic code formatter for Deno and Deno Deploy, allowing you to format code on the fly. Supports all features and options of the `deno fmt` command.
Go to Latest
namespace Options
Re-export
import { Options } from "https://deno.land/x/deno_fmt@0.0.1/mod.ts";
class Options
implements IOptions
Re-export
import { Options } from "https://deno.land/x/deno_fmt@0.0.1/mod.ts";

Constructors

new
Options(options?: IOptions)

Properties

check: boolean
config: string | boolean
cwd: string
ignore: readonly string[]
indentWidth: number
lineWidth: number
semiColons: boolean
singleQuote: boolean
useTabs: boolean

Methods

Normalizes the options object, resolving all of its properties.

toDprint(): Partial<Record<string, unknown>>

Converts the options object into an object of options for dprint.

toFlags(): readonly string[]

Converts the options object into an array of command-line flags.

Converts the options object into a normalized JSON object.

toString(): string

Converts the options object into a string of command-line flags.

Static Properties

readonly
allowed
readonly
convert: (Options.convertToFlags) & { readonly dprint: Options.convertToDprint; }
readonly
default: Options.Resolved
readonly
dprint: Options.convertToDprint
filesOnly: boolean

Static Methods

convertToDprint(options: IOptions)

Convert the options object into an object of options suitable for the dprint formatter API. The options retured depend on the ext option, which determines the formatter plugin to use. Each formatter plugin has its own set of configuration options and defaults.

convertToFlags(input: IOptions): string[]

Validates and converts options from a JavaScript-style notation into an array of their equivalent Command Line flags, suitable for passing to the Deno.Command subprocess API as the args option. Since we are using a shell command to format our code, we must ensure that the options are properly escaped and formatted for the shell environment. Otherwise, we could open up our users to being vulnerable for code injection attacks.

hasInstance(it: unknown): it is Options
merge<T extends Partial<IOptions>, U extends IOptions = Options.default>(options: T, fallbacks?: U): Options
normalize(options: IOptions): Options
sanitizePath(path: string | URL): string
[Symbol.hasInstance](it: unknown): it is Options