Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development setup #62

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1fd63f1
Remove debug
lguima Feb 24, 2022
6a7a81a
Add Editor Config file
lguima Feb 24, 2022
e81764b
Moved the README images to a separated folder
lguima Feb 24, 2022
82c5359
Update images path
lguima Feb 24, 2022
ac171bd
Create a contributing file
lguima Feb 24, 2022
562569c
Point the contributing section to the respective file
lguima Feb 24, 2022
f5c565b
Add ESLint
lguima Feb 24, 2022
2e746fe
Configure ESLint
lguima Feb 24, 2022
73a9aec
Add Prettier
lguima Feb 24, 2022
53ccedc
Configure Prettier
lguima Feb 24, 2022
7009922
Specify some useful VSCode settings and extensions
lguima Feb 24, 2022
a05813f
Downgrade ESLint to be compatible with React Scripts
lguima Feb 28, 2022
db84df1
Configure ESLint to fix build
lguima Feb 28, 2022
cc95c9a
Revert "Configure ESLint to fix build"
lguima Feb 28, 2022
3b06b09
Add Babel ESLint Parser and Babel Preset React
lguima Feb 28, 2022
85f4b39
Configure ESLint to integrate with Babel ESLint Parser and Babel Pres…
lguima Feb 28, 2022
1ae276e
Set prop for configuration cascading
lguima Feb 28, 2022
d256a28
Set 'no-unused-vars' and 'react/prop-types' rules as warn instead of …
lguima Feb 28, 2022
a86258c
Set 'prettier/prettier' rule as warn instead of errors
lguima Feb 28, 2022
fa096ad
Apply Prettier rules
lguima Feb 28, 2022
7ccc41e
Set a key prop for the element in the iterator
lguima Feb 28, 2022
5949533
Apply Prettier rules
lguima Feb 28, 2022
962ab62
Fix 'no-case-declarations' rule
lguima Feb 28, 2022
3c0be75
Apply Prettier rules
lguima Feb 28, 2022
5b75187
Fix 'no-import-assign' rule
lguima Feb 28, 2022
e85424e
Add 'eslint-plugin-jest' to integrate Jest with ESLint
lguima Feb 28, 2022
886b96e
Configure 'eslint-plugin-jest' to integrate Jest with ESLint
lguima Feb 28, 2022
5049fd3
Add Husky
lguima Feb 28, 2022
ede28e1
Set 'lint' command to accept no warnings
lguima Feb 28, 2022
f58a361
Add LintStaged
lguima Feb 28, 2022
e4790d3
Configure LintStaged to run the 'lint' command and try to fix
lguima Feb 28, 2022
5669eef
Configure Husky to run the lint-staged
lguima Feb 28, 2022
98fa49f
Merge branch 'master' into development-setup
lguima May 21, 2022
3db77d1
Remove extra boolean cast according to 'no-extra-boolean-cast' rule
lguima May 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
indent_style = spaces
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
40 changes: 40 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true,
"jest/globals": true
},
"settings": {
"react": {
"version": "detect"
}
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module",
"requireConfigFile": false,
"babelOptions": {
"presets": ["@babel/preset-react"]
}
},
"plugins": [
"react",
"jest"
],
"rules": {
"prettier/prettier": "warn",
"no-unused-vars": "warn",
"react/prop-types": "warn"
}
}
49 changes: 49 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boa, brigado por organizar esse arquivo!
tava há tempos querendo fazer isso haha


We're using [GitHub Issues](https://github.com/cmdalbem/ciclomapa/issues) for our backlog. Feel free to take a look around and chose the task you want. Use the tags at your advantage:

- `complexity` tags tell you how difficult a task *probably* is.
- `good first issue` is the perfect place to start if you're new to the project, or to coding itself.
- `help wanted` are issues where external help is currently more needed.

After you've chosen your task, you have no doubts on it and you're ready to start coding, follow these steps:

1. Fork this repository.
2. Create a branch: `git checkout -b <branch_name>`.
3. Make your changes and commit them: `git commit -m '<commit_message>'`
4. Push to the original branch: `git push origin <project_name>/<location>`
5. Create the pull request.

Alternatively see the GitHub documentation on [creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

---

## Visual Studio Code

### Settings

`.vscode/settings.json`
```
{
...
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

essa configuração faz o editor corrigir automaticamente todos warnings quando o arquivo é salvo, certo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exatamente, assim garante que quando for fazer o commit, já está corrigido.

},
...
}
```

### Extensions

#### [EditorConfig](https://editorconfig.org/)

`code --install-extension EditorConfig.EditorConfig`

#### [ESLint](https://eslint.org/)

`code --install-extension dbaeumer.vscode-eslint`

#### [Prettier](https://prettier.io/)

`code --install-extension esbenp.prettier-vscode`
File renamed without changes
File renamed without changes
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": true,
"singleQuote": true
}
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Mockups of different devices showing the app](./mockups.png)
![Mockups of different devices showing the app](./.github/mockups.png)


# CicloMapa
Expand Down Expand Up @@ -31,7 +31,7 @@ The basic premise is that the OSM Overpass API is *very* slow and we couldn't hi

We store a mirror of the OSM data in a Firebase Database. Any user (possibly an OSM contributor) can manually update this data, which will automatically update the Database.

![A diagram of the system architecture and how it communicates with external services](./arch.jpg)
![A diagram of the system architecture and how it communicates with external services](./.github/arch.jpg)


# Getting started
Expand Down Expand Up @@ -64,21 +64,9 @@ yarn run deploy

## Contributing

We're using [GitHub Issues](https://github.com/cmdalbem/ciclomapa/issues) for our backlog. Feel free to take a look around and chose the task you want. Use the tags at your advantage:
Thanks for considering contributing to CicloMapa!

- `complexity` tags tell you how difficult a task *probably* is.
- `good first issue` is the perfect place to start if you're new to the project, or to coding itself.
- `help wanted` are issues where external help is currently more needed.

After you've chosen your task, you have no doubts on it and you're ready to start coding, follow these steps:

1. Fork this repository.
2. Create a branch: `git checkout -b <branch_name>`.
3. Make your changes and commit them: `git commit -m '<commit_message>'`
4. Push to the original branch: `git push origin <project_name>/<location>`
5. Create the pull request.

Alternatively see the GitHub documentation on [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).
Check out our [Contribution Guide](.github/CONTRIBUTING.md).


## Contact
Expand Down
21 changes: 20 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@
},
"scripts": {
"start": "craco start",
"lint": "eslint src --max-warnings=0",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

essa configuração obriga a ter zero warnings de eslint, certo?
vc se importa se não usarmos essa configuração? pessoalmente as vezes eu tenho preferencia por, em alguns casos muito específicos, quebrar algumas regrinhas pra melhorar a legibilidade do código

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nesses casos tem como ignorar o linter para determinados arquivos ou linhas, assim não gera warning:

"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject",
"predeploy": "yarn run build",
"deploy": "gh-pages -d build"
"deploy": "gh-pages -d build",
"prepare": "husky install"
},
"lint-staged": {
"src/**/*": [
"yarn lint --fix"
]
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -50,5 +57,17 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@babel/preset-react": "^7.16.7",
"eslint": "^7.11.0",
"eslint-config-prettier": "^8.4.0",
"eslint-plugin-jest": "^26.1.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"husky": "^7.0.0",
"lint-staged": "^12.3.4",
"prettier": "2.5.1"
}
}
Loading