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", "build-backend": "tsc",
"pretest": "tsc", "pretest": "tsc",
"test": "ng test && nyc mocha --recursive test", "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", "coverage": "nyc report --reporter=text-lcov | coveralls",
"start": "node ./src/backend/index", "start": "node ./src/backend/index",
"run-dev": "ng build --configuration=dev", "run-dev": "ng build --configuration=dev",
@ -35,7 +35,6 @@
"dependencies": { "dependencies": {
"archiver": "5.3.0", "archiver": "5.3.0",
"bcrypt": "5.0.1", "bcrypt": "5.0.1",
"body-parser": "1.19.0",
"cookie-parser": "1.4.5", "cookie-parser": "1.4.5",
"cookie-session": "2.0.0-rc.1", "cookie-session": "2.0.0-rc.1",
"csurf": "1.11.0", "csurf": "1.11.0",

View File

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

View File

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

View File

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

View File

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

View File

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