Skip to content

Commit

Permalink
lint: Use Prettier for JSON files.
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk authored and timabbott committed Jul 24, 2020
1 parent 40be4df commit 2e029eb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
19 changes: 11 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{sh,py,pyi,js,ts,json,xml,css,scss,hbs,html}]
indent_style = space
[*.{sh,py,pyi,xml,css,scss,hbs,html}]
indent_size = 4

[{*.{js,json,ts},check-openapi}]
indent_size = 4
max_line_length = 100

[*.py]
[*.{py,pyi}]
max_line_length = 110

[*.{js,ts}]
max_line_length = 100
[*.{svg,rb,pp,yaml,yml}]
indent_size = 2

[*.{svg,rb,pp}]
indent_style = space
[package.json]
indent_size = 2
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
/corporate/tests/stripe_fixtures
/locale
/static/third
/tools/setup/emoji/emoji_map.json
/zerver/tests/fixtures
/zerver/webhooks/*/fixtures
6 changes: 3 additions & 3 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
bracketSpacing: false,
tabWidth: 4,
trailingComma: "all",
overrides: [
{
Expand All @@ -10,9 +9,10 @@ module.exports = {
},
},
{
files: ["**.yml", "**.yaml"],
files: ["tsconfig.json"],
options: {
tabWidth: 2,
parser: "json5",
quoteProps: "preserve",
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion tools/lint
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def run() -> None:
description="Sorts Python import statements",
check_arg=['--check-only', '--diff'])
linter_config.external_linter('prettier', ['node_modules/.bin/prettier', '--check'],
['js', 'ts', 'yaml', 'yml'],
['js', 'json', 'ts', 'yaml', 'yml'],
fix_arg=['--write'],
description="Formats JavaScript and YAML",
# https://github.com/prettier/prettier/pull/8703
Expand Down

0 comments on commit 2e029eb

Please sign in to comment.