1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-11-28 08:58:49 +02:00

fixing linting issues

This commit is contained in:
Patrik J. Braun 2021-05-16 08:15:42 +02:00
parent b2730effc2
commit f59ba6eb98
6 changed files with 13 additions and 19 deletions

View File

@ -14,7 +14,7 @@
"build-backend": "tsc",
"pretest": "tsc",
"test": "ng test && nyc mocha --recursive test",
"lint": "tslint --project tsconfig.json src/**/**.ts test/**/**.ts",
"lint": "tslint -p tsconfig.json -c tslint.json src/**/**.ts test/**/**.ts",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"start": "node ./src/backend/index",
"run-dev": "ng build --configuration=dev",
@ -35,7 +35,6 @@
"dependencies": {
"archiver": "5.3.0",
"bcrypt": "5.0.1",
"body-parser": "1.19.0",
"cookie-parser": "1.4.5",
"cookie-session": "2.0.0-rc.1",
"csurf": "1.11.0",

View File

@ -122,12 +122,10 @@ export class PublicRouter {
const renderFile = (subDir: string = '') => {
return (req: Request, res: Response) => {
const file = path.join(ProjectPath.FrontendFolder, req.localePath, subDir, req.params.file);
fs.exists(file, (exists: boolean) => {
if (!exists) {
return res.sendStatus(404);
}
res.sendFile(file);
});
if (!fs.existsSync(file)) {
return res.sendStatus(404);
}
res.sendFile(file);
};
};

View File

@ -1,7 +1,6 @@
import {Config} from '../common/config/private/Config';
import * as _express from 'express';
import * as express from 'express';
import {Request} from 'express';
import * as _bodyParser from 'body-parser';
import * as cookieParser from 'cookie-parser';
import * as _http from 'http';
import {Server as HttpServer} from 'http';
@ -33,7 +32,7 @@ const LOG_TAG = '[server]';
export class Server {
public onStarted = new Event<void>();
private app: _express.Express;
private app: express.Express;
private server: HttpServer;
constructor() {
@ -54,7 +53,7 @@ export class Server {
(ConfigClassBuilder.attachPrivateInterface(Config).__options as ConfigClassOptions).configPath + ':');
Logger.verbose(LOG_TAG, JSON.stringify(Config, null, '\t'));
this.app = _express();
this.app = express();
LoggerRouter.route(this.app);
@ -75,7 +74,7 @@ export class Server {
* Parse parameters in POST
*/
// for parsing application/json
this.app.use(_bodyParser.json());
this.app.use(express.json());
this.app.use(cookieParser());
const csuf: any = _csrf();
csuf.unless = unless;

View File

@ -25,7 +25,7 @@ describe('NetworkService Success tests', () => {
]
});
injector = getTestBed();
httpMock = injector.get(HttpTestingController);
httpMock = TestBed.inject(HttpTestingController);
});
afterEach(() => {
@ -138,7 +138,7 @@ describe('NetworkService Fail tests', () => {
]
});
injector = getTestBed();
httpMock = injector.get(HttpTestingController);
httpMock = TestBed.inject(HttpTestingController);
});
afterEach(() => {

View File

@ -201,8 +201,7 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges {
@HostListener('window:keydown', ['$event'])
onKeyPress(e: KeyboardEvent): void {
const event: KeyboardEvent = window.event ? window.event as any : e;
onKeyPress(event: KeyboardEvent): void {
switch (event.key) {
case 'ArrowLeft':
if (this.navigation.hasPrev) {

View File

@ -305,11 +305,10 @@ export class GalleryMapLightboxComponent implements OnChanges {
}
@HostListener('window:keydown', ['$event'])
onKeyPress(e: KeyboardEvent): void {
onKeyPress(event: KeyboardEvent): void {
if (this.visible !== true) {
return;
}
const event: KeyboardEvent = window.event ? window.event as any : e;
switch (event.key) {
case 'f':
case 'F':