diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..59c243b8b0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +/static/third diff --git a/prettier.config.js b/prettier.config.js index 5f9d8da169..1a98a2c0e5 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,3 +1,19 @@ module.exports = { bracketSpacing: false, + tabWidth: 4, + trailingComma: "all", + overrides: [ + { + files: ["frontend_tests/casper_tests/*.js", "frontend_tests/casper_lib/*.js"], + options: { + trailingComma: "es5", + }, + }, + { + files: ["**.yml", "**.yaml"], + options: { + tabWidth: 2, + }, + }, + ], }; diff --git a/tools/lint b/tools/lint index 7d7753cd2a..a537c0abd5 100755 --- a/tools/lint +++ b/tools/lint @@ -93,9 +93,10 @@ 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'], + linter_config.external_linter('prettier', ['node_modules/.bin/prettier'], + ['js', 'ts', 'yaml', 'yml'], check_arg=['--check'], fix_arg=['--write'], - description="Formats YAML files", + description="Formats JavaScript and YAML", # https://github.com/prettier/prettier/pull/8703 suppress_line=lambda line: line in ["Checking formatting...\n", "All matched files use Prettier code style!\n"])