зеркало из https://github.com/mozilla/treeherder.git
Bug 1522101 - Use `prettier --check` to validate formatting
Currently Prettier is used via the ESLint integration, which only supports JS/JSX and not the other filetypes Prettier is able to format. For now these additional filetypes are excluded by `.prettierignore` entries, however these will be removed/fixes applied in later commits.
This commit is contained in:
Родитель
608019de94
Коммит
e583700cb1
|
@ -15,6 +15,8 @@ matrix:
|
|||
script:
|
||||
# `yarn build` is tested as part of the Selenium job.
|
||||
- yarn lint
|
||||
# `yarn lint` only checks the formatting of JS/JSX, this will also check CSS/HTML/JSON/Markdown/YAML.
|
||||
- yarn format:check
|
||||
- yarn test
|
||||
|
||||
- env: python2-linters
|
||||
|
|
|
@ -38,7 +38,13 @@ We use Prettier for JS/JSX formatting and the [Airbnb](https://github.com/airbnb
|
|||
guide for non-style related best practices. Both are validated using ESlint (see Validating
|
||||
Javascript in the [Installation section](installation.html#validating-javascript)).
|
||||
|
||||
We recommend that you [add Prettier to your editor/IDE](https://prettier.io/docs/en/editors.html)
|
||||
Prettier is also used to format JSON/CSS/HTML/Markdown/YAML. However these are not supported
|
||||
by ESLint, so instead are validated using Prettier's CLI. To manually check their formatting
|
||||
(as well as that of JS/JSX) using Prettier, run `yarn format:check`, or to apply formatting
|
||||
fixes run `yarn format`.
|
||||
|
||||
However we recommend that you instead
|
||||
[add Prettier to your editor/IDE](https://prettier.io/docs/en/editors.html)
|
||||
and enable "format on save" for the most seamless development workflow.
|
||||
|
||||
Imports in JS/JSX must be ordered like so (with newlines between each group):
|
||||
|
|
|
@ -98,6 +98,8 @@
|
|||
"scripts": {
|
||||
"build": "node ./node_modules/webpack/bin/webpack.js --mode production",
|
||||
"build:dev": "node ./node_modules/webpack/bin/webpack.js --mode development",
|
||||
"format": "node ./node_modules/prettier/bin-prettier.js --write \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
|
||||
"format:check": "node ./node_modules/prettier/bin-prettier.js --check \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
|
||||
"heroku-postbuild": "yarn build",
|
||||
"lint": "node ./node_modules/eslint/bin/eslint.js --cache --report-unused-disable-directives --max-warnings 0 --format codeframe --ext js,jsx \".*.js\" \"*.js\" ui/ tests/ui/",
|
||||
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode development",
|
||||
|
|
Загрузка…
Ссылка в новой задаче