File tree Expand file tree Collapse file tree 5 files changed +30
-30
lines changed Expand file tree Collapse file tree 5 files changed +30
-30
lines changed Original file line number Diff line number Diff line change 1010 strategy :
1111 matrix :
1212 node-version :
13- - 16
1413 - 18
1514 - 20
15+ - 22
1616 steps :
1717 - uses : actions/checkout@v3
1818 - name : Use Node.js ${{ matrix.node-version }}
Original file line number Diff line number Diff line change 55 " xo-lass"
66 ],
77 "rules" : {
8+ "@typescript-eslint/restrict-template-expressions" : " off" ,
9+ "@typescript-eslint/naming-convention" : " off" ,
10+ "@typescript-eslint/prefer-nullish-coalescing" : " off" ,
11+ "@typescript-eslint/prefer-reduce-type-parameter" : " off" ,
812 "node/no-deprecated-api" : " off" ,
913 "no-unused-vars" : " off" ,
1014 "no-prototype-builtins" : " off" ,
11- "prefer-rest-params " : " off" ,
15+ "n/file-extension-in-import " : " off" ,
1216 "n/prefer-global/process" : " off" ,
13- "@typescript-eslint/restrict-template-expressions" : " off" ,
14- "@typescript-eslint/naming-convention" : " off" ,
15- "@typescript-eslint/prefer-nullish-coalescing" : " off" ,
17+ "prefer-rest-params" : " off" ,
1618 "unicorn/no-array-reduce" : " off"
1719 },
1820 "ignores" : [
Original file line number Diff line number Diff line change 4949 "@types/jest" : " ^29.5.0" ,
5050 "@types/koa" : " ^2.13.6" ,
5151 "@types/lodash.merge" : " ^4.6.7" ,
52- "@types/node" : " ^18 .15.11 " ,
53- "@types/supertest" : " ^2 .0.12 " ,
52+ "@types/node" : " ^22 .15.21 " ,
53+ "@types/supertest" : " ^6 .0.3 " ,
5454 "@types/type-is" : " ^1.6.3" ,
5555 "eslint-config-xo-lass" : " ^2.0.1" ,
56- "husky" : " ^8.0.3 " ,
57- "jest" : " ^29.5 .0" ,
58- "koa" : " ^2.14.1 " ,
59- "supertest" : " ^6.3.3 " ,
60- "ts-jest" : " ^29.0.5 " ,
61- "ts-node" : " ^10.9.1 " ,
62- "tsup" : " ^6.7 .0" ,
63- "typescript" : " ^5.0 .3" ,
64- "xo" : " ^0.54.2 "
56+ "husky" : " ^9.1.7 " ,
57+ "jest" : " ^29.7 .0" ,
58+ "koa" : " ^3.0.0 " ,
59+ "supertest" : " ^7.1.1 " ,
60+ "ts-jest" : " ^29.3.4 " ,
61+ "ts-node" : " ^10.9.2 " ,
62+ "tsup" : " ^8.5 .0" ,
63+ "typescript" : " ^5.8 .3" ,
64+ "xo" : " ^0.60.0 "
6565 },
6666 "dependencies" : {
67- "@types/co-body" : " ^6.1.0 " ,
68- "co-body" : " ^6.1 .0" ,
67+ "@types/co-body" : " ^6.1.3 " ,
68+ "co-body" : " ^6.2 .0" ,
6969 "lodash.merge" : " ^4.6.2" ,
70- "type-is" : " ^1.6.18 "
70+ "type-is" : " ^2.0.1 "
7171 },
7272 "peerDependencies" : {
73- "koa" : " ^2.14.1 "
73+ "koa" : " >=2 "
7474 },
7575 "engines" : {
76- "node" : " >= 16 "
76+ "node" : " >= 18 "
7777 },
7878 "repository" : {
7979 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -49,14 +49,12 @@ export function bodyParserWrapper(opts: BodyParserOptions = {}) {
4949 ) ;
5050 } ;
5151
52- const bodyType =
53- detectJSON ?.( ctx ) || shouldParseBodyAs ( 'json' )
54- ? 'json'
55- : shouldParseBodyAs ( 'form' )
56- ? 'form'
57- : shouldParseBodyAs ( 'text' ) || shouldParseBodyAs ( 'xml' )
58- ? 'text'
59- : null ;
52+ const bodyType = ( ( ) => {
53+ if ( detectJSON ?.( ctx ) || shouldParseBodyAs ( 'json' ) ) return 'json' ;
54+ if ( shouldParseBodyAs ( 'form' ) ) return 'form' ;
55+ if ( shouldParseBodyAs ( 'text' ) || shouldParseBodyAs ( 'xml' ) ) return 'text' ;
56+ return null ;
57+ } ) ( ) ;
6058
6159 // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
6260 if ( ! bodyType ) return { } as Record < string , string > ;
Original file line number Diff line number Diff line change @@ -491,7 +491,7 @@ describe("test/body-parser.test.ts", () => {
491491 describe ( "onError" , ( ) => {
492492 const app = createApp ( {
493493 onError ( { } , ctx ) {
494- ctx . throw ( "custom parse error" , 422 ) ;
494+ ctx . throw ( 422 , "custom parse error" ) ;
495495 } ,
496496 } ) ;
497497
You can’t perform that action at this time.
0 commit comments