Skip to content

Commit 9f233dd

Browse files
authored
fix: prettier config files for client/server (#519)
1 parent 89e8df0 commit 9f233dd

7 files changed

Lines changed: 321 additions & 18 deletions

File tree

.huskyrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}}
1+
{
2+
"hooks": {
3+
"commit-msg":"commitlint -E HUSKY_GIT_PARAMS",
4+
"pre-commit": "pretty-quick --staged"
5+
}
6+
}

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 80,
3+
"arrowParens": "always",
4+
"singleQuote": true,
5+
"semi": true,
6+
"tabWidth": 2,
7+
"trailingComma": "all",
8+
"bracketSpacing": true
9+
}

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ Please add any missing content to this readme.
88

99
## Development Environment Quick Start
1010

11-
We support both front end and backend development in this repository currently. Depending on which part of the admin panel you are contributing too, you have different options for setting up development.
11+
We support both front end and backend development in this repository currently. Depending on which part of the admin panel you are contributing too, you have different options for setting up development.
1212

1313
There are three options for setting up your development environment:
14+
1415
1. For frontend work only
1516
1. Skip installing and running the API locally
1617
2. For backend work only
@@ -30,7 +31,8 @@ See https://git-scm.com/downloads for instructions.
3031
_Node.js version 12.x works best for now; later versions have exhibited some strange behaviour with this project.
3132
If you encounter issues with the server, check your version of Node.js first. This includes CORS related issues when fetching the API._
3233

33-
We recommend using [nvm](https://github.com/nvm-sh/nvm) to install and manage your Node.js instances. More details here: https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/
34+
We recommend using [nvm](https://github.com/nvm-sh/nvm) to install and manage your Node.js instances. More details here: https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/
35+
3436
1. Install nvm: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash
3537
2. nvm install 12.20.0
3638
3. nvm use 12.20.0
@@ -50,6 +52,7 @@ git clone https://github.com/<username>/treetracker-admin.git
5052
```
5153

5254
Add Greenstand as a remote:
55+
5356
```
5457
git remote add upstream https://github.com/Greenstand/treetracker-admin
5558
```
@@ -61,6 +64,7 @@ _Only required for backend/API development_
6164
1. Get the server dev env file pinned to the #admin_panel_chat channel in Greenstand Slack: `.env.development` (Note that the leading `.` may be removed if you download the file from Slack, so you'll need to rename it)
6265
1. Copy the file to the `./server` directory within your local repo
6366
1. Add a `.env.local` file in the `./client` directory containing the following line:
67+
6468
```
6569
REACT_APP_API_ROOT=http://localhost:3000
6670
```
@@ -94,19 +98,24 @@ npm start
9498
We use automatic semantic versioning, which looks at commit messages to determine how to increment the version number for deployment.
9599

96100
Your commit messages will need to follow the [Conventional Commits](https://www.conventionalcommits.org/) format, for example:
101+
97102
```
98103
feat: add new button
99104
```
105+
100106
Since we squash commits on merging PRs into `master`, this applies to PR titles as well.
101107

102108
## Keeping Your Fork in Sync
103109

104110
Your forked repo won't automatically stay in sync with Greenstand, so you'll need to occassionally sync manually (typically before starting work on a new feature).
111+
105112
```
106113
git pull upstream master --rebase
107114
git push origin master
108115
```
116+
109117
You might also need to sync and merge `master` into your feature branch before submitting a PR to resolve any conflicts.
118+
110119
```
111120
git checkout <feature_branch>
112121
git merge master
@@ -206,8 +215,6 @@ Here is our [wiki page for troubleshooting](https://github.com/Greenstand/treetr
206215

207216
Help us to improve it by adding your experience solving this problem.
208217

209-
210-
211218
#### View the Treetracker Admin Panel
212219

213220
Visit http://localhost:3001
@@ -317,6 +324,8 @@ Redux-connected component, and how to test it.
317324

318325
## Code style guide
319326

327+
If you are using VSCode as your IDE, please follow [this guide](https://www.digitalocean.com/community/tutorials/how-to-format-code-with-prettier-in-visual-studio-code) to setup Prettier and automatically format your code on file save. Configuration files are already included in this repo.
328+
320329
**Indention** 2 Spaces for indentation
321330

322331
**Semicolon** Use semicolons at the end of each line
@@ -329,15 +338,15 @@ Redux-connected component, and how to test it.
329338
const foo = 'bar';
330339
```
331340

332-
**Braces** Opening braces go on the same line as the statment
341+
**Braces** Opening braces go on the same line as the statement
333342

334343
```js
335344
if (true) {
336345
console.log('here');
337346
}
338347
```
339348

340-
**Variable declaration** Declare one Varable per statment
349+
**Variable declaration** Declare one Variable per statement
341350

342351
```js
343352
const dog = ['bark', 'woof'];
@@ -354,13 +363,13 @@ const adminUser = db.query('SELECT * From users ...');
354363

355364
```js
356365
class Dog {
357-
bark(){
366+
bark() {
358367
console.log('woof');
359368
}
360369
}
361370
```
362371

363-
**Descriptive conditions** Make sure to to have a descriptive name that tells the use and meaning of the code
372+
**Descriptive conditions** Make sure to have a descriptive name that tells the use and meaning of the code
364373

365374
```js
366375
const isValidPassword =
@@ -419,7 +428,6 @@ In this way, we can write the code and get the tests result immediately.
419428

420429
NOTE: when running tests, the files related to Loopback are loaded from ./dist folder. That's because for Jest, it does not output compiled files at all, and Loopback will try to load the controllers at runtime.
421430

422-
423431
### See [Current Milestone](https://github.com/Greenstand/treetracker-admin/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.1.0)
424432

425433
See [Contributing to The Cause](https://github.com/Greenstand/Development-Overview#contributing-to-the-cause)

client/.prettierrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"printWidth": 100,
2+
"printWidth": 80,
33
"arrowParens": "always",
44
"singleQuote": true,
5-
"semi": false,
5+
"semi": true,
66
"tabWidth": 2,
7-
"trailingComma": "es5"
7+
"trailingComma": "all",
8+
"bracketSpacing": true
89
}

0 commit comments

Comments
 (0)