
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
Formats your code with whatever formatter your project is already using. 🧼
formatly can automatically detect and format with:
See Formatter Detection for details on how they are detected.
npx formatly <files>
formatly takes in any number of glob patterns
It will then:
For example, to match all directories and folders in the current directory:
npx formatly *
To match only .ts files in src/:
npx formatly "src/**/*.ts"
npm i formatly
The formatly package exports the functions used by the formatly CLI.
formatlyRuns formatting on any number of glob pattern strings.
import { formatly } from "formatly";
await formatly(["*"]);
Parameters:
patterns: string[] (required): any number of glob patternsoptions: FormatlyOptions (optional):
cwd: string (optional): working directory, if not "."Resolves with a FormatlyReport, which is either:
FormatlyReportError if a formatter could not be determined, which an object containing:
ran: falseFormatlyReportResult if a formatter could be determined, which is an object containing:
formatter: Formatter: as resolved by resolveFormatterran: trueresult: Result, the Result from running the formatter with execaFor example, to run formatting on TypeScript source files in a child directory and check the result:
import { formatly } from "formatly";
const report = await formatly(["src/**/*.ts"], { cwd: "path/to/project" });
if (!report.ran) {
console.error("Could not determine formatter.");
return;
}
const { formatter, result } = report;
if (result.code) {
console.error(`Error running ${formatter.runner}:`, result.stderr);
} else {
console.log(`Formatted with ${formatter.name}! 🧼`);
}
resolveFormatterDetects which of the supported formatters to use for a directory.
import { resolveFormatter } from "formatly";
const formatter = await resolveFormatter();
// {
// name: "Prettier",
// runner: "npx prettier --write",
// testers: { ... }
// }
console.log(formatter);
Parameters:
cwd: string (optional): working directory, if not "."Resolves with either:
undefined if a formatter could not be detectedFormatter if one can be found, which is an object containing:
name: string: English name of the formatterrunner: string: the shell command used to run the formattertesters: object: strings and regular expressions used to test for the formatterFormatters are detected based on the first match from, in order:
package.json fmt or format scriptpackage.json key| Formatter | Config File | Package Key | Script |
|---|---|---|---|
| Biome | Configure Biome | biome | |
| deno fmt | Deno Configuration > Formatting | deno | |
| dprint | dprint setup | dprint | |
| Prettier | Prettier Configuration File | "prettier" | prettier |
Want support for a formatter not mentioned here? Great! Please file a feature request GitHub issue. 🙏
See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.
Thanks! 💖
Josh Goldberg ✨ 💻 🖋 🤔 🚇 🚧 📆 🔧 📖 |
💝 This package was templated with
create-typescript-appusing thecreateengine.
FAQs
Formats your code with whatever formatter your project is already using. 🧼
The npm package formatly receives a total of 3,597,121 weekly downloads. As such, formatly popularity was classified as popular.
We found that formatly demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.