Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

lint: Add Prettier as a linter for YAML files.

Anders Kaseorg56e8cca02567
diff --git a/package.json b/package.json
index e6ff35c5dd4..5d806daa653 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/tools/lint b/tools/lint
index f80fb754c1a..7d7753cd2a3 100755
--- a/tools/lint
+++ b/tools/lint
@@ -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
diff --git a/version.py b/version.py
index bc735ba09a9..215ea562479 100644
--- a/version.py
+++ b/version.py
@@ -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'
diff --git a/yarn.lock b/yarn.lock
index 727aaa5c01d..5921615afb2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"