-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
3,390 additions
and
3,155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,36 @@ | ||
env: | ||
node: true | ||
es2017: true | ||
|
||
parserOptions: | ||
ecmaVersion: 2019 | ||
|
||
rules: | ||
comma-dangle: 2 | ||
no-alert: 2 | ||
no-array-constructor: 2 | ||
no-caller: 2 | ||
no-catch-shadow: 2 | ||
no-control-regex: 2 | ||
no-debugger: 2 | ||
no-div-regex: 2 | ||
no-dupe-keys: 2 | ||
no-else-return: 2 | ||
no-empty: 2 | ||
no-empty-character-class: 2 | ||
no-eq-null: 2 | ||
no-eval: 2 | ||
no-ex-assign: 2 | ||
no-func-assign: 0 | ||
no-floating-decimal: 2 | ||
no-implied-eval: 2 | ||
no-with: 2 | ||
no-fallthrough: 2 | ||
no-unreachable: 2 | ||
no-undef: 2 | ||
no-undef-init: 2 | ||
no-unused-expressions: 2 | ||
no-octal: 2 | ||
no-octal-escape: 2 | ||
no-obj-calls: 2 | ||
no-multi-str: 2 | ||
no-new-wrappers: 2 | ||
no-new: 2 | ||
no-new-func: 2 | ||
no-native-reassign: 2 | ||
no-delete-var: 2 | ||
no-return-assign: 2 | ||
no-new-object: 2 | ||
no-label-var: 2 | ||
no-self-compare: 2 | ||
no-sync: 2 | ||
no-loop-func: 2 | ||
no-labels: 2 | ||
no-unused-vars: | ||
- 1 | ||
- argsIgnorePattern: ^_ | ||
varsIgnorePattern: ^_ | ||
no-script-url: 2 | ||
no-proto: 2 | ||
no-iterator: 2 | ||
no-mixed-requires: | ||
- 0 | ||
- false | ||
no-extra-parens: 2 | ||
no-shadow: 2 | ||
no-use-before-define: 2 | ||
no-redeclare: 2 | ||
no-regex-spaces: 2 | ||
no-mixed-spaces-and-tabs: 2 | ||
no-underscore-dangle: 0 | ||
|
||
brace-style: 2 | ||
camelcase: 2 | ||
consistent-this: | ||
- 2 | ||
- self | ||
curly: 2 | ||
dot-notation: 2 | ||
eqeqeq: 2 | ||
new-cap: 2 | ||
new-parens: 2 | ||
quotes: | ||
- 2 | ||
- single | ||
semi: 2 | ||
strict: | ||
- 2 | ||
- global | ||
use-isnan: 2 | ||
valid-typeof: 2 | ||
wrap-iife: 2 | ||
indent: | ||
- 1 | ||
- 4 | ||
- SwitchCase: 1 | ||
{ | ||
"extends": [ | ||
"airbnb-base", | ||
"prettier" | ||
], | ||
"rules": { | ||
"no-underscore-dangle": "off", | ||
"no-console": "off", | ||
"no-plusplus": "off", | ||
"func-names": [ | ||
"warn", | ||
"as-needed" | ||
], | ||
"no-restricted-syntax": [ | ||
"error", | ||
{ | ||
"selector": "LabeledStatement", | ||
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.", | ||
}, | ||
{ | ||
"selector": "WithStatement", | ||
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.", | ||
}, | ||
] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"test/**/*.js" | ||
], | ||
"env": { | ||
"mocha": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run format | ||
npm run format && npm run lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
'use strict'; | ||
|
||
var httpMocks = require('../lib/http-mock'); | ||
const httpMocks = require('../lib/http-mock'); | ||
|
||
// Suppose you have the following Express route: | ||
|
||
// app.get('/user/:id', routeHandler); | ||
|
||
// And you have created a function to handle that route's call: | ||
|
||
var routeHandler = function (request, response) { | ||
var id = request.params.id; | ||
const routeHandler = function (request, response) { | ||
const { id } = request.params; | ||
|
||
console.log("We have a '%s' request for %s (ID: %d)", request.method, request.url, id); | ||
|
||
var body = { | ||
const body = { | ||
name: 'Bob Dog', | ||
age: 42, | ||
email: '[email protected]' | ||
|
@@ -30,19 +28,19 @@ var routeHandler = function (request, response) { | |
// with some code like this using the testing framework of your choice: | ||
|
||
exports['routeHandler - Simple testing'] = function (test) { | ||
var request = httpMocks.createRequest({ | ||
const request = httpMocks.createRequest({ | ||
method: 'GET', | ||
url: '/user/42', | ||
params: { | ||
id: 42 | ||
} | ||
}); | ||
|
||
var response = httpMocks.createResponse(); | ||
const response = httpMocks.createResponse(); | ||
|
||
routeHandler(request, response); | ||
|
||
var data = response._getJSONData(); | ||
const data = response._getJSONData(); | ||
|
||
test.equal('Bob Dog', data.name); | ||
test.equal(42, data.age); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
'use strict'; | ||
|
||
var httpMocks = require('../lib/http-mock'); | ||
const httpMocks = require('../lib/http-mock'); | ||
|
||
// Suppose you have the following Express route: | ||
|
||
// app.post('/users', routeHandler); | ||
|
||
// And you have created a function to handle that route's call: | ||
|
||
var routeHandler = function (request, response) { | ||
const routeHandler = function (request, response) { | ||
console.log("We have a '%s' request for %s", request.method, request.url); | ||
|
||
var body = { | ||
const body = { | ||
name: 'Bob Dog', | ||
age: 42, | ||
email: '[email protected]' | ||
|
@@ -26,16 +24,16 @@ var routeHandler = function (request, response) { | |
// with some code like this using the testing framework of your choice: | ||
|
||
exports['routeHandler - Simple testing of status() vs json()'] = function (test) { | ||
var request = httpMocks.createRequest({ | ||
const request = httpMocks.createRequest({ | ||
method: 'POST', | ||
url: '/users' | ||
}); | ||
|
||
var response = httpMocks.createResponse(); | ||
const response = httpMocks.createResponse(); | ||
|
||
routeHandler(request, response); | ||
|
||
var data = response._getJSONData(); | ||
const data = response._getJSONData(); | ||
|
||
test.equal('Bob Dog', data.name); | ||
test.equal(42, data.age); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.