lukeed/tidyPublic

feat: tidy config files

tidyrs::Settings holds each language's settings, Shared sets the
choices they have in common, and tidyrs::format picks the language.
Each language still formats on its own with its own settings.

With the config feature, a Resolver reads the nearest tidy.json,
tidy.jsonc or tidy.toml, and .editorconfig as Prettier reads it.
A config sets shared options at the top and each language's own in
its section, where the shared ones can be set again. The walk tells
the resolver what config files each folder has, so resolving costs
no extra file system calls.

The CLI and the Node binding take the same option names as the
config: width, indent, tabs, eol, whitespace, quote, ignore, and so
on. The CLI adds --config, --no-config and --stdin-filepath, and
reports syntax errors with their line and column.
LELuke Edwards authored
53d186dPatch
Parent5fccf55
15 files changed+1226-344
StackedSplit
Cargo.lock+98 −0
bench/css.ts+3 −3
bench/run.ts+2 −2
crates/tidyrs/Cargo.toml+8 −0
crates/tidyrs/src/config.rs+496 −0
crates/tidyrs/src/lib.rs+5 −0
crates/tidyrs/src/settings.rs+213 −0
crates/tidyrs/tests/config.rs+127 −0
crates/tidyrs_cli/Cargo.toml+1 −1
crates/tidyrs_cli/src/main.rs+153 −173
crates/tidyrs_napi/Cargo.toml+3 −2
crates/tidyrs_napi/src/lib.rs+96 −143
tests/oracle/conformance.ts+13 −12
tests/oracle/tempura.ts+1 −1
tests/oracle/xml.ts+7 −7