lint: Add Prettier as a linter for YAML files.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-01 12:20:07 -07:00 committed by Tim Abbott
parent 2794bc1ef4
commit 56e8cca025
4 changed files with 12 additions and 1 deletions

View File

@ -96,6 +96,7 @@
"jsdom": "^16.1.0",
"nyc": "^15.0.0",
"phantomjs-prebuilt": "^2.1.16",
"prettier": "^2.0.5",
"puppeteer": "^3.0.0",
"source-map": "^0.6.1",
"stylelint": "^13.0.0",

View File

@ -93,6 +93,11 @@ def run() -> None:
linter_config.external_linter('isort', ['isort'], ['py'],
description="Sorts Python import statements",
check_arg=['--check-only', '--diff'])
linter_config.external_linter('prettier', ['node_modules/.bin/prettier'], ['yaml', 'yml'],
check_arg=['--check'], fix_arg=['--write'],
description="Formats YAML files",
# https://github.com/prettier/prettier/pull/8703
suppress_line=lambda line: line in ["Checking formatting...\n", "All matched files use Prettier code style!\n"])
semgrep_command = ["semgrep", "--config=./tools/semgrep.yml", "--error",
# This option is dangerous in the context of running

View File

@ -44,4 +44,4 @@ API_FEATURE_LEVEL = 24
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
PROVISION_VERSION = '89.3'
PROVISION_VERSION = '89.4'

View File

@ -9669,6 +9669,11 @@ prepend-http@^1.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
prettier@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4"
integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==
pretty-error@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"