how to format javascript and python in a zapier code step

published June 2, 2026

to format javascript or python in a Code by Zapier step, paste your code into codefmt. it wraps the code in Zapier's async runtime before formatting, so top-level await and bare return never trigger a parse error, then hands back clean, linted code you can drop straight back into the step.

why standard formatters fail on zapier code

Code by Zapier runs your javascript inside an invisible async function. that wrapper is why await works at the top level of your step and why a bare return can hand data to the next action. but it also means your code is not a complete, standalone program.

Prettier and most editor formatters parse javascript as a whole program. they hit that top-level await or return, decide the syntax is invalid, and refuse to format. codefmt avoids this by wrapping your code in the same async function Zapier uses, formatting the wrapped result with biome, then stripping the wrapper back off. it also detects Zapier's newer sdk-in-code form (a top-level import with export default async function main(...)) and parses that at module scope, so it formats cleanly too.

how to format a zapier code step

  1. copy the code out of your Code by Zapier step.
  2. paste it into the codefmt Zapier formatter and choose javascript or python.
  3. codefmt wraps the code in Zapier's runtime, formats it (biome for javascript, ruff for python), lints it (oxlint for javascript, ruff for python), and strips the wrapper.
  4. copy the formatted result back into your Code step.
  5. or install the Chrome or Firefox extension and run “Fix with codefmt” from the right-click menu without leaving the Zapier editor.

codefmt vs the alternatives

toolbuilt forformats code sourcehandles zapier's async wrapperlints
codefmtcode written inside automation platformsyes (biome / ruff)yes, wraps and strips automaticallyyes (oxlint / ruff)
Formatter by Zapiertransforming field values (dates, numbers, text) in a no-code stepno, a different jobnot applicableno
Prettierformatting standalone javascript projectsyesno, parse error on top-level await / bare returnno, format only

see the side-by-side breakdowns: codefmt vs Formatter by Zapier and codefmt vs the Prettier playground.

the zapier globals codefmt knows

Zapier injects runtime globals into your step. a generic linter flags them as undefined; codefmt registers them so your formatted code stays warning-free.

languageglobalwhat it is
javascriptinputDatayour mapped input fields
outputthe result you assign to return data
fetchpreinstalled, no require needed
callbackclassic async completion, callback(err, output)
consolelogging visible in the Zapier task history
pythoninput_datayour mapped input fields
outputthe result dict you assign
StoreClientZapier's key-value store, StoreClient('secret')
requestspreinstalled http library

for python-heavy workflows, the dedicated python formatter page covers ruff formatting and lint rules in more depth.

frequently asked questions

what is the best code formatter for a Zapier code step?

use codefmt. it wraps your code in Zapier's async runtime before formatting, so top-level await and bare return don't trigger the parse errors that stop Prettier. it formats javascript with biome and python with ruff, lints both, and runs free in your browser with no account.

why does Prettier fail on my Zapier code?

Code by Zapier runs your javascript inside an invisible async function, so top-level await and bare return are valid there but invalid as a standalone program. Prettier parses your code as a complete program and errors out. codefmt wraps the code first, formats it, then strips the wrapper back off.

does Zapier have a built-in code formatter?

Formatter by Zapier is a no-code step for transforming field values like dates, numbers, and text. it is built for a different job and does not pretty-print the source of a Code by Zapier step. for that you paste your code into codefmt or use the codefmt browser extension.

can I format Zapier python code as well as javascript?

yes. codefmt formats and lints Zapier python with ruff (black-compatible formatting plus 500+ lint rules) and recognizes Zapier's python globals input_data, output, StoreClient, and requests, so they are not flagged as undefined.

is codefmt free, and does it send my code anywhere?

codefmt is free. formatting runs client-side via WebAssembly, so your code does not leave the browser, and there is no account or sign-in. the same engine ships as a Chrome and Firefox extension for formatting inside the Zapier editor.