Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
63 changes: 37 additions & 26 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
{
"parser": "babel-eslint",

"env": {
"node": true,
"mocha": true
},

"parserOptions": {
"ecmaVersion": 9
"mocha": true,
"es6": true
},

"globals": {
"Promise": true,
"_": true,
"async": true
"async": true,
"expect": true,
"jest": true
},

"rules": {
"callback-return": [
"error", ["done", "proceed", "next", "onwards", "callback", "cb"]
"error",
["done", "proceed", "next", "onwards", "callback", "cb"]
],
"camelcase": [
"warn",
{
"properties": "always"
}
],
"camelcase": ["warn", {
"properties": "always"
}],
"comma-style": ["warn", "last"],
"curly": ["error"],
"eqeqeq": ["error", "always"],
Expand Down Expand Up @@ -48,20 +53,26 @@
"new-cap": ["off"],
"consistent-this": ["error", "that"],
"no-unused-vars": [
"warn",
"error",
{
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)"
}
],
"no-use-before-define": ["error", {
"functions": false
}],
"no-use-before-define": [
"error",
{
"functions": false
}
],
"no-var": 2,
"one-var": ["warn", "never"],
"prefer-arrow-callback": ["warn", {
"allowNamedFunctions": true
}],
"prefer-arrow-callback": [
"warn",
{
"allowNamedFunctions": true
}
],
"quotes": [
"warn",
"single",
Expand All @@ -70,17 +81,19 @@
"allowTemplateLiterals": true
}
],
"semi": ["error", "never"],
"semi-spacing": ["warn", {
"before": false,
"after": true
}],
"semi-spacing": [
"warn",
{
"before": false,
"after": true
}
],
"semi-style": ["warn", "last"],
"space-before-function-paren": ["off", 2],
"prettier/prettier": "error"
},
"extends": [
"formidable/rules/eslint/best-practices/on",
"formidable/rules/eslint/best-practices/off",
"formidable/rules/eslint/es6/on",
"formidable/rules/eslint/errors/off",
"formidable/rules/eslint/strict/on",
Expand All @@ -89,7 +102,5 @@
"formidable/rules/eslint/variables/on",
"prettier"
],
"plugins": [
"prettier"
]
"plugins": ["prettier"]
}
42 changes: 42 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch nodemon in debug",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/nodemon",
"program": "${workspaceFolder}/server.js",
"restart": true,
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"port": 9230
},
{
"name": "Launch mocha test in debug",
"request": "launch",
"runtimeArgs": ["run", "mocha", "${relativeFile}"],
"runtimeExecutable": "npm",
"skipFiles": ["<node_internals>/**"],
"type": "node",
"env": {
"PORT": "3111"
}
},
{
"name": "Launch jest in debug",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeArgs": [
"--inspect-brk",
"node_modules/.bin/jest",
"--runInBand",
"--config=jest.config.js",
"${file}"
],
"port": 9231
}
]
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## v9.0.0 (October 3, 2020)

- Major breaking changes, now controllers and middleware is split in single files for more scalability and testability
- Added Jest setup
- Added first Jest test
- Added VS Code setup for debugging Jest and nodemon
- Added more reports for coverage, now there are three: 1 for Jest tests, 1 for mocha tests (end to end) and a 3rd that merges the previous 2.
- NPM updated

## v8.1.5 (July 30, 2020)

- NPM updated
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ If you need to add more routes to the project just create a new file in `/app/ro

### Creating new controllers

When you create a new controller file, try to also create another file with validations. Ex. `countries.js` and `countries.validate.js`. An example of this is included in the repository.
When you create a new controller, try to also create another folder with validations and helpers. Ex. `/countries`, `/countries/validators` and `/countries/helpers`. An example of this is included in the repository.

## Bugs or improvements

Expand Down
Loading