Skip to content

Commit be3e59a

Browse files
Prettier (#55)
* 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
2 parents acd0df4 + 87bfb7d commit be3e59a

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (C) 2017-present Arctic Ice Studio <[email protected]>
2+
# Copyright (C) 2017-present Sven Greb <[email protected]>
3+
#
4+
# Project: snowsaw
5+
# Repository: https://github.com/arcticicestudio/snowsaw
6+
# License: MIT
7+
8+
**/node_modules/*

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626
"arcticicestudio"
2727
],
2828
"scripts": {
29-
"lint": "npm-run-all lint:*",
30-
"lint:md": "remark --no-stdout . \".github/**/*.md\""
29+
"format:pretty": "prettier --write \"./**/*.{js,json,md,yml}\"",
30+
"format": "npm-run-all format:pretty",
31+
"lint:md": "remark --no-stdout . \".github/**/*.md\"",
32+
"lint": "npm-run-all lint:*"
3133
},
3234
"devDependencies": {
3335
"npm-run-all": "4.1.5",
36+
"prettier": "1.18.2",
3437
"remark-cli": "6.0.1",
3538
"remark-preset-lint-arcticicestudio": ">=0.3.0 <1.0.0"
3639
},

prettier.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (C) 2017-present Arctic Ice Studio <[email protected]>
3+
* Copyright (C) 2017-present Sven Greb <[email protected]>
4+
*
5+
* Project: snowsaw
6+
* Repository: https://github.com/arcticicestudio/snowsaw
7+
* License: MIT
8+
* References:
9+
* https://prettier.io/docs/en/configuration.html
10+
* https://prettier.io/docs/en/options.html
11+
*/
12+
13+
/**
14+
* @file The Prettier configuration.
15+
* @author Arctic Ice Studio <[email protected]>
16+
* @author Sven Greb <[email protected]>
17+
* @see https://prettier.io/docs/en/configuration.html
18+
*/
19+
20+
module.exports = {
21+
printWidth: 120
22+
};

0 commit comments

Comments
 (0)