Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/std/prettier/vendor/index.d.ts

A modern runtime for JavaScript and TypeScript.
Go to Latest
import * as deno from "https://deno.land/x/deno@v0.22.0/std/prettier/vendor/index.d.ts";

Variables

version field in package.json

Functions

check checks to see if the file has been formatted with Prettier given those options and returns a Boolean. This is similar to the --list-different parameter in the CLI and is useful for running Prettier in CI scenarios.

As you repeatedly call resolveConfig, the file system structure will be cached for performance. This function will clear the cache. Generally this is only needed for editor integrations that know that the file system has changed since the last format took place.

format is used to format text using Prettier. Options may be provided to override the defaults.

formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code. This is useful for editor integrations, to prevent the cursor from moving when code is formatted.

Returns an object representing the parsers, languages and file types Prettier supports. If version is provided (e.g. "1.5.0"), information for that version will be returned, otherwise information for the current version will be returned.

resolveConfig can be used to resolve configuration for a given source file, passing its path as the first argument. The config search will start at the file path and continue to search up the directory. (You can use process.cwd() to start searching from the current directory).

resolveConfigFile can be used to find the path of the Prettier configuration file, that will be used when resolving the config (i.e. when calling resolveConfig).