rust icon indicating copy to clipboard operation
rust copied to clipboard

[CI] lint our JSON file indentation

Open efx opened this issue 4 years ago • 1 comments

I probably introduced annoying indentation to our config.json. :sweat_smile: I would like to standardize that formatting check using CI.

I propose we steal the prettier action from JavaScript track and use the --check flag. Then, contributors could run a local script that executes npx prettier -write.

This is similar to #1110.

efx avatar Feb 18 '21 23:02 efx

Fundamental idea is good. prettier is IMO the wrong tool for the job: it's interpreted and requires a node/npm installation. It's also a general-purpose formatter for common frontend languages. For its use case, it's great, but we can leverage the tools CI already has installed with something like

# bash
if [ -n "$(diff config.json "<(jq . config.json)")" ]; then
  echo "config.json is improperly formatted"
  exit 1
fi

coriolinus avatar Feb 18 '21 23:02 coriolinus