Skip to content

build: remove koa support and migrate to jest and eslint #553

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
root: true,
env: {
node: true
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: ['./tsconfig.json']
},
plugins: [
"@typescript-eslint"
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
ignorePatterns: ["**/*.js"],
rules: {
"no-case-declarations": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/unbound-method": ["error", {
"ignoreStatic": true
}]
}
};
3 changes: 0 additions & 3 deletions .mocharc.json

This file was deleted.

13 changes: 0 additions & 13 deletions .nycrc.json

This file was deleted.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ There are set of prepared errors you can use:
* UnauthorizedError


You can also create and use your own errors by extending `HttpError` class.
You can also create and use your own errors by extending `HttpError` class.
To define the data returned to the client, you could define a toJSON method in your error.

```typescript
Expand All @@ -755,7 +755,7 @@ class DbError extends HttpError {
}
}
}
```
```

#### Enable CORS

Expand Down Expand Up @@ -796,7 +796,7 @@ app.listen(3000);

#### Default settings

You can override default status code in routing-controllers options.
You can override default status code in routing-controllers options.

```typescript
import "reflect-metadata";
Expand All @@ -809,9 +809,9 @@ const app = createExpressServer({
//with this option, null will return 404 by default
nullResultCode: 404,

//with this option, void or Promise<void> will return 204 by default
//with this option, void or Promise<void> will return 204 by default
undefinedResultCode: 204,

paramOptions: {
//with this option, argument will be required by default
required: true
Expand Down Expand Up @@ -907,7 +907,7 @@ Here is example of creating middleware for express.js:

export class MyMiddleware implements ExpressMiddlewareInterface { // interface implementation is optional

use(request: any, response: any, next?: (err?: any) => any): any {
use(request: express.Request, response: express.Response, next: express.NextFunction): any {
console.log("do something...");
next();
}
Expand Down Expand Up @@ -1022,7 +1022,7 @@ import {Middleware, ExpressMiddlewareInterface} from "routing-controllers";
@Middleware({ type: "before" })
export class LoggingMiddleware implements ExpressMiddlewareInterface {

use(request: any, response: any, next: (err: any) => any): void {
use(error: any, request: express.Request, response: express.Response, next: express.NextFunction): any: void {
console.log("do something...");
next();
}
Expand Down
1 change: 0 additions & 1 deletion codecov.yml

This file was deleted.

24 changes: 24 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
modulePaths: ["<rootDir>/node_modules"],
transform: {
"^.+\\.tsx?$": "ts-jest"
},
testRegex: "(/__test__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
testEnvironment: "node",
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
modulePathIgnorePatterns: [
"<rootDir>/build/"
],
coverageReporters: [
// "html",
// "lcov",
"text-summary"
]
};
Loading