Skip to content

Commit

Permalink
Prettier (#55)
Browse files Browse the repository at this point in the history
* Install `prettier`

Installed the main `prettier` (1) NPM package.

References:
  (1) npmjs.com/package/prettier

Epic: GH-33
Depends on GH-47 GH-49
GH-37

<--------------------------------------------------------------------->

* Implement Prettier configuration and ignore pattern file

This is one of the main features of Prettier: It already provides the
best and recommended style configurations of-out-the-box.
The only option that has been changed is the print width (1). It is set
to `80` by default which not up-to-date for modern screens (might only
be relevant when working in terminals only like e.g. with Vim). It is
now set to `120` used by all of Arctic Ice Studio's style guides.
The `prettier.config.js` configuration file is placed in the project
root as well as the `.prettierignore` file that defines ignore pattern.

References:
  (1) prettier.io/docs/en/options.html#print-width

Epic: GH-33
Depends on GH-47 GH-49
GH-37


* Implement NPM `format:pretty` script/task for Prettier

To allow to format all sources the `format:pretty` NPM script/task has
been added as well as the `format` script/task to run all tasks of the
formatting workflow.

Epic: GH-33
Depends on GH-47 GH-49
Resolves GH-37
  • Loading branch information
arcticicestudio authored Jun 22, 2019
2 parents acd0df4 + 87bfb7d commit be3e59a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (C) 2017-present Arctic Ice Studio <development@arcticicestudio.com>
# Copyright (C) 2017-present Sven Greb <development@svengreb.de>
#
# Project: snowsaw
# Repository: https://github.com/arcticicestudio/snowsaw
# License: MIT

**/node_modules/*
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@
"arcticicestudio"
],
"scripts": {
"lint": "npm-run-all lint:*",
"lint:md": "remark --no-stdout . \".github/**/*.md\""
"format:pretty": "prettier --write \"./**/*.{js,json,md,yml}\"",
"format": "npm-run-all format:pretty",
"lint:md": "remark --no-stdout . \".github/**/*.md\"",
"lint": "npm-run-all lint:*"
},
"devDependencies": {
"npm-run-all": "4.1.5",
"prettier": "1.18.2",
"remark-cli": "6.0.1",
"remark-preset-lint-arcticicestudio": ">=0.3.0 <1.0.0"
},
Expand Down
22 changes: 22 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2017-present Arctic Ice Studio <development@arcticicestudio.com>
* Copyright (C) 2017-present Sven Greb <development@svengreb.de>
*
* Project: snowsaw
* Repository: https://github.com/arcticicestudio/snowsaw
* License: MIT
* References:
* https://prettier.io/docs/en/configuration.html
* https://prettier.io/docs/en/options.html
*/

/**
* @file The Prettier configuration.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @see https://prettier.io/docs/en/configuration.html
*/

module.exports = {
printWidth: 120
};

0 comments on commit be3e59a

Please sign in to comment.