Skip to content

Commit e7d5f0b

Browse files
committed
chore(dev): add prettier & @boringcodes/prettier-config for formating code style
1 parent af0d67a commit e7d5f0b

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

.github/workflows/lint-source.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ jobs:
1313
registry-url: https://registry.npmjs.org
1414
- name: Install dependencies
1515
run: yarn
16+
- name: Check code style
17+
run: yarn format:check
1618
- name: Check code quality
1719
run: yarn lint

.lintstagedrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"**/*.js": ["yarn lint"]
2+
"**/*.js": ["yarn format", "yarn lint"]
33
}

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@boringcodes/prettier-config');

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
"main": "index.js",
1111
"scripts": {
1212
"purge": "rm -rf node_modules",
13+
"format": "prettier --write --ignore-path .gitignore **/*.js",
14+
"format:check": "prettier --check --ignore-path .gitignore **/*.js",
1315
"lint": "eslint --ignore-path .gitignore **/*.js",
1416
"release": "standard-version --no-verify",
1517
"release:major": "yarn release --release-as major",
1618
"release:minor": "yarn release --release-as minor",
1719
"release:patch": "yarn release --release-as patch"
1820
},
1921
"devDependencies": {
22+
"@boringcodes/prettier-config": "^1.2.2",
2023
"eslint": "^6.8.0",
2124
"eslint-config-prettier": "^6.10.1",
2225
"eslint-config-standard": "^14.1.1",
@@ -26,6 +29,7 @@
2629
"eslint-plugin-standard": "^4.0.1",
2730
"husky": "^4.2.3",
2831
"lint-staged": "^10.0.9",
32+
"prettier": "^2.0.2",
2933
"standard-version": "^6.0.1"
3034
},
3135
"peerDependencies": {

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
dependencies:
3131
regenerator-runtime "^0.13.4"
3232

33+
"@boringcodes/prettier-config@^1.2.2":
34+
version "1.2.2"
35+
resolved "https://registry.yarnpkg.com/@boringcodes/prettier-config/-/prettier-config-1.2.2.tgz#47336d595011930cd5aacc235e1ee5e12840fc7d"
36+
integrity sha512-JaOIasT4tPGV6plBTfth1Ps1tQ54orlfTeF/TmX8EUJ2+vM9aRgnvdiTLk226y763c/zjswseUUyM2DSaqd9cw==
37+
3338
"@samverschueren/stream-to-observable@^0.3.0":
3439
version "0.3.0"
3540
resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f"
@@ -2266,6 +2271,11 @@ prelude-ls@~1.1.2:
22662271
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
22672272
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
22682273

2274+
prettier@^2.0.2:
2275+
version "2.0.2"
2276+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.2.tgz#1ba8f3eb92231e769b7fcd7cb73ae1b6b74ade08"
2277+
integrity sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==
2278+
22692279
process-nextick-args@~2.0.0:
22702280
version "2.0.1"
22712281
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"

0 commit comments

Comments
 (0)