min_version = "2026.9.7" [tools] rust = { version = "1.98.0", components = "clippy,rustfmt" } bun = "1.4.4" hk = "2.11.1" jactionlint = "2.4.0" mr-boxington = "1.29.2" taplo = "0.10.0" yamlfmt = "0.21.0" "cargo:wasm-bindgen-cli" = "0.2.130" # mbx caches compiler output in one store, so a build here warms the next worktree. [wrappers.cargo] command = "mbx" env = { MBX_CARGO_SHIM_MODE = "1" } [env] CARGO_TARGET_DIR = "{{config_root}}/target" [tasks.build] description = "Build the library and CLI" run = "cargo build --workspace --exclude tidy_napi" [tasks.schema] description = "Write the JSON Schema of a tidy.json for npm and the site" run = "cargo run -q -p tidy_cli -- schema > crates/tidy_napi/tidy.schema.json" [tasks."build:wasm"] description = "Build the playground's wasm into www/assets/wasm" run = [ "cargo build --profile wasm --target wasm32-unknown-unknown -p tidy_wasm", '"$(mise where cargo:wasm-bindgen-cli)/bin/wasm-bindgen" --target web --no-typescript --out-dir www/assets/wasm --out-name tidy target/wasm32-unknown-unknown/wasm/tidy_wasm.wasm', ] [tasks."build:napi"] description = "Build the Node addon for this platform" dir = "crates/tidy_napi" run = "bunx napi build --platform --release --esm" [tasks.lint] description = "Check formatting and lint with warnings denied" run = [ "hk check --all", "cargo clippy --workspace --all-targets -- -D warnings", "cargo clippy -p tidy --no-default-features --all-targets -- -D warnings", ] [tasks.test] description = "Run all tests" run = [ "cargo test --workspace", "cargo test -p tidy --no-default-features", "bun test --cwd crates/tidy_napi", ] depends = ["build:napi"] [tasks.ci] description = "Everything CI runs" depends = ["lint", "test"] [tasks.fix] description = "Format, and apply the lints that can be fixed" run = [ "hk fix --all", "cargo clippy --workspace --all-targets --fix --allow-dirty --allow-staged -- -D warnings", ] [tasks.bench] description = "Compare against other formatters: mise run bench -- " run = "bun bench/run.ts" [tasks."bench:parse"] description = "Compare tidy's parsers with Rust crates: mise run bench:parse -- [--runs ] [--only ] [--rejects] []" run = "bun bench/parse.ts" [tasks."bench:ab"] description = "Time the working tree against a git revision: mise run bench:ab -- [--rev ] ..." run = "bun bench/ab.ts" [tasks."oracle:json"] description = "Compare JSON with Prettier: mise run oracle:json -- [filter] [--show=n] [--oss=]" run = "bun tests/oracle/json.ts" depends = ["build:napi"] [tasks."oracle:json:cases"] description = "Record what Prettier prints for crates/tidy/tests/json.json" run = "bun tests/oracle/json-cases.ts" [tasks."oracle:toml"] description = "Compare TOML with taplo: mise run oracle:toml -- files ... | cases crates/tidy/tests/toml.json | lex [count] | values " dir = "tests/oracle/toml" run = "cargo run --release --" [tasks."oracle:dockerfile"] description = "Compare Dockerfiles with dprint-plugin-dockerfile 0.7.0: mise run oracle:dockerfile -- specs | files ... | fuzz [count] ..." dir = "tests/oracle/dockerfile" run = "cargo run --release --" [tasks."oracle:js"] description = "Compare JS and TS with Prettier: mise run oracle:js -- [dir...] [--show=n] [--list=file] [--embedded]" run = "bun tests/oracle/js.ts" depends = ["build:napi"] [tasks."oracle:js:meaning"] description = "Check that tidy's JS and TS output means what its input means: mise run oracle:js:meaning -- [dir...] [--show=n]" dir = "tests/oracle/meaning" run = "cargo run --release --" [tasks."oracle:graphql"] description = "Compare GraphQL with Prettier: mise run oracle:graphql -- [dir...] [--show=n]" run = "bun tests/oracle/graphql.ts" depends = ["build:napi"] [tasks."corpus:graphql"] description = "Build target/corpus/graphql: GitLab's GraphQL files and five public schemas, after removing it" run = """ set -e rm -rf target/corpus/graphql target/corpus/graphql-gitlab git clone -q --depth 1 --filter=blob:none --no-checkout https://gitlab.com/gitlab-org/gitlab.git target/corpus/graphql-gitlab git -C target/corpus/graphql-gitlab sparse-checkout set --no-cone '*.graphql' '*.gql' git -C target/corpus/graphql-gitlab checkout -q mkdir -p target/corpus/graphql cd target/corpus/graphql-gitlab git ls-files -- '*.graphql' '*.gql' | while read -r file; do cp "$file" "../graphql/gitlab__$(echo "$file" | tr / _)"; done cd ../graphql curl -sfLo github.graphql https://docs.github.com/public/fpt/schema.docs.graphql curl -sfLo saleor.graphql https://raw.githubusercontent.com/saleor/saleor/main/saleor/graphql/schema.graphql curl -sfLo artsy.graphql https://raw.githubusercontent.com/artsy/metaphysics/main/_schemaV2.graphql curl -sfLo swapi.graphql https://raw.githubusercontent.com/graphql/swapi-graphql/master/schema.graphql curl -sfLo sourcegraph.graphql https://raw.githubusercontent.com/sourcegraph/sourcegraph-public-snapshot/main/cmd/frontend/graphqlbackend/schema.graphql """ [tasks."oracle:ini"] description = "Compare INI with prettier-plugin-ini 1.3.0: mise run oracle:ini -- files [dir] | fuzz [count] [--seed=n]" run = "bun tests/oracle/ini.ts" depends = ["build:napi"] [tasks."oracle:yaml"] description = "Compare YAML with yaml 2.9.0 and Prettier: its syntax tree, what parses, its tree, and the output" dir = "tests/oracle/yaml" run = [ "bun cst.ts > ../../../target/yaml-cst.json", "bun accepts.ts > ../../../target/yaml-accepts.json", "bun ast.ts > ../../../target/yaml-ast.json", "bun format.ts > ../../../target/yaml-format.json", "for mode in cst accepts ast format; do cargo run --release -q -- $mode ../../../target/yaml-$mode.json; done", ] [tasks."oracle:markdown:corpus"] description = "Copy the Markdown files of git repos into a corpus: mise run oracle:markdown:corpus -- ..." run = "bun tests/oracle/markdown/corpus.ts" [tasks."oracle:markdown:corpora"] description = "Build the Markdown corpora A to D in target/corpus/markdown from local checkouts, after removing them" run = [ "rm -rf target/corpus/markdown", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/a ~/repos/oss/vite ~/repos/oss/storybook ~/repos/oss/shadcn-svelte", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/b ~/repos/oss/bun ~/repos/personal/starship.io/starship", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/c ~/repos/oss/angular-html-parser ~/repos/oss/rolldown ~/repos/oss/jest ~/repos/oss/v ~/repos/oss/deno ~/repos/oss/deno_lint ~/repos/oss/oxc ~/repos/oss/prettier ~/repos/testing/bootstrap ~/repos/testing/everything-claude-code", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/d ~/repos/oss/prettier:tests/format", ] [tasks."oracle:markdown:prettier"] description = "Count Markdown files that match Prettier and sort the rest: mise run oracle:markdown:prettier -- ..." run = "bun tests/oracle/markdown/prettier.ts" depends = ["build:napi"] [tasks."oracle:markdown:semantics"] description = "Check that formatting Markdown keeps its meaning, on the corpora in TIDY_MARKDOWN_CORPUS" env = { TIDY_MARKDOWN_CORPUS = "{{config_root}}/target/corpus/markdown/a:{{config_root}}/target/corpus/markdown/b:{{config_root}}/target/corpus/markdown/c:{{config_root}}/target/corpus/markdown/d" } run = "cargo test -p tidy --release --test markdown_semantics" [tasks."oracle:markdown:divergences"] description = "Write docs/markdown-divergences.md from the cases in tests/oracle/markdown/divergences" run = "bun tests/oracle/markdown/divergences.ts" depends = ["build:napi"] [tasks."oracle:markdown:shrink"] description = "Shrink a Markdown file that formatting breaks: mise run oracle:markdown:shrink -- [--