Prettier check project
Format staged or project files with prettier.
Table of contents
Presentation
This package was designed to:
- format staged files with prettier, prefect in a precommit hook.
- get an overwiew of your files state regarding prettier formatting.
- format your project files at once.
import { formatWithPrettier } from "@jsenv/prettier-check-project"
formatWithPrettier({
projectDirectoryUrl: "file:///directory",
})
Installation
npm install @jsenv/prettier-check-project
formatWithPrettier
formatWithPrettier
is an async function collecting files to format them with prettier. It also logs progression and return summary and report objects.
import { formatWithPrettier } from "@jsenv/prettier-check-project"
const { summary, report } = await formatWithPrettier({
logLevel: "debug",
projectDirectoryUrl: "file:///Users/you/directory",
prettierIgnoreFileRelativeUrl: ".prettierignore",
projectFilesConfig: {
"./src/": true,
"./*": true,
},
})
— source code at src/formatWithPrettier.js.