prettier-eslint
- Version 16.3.0
- Published
- 58.7 kB
- 12 dependencies
- MIT license
Install
npm i prettier-eslint
yarn add prettier-eslint
pnpm add prettier-eslint
Overview
Formats your JavaScript using prettier followed by eslint --fix
Index
Functions
function format
format: (options: format.Options) => Promise<string>;
Formats the text with Prettier and then ESLint while obeying the user's configuration.
Parameter options
Options to format text with Prettier and Eslint.
Parameter
options.eslintConfig The config to use for formatting with ESLint.
Parameter
options.eslintPath The path to the eslint module to use. Will default to require.resolve('eslint')
Parameter
options.fallbackPrettierOptions The options to pass for formatting with
prettier
if the given option is not inferrable from the eslintConfig.Parameter
options.filePath The path of the file being formatted can be used in lieu of
eslintConfig
(eslint will be used to find the relevant config for the file). Will also be used to load thetext
iftext
is not provided.Parameter
options.prettierOptions The options to pass for formatting with
prettier
. If not provided, prettier-eslint will attempt to create the options based on theeslintConfig
value.Parameter
options.prettierLast Run Prettier last.
Parameter
options.prettierPath The path to the prettier module. Will default to require.resovlve('prettier')
Parameter
options.logLevel The level for the logs (
error
,warn
,info
,debug
,trace
).Parameter
options.text The text (JavaScript code) to format. Auto-formatted text that is mostly compliant with the supplied configuration. The auto-formatting is limited to the issues that Prettier and ESLint can automatically fix.
Interfaces
interface Options
interface Options {}
Options to format text with Prettier and ESLint.
property eslintConfig
eslintConfig?: eslint.Linter.Config;
The config to use for formatting with ESLint.
property eslintPath
eslintPath?: string;
The path to the eslint module to use. Will default to require.resolve('eslint')
property fallbackPrettierOptions
fallbackPrettierOptions?: prettier.Options;
The options to pass for formatting with
prettier
if the given option is not inferrable from theeslintConfig
.
property filePath
filePath?: string;
The path of the file being formatted can be used in lieu of
eslintConfig
(eslint will be used to find the relevant config for the file). Will also be used to load thetext
iftext
is not provided.
property logLevel
logLevel?: LogLevel;
The level for the logs (
error
,warn
,info
,debug
,trace
).
property prettierLast
prettierLast?: boolean;
Run Prettier last.
property prettierOptions
prettierOptions?: prettier.Options;
The options to pass for formatting with
prettier
. If not provided, prettier-eslint will attempt to create the options based on theeslintConfig
value.
property prettierPath
prettierPath?: string;
The path to the
prettier
module. Will default to require.resovlve('prettier')
property text
text: string;
The text (JavaScript code) to format.
Type Aliases
type LogLevel
type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent';
Logging level for the traceback of the synchronous formatting process.
Package Files (1)
Dependencies (12)
Dev Dependencies (19)
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/prettier-eslint
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/prettier-eslint)
- HTML<a href="https://www.jsdocs.io/package/prettier-eslint"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2959 ms. - Missing or incorrect documentation? Open an issue for this package.