-
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.
* enable eslint * fix more eslint errors * fix more eslint errors * fix more eslint errors * fix all eslint errors * run lint and prettier in ci * drop Node 14 support
- Loading branch information
Showing
30 changed files
with
4,417 additions
and
5,094 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,50 @@ | ||
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" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"rules": { | ||
"no-underscore-dangle": "off", | ||
"no-console": "off", | ||
"no-plusplus": "off", | ||
"func-names": [ | ||
"warn", | ||
"as-needed" | ||
], | ||
"prefer-destructuring": [ | ||
"error", | ||
{ | ||
"object": true, | ||
"array": false | ||
} | ||
], | ||
"no-prototype-builtins": "warn", | ||
"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", | ||
"test/**/*.ts" | ||
], | ||
"rules": { | ||
"no-unused-expressions": "off" | ||
}, | ||
"env": { | ||
"mocha": true | ||
} | ||
} | ||
], | ||
"root": 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
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 check | ||
|
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]' | ||
|
@@ -29,20 +27,20 @@ var routeHandler = function (request, response) { | |
// In another file, you can easily test the routeHandler function | ||
// with some code like this using the testing framework of your choice: | ||
|
||
exports['routeHandler - Simple testing'] = function (test) { | ||
var request = httpMocks.createRequest({ | ||
exports['routeHandler - Simple testing'] = function testing(test) { | ||
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]' | ||
|
@@ -25,17 +23,17 @@ var routeHandler = function (request, response) { | |
// In another file, you can easily test the routeHandler function | ||
// 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({ | ||
exports['routeHandler - Simple testing of status() vs json()'] = function testing(test) { | ||
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
Oops, something went wrong.