Linting app
This commit is contained in:
parent
b485c9bf46
commit
432b4a0e85
7 changed files with 46 additions and 42 deletions
|
@ -5,7 +5,7 @@ import { UwsApp } from './types';
|
|||
|
||||
class App extends (<UwsApp>_App) {
|
||||
constructor(options: AppOptions = {}) {
|
||||
super(options);
|
||||
super(options); // eslint-disable-line constructor-super
|
||||
extend(this, new BaseApp());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@ const handleBody = (res: HttpResponse, req: HttpRequest) => {
|
|||
|
||||
res.bodyStream = function() {
|
||||
const stream = new Readable();
|
||||
stream._read = noOp;
|
||||
stream._read = noOp; // eslint-disable-line @typescript-eslint/unbound-method
|
||||
|
||||
this.onData((ab, isLast) => {
|
||||
// uint and then slicing is bit faster than slice and then uint
|
||||
stream.push(new Uint8Array(ab.slice((ab as any).byteOffset, ab.byteLength)));
|
||||
stream.push(new Uint8Array(ab.slice((ab as any).byteOffset, ab.byteLength))); // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
if (isLast) {
|
||||
stream.push(null);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ const handleBody = (res: HttpResponse, req: HttpRequest) => {
|
|||
|
||||
res.body = () => stob(res.bodyStream());
|
||||
|
||||
if (contType.indexOf('application/json') > -1)
|
||||
if (contType.includes('application/json'))
|
||||
res.json = async () => JSON.parse(await res.body());
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { UwsApp } from './types';
|
|||
|
||||
class SSLApp extends (<UwsApp>_SSLApp) {
|
||||
constructor(options: AppOptions) {
|
||||
super(options);
|
||||
super(options); // eslint-disable-line constructor-super
|
||||
extend(this, new BaseApp());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ReadStream } from 'fs';
|
||||
|
||||
function extend(who: any, from: any, overwrite = true) {
|
||||
function extend(who: any, from: any, overwrite = true) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
const ownProps = Object.getOwnPropertyNames(Object.getPrototypeOf(from)).concat(
|
||||
Object.keys(from)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue