add linting to server folder

This commit is contained in:
janis
2023-10-05 13:57:35 +02:00
parent 5c5462186f
commit dbb1e7a977
7 changed files with 11 additions and 5 deletions

3
src/server/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
# ignore node_modules folder for eslint
node_modules
webapp

View File

@@ -31,7 +31,7 @@ class POSTHandler {
db.writeJSONDataSimple( 'seatplan', data.location, dat ).then( resp => { db.writeJSONDataSimple( 'seatplan', data.location, dat ).then( resp => {
db.getJSONDataSimple( 'locations', data.location ).then( dat => { db.getJSONDataSimple( 'locations', data.location ).then( dat => {
let s = dat; let s = dat;
s[ 'totalSeats' ] = data.data.seatInfo.count s[ 'totalSeats' ] = data.data.seatInfo.count;
db.writeJSONDataSimple( 'locations', data.location, s ).then( () => { db.writeJSONDataSimple( 'locations', data.location, s ).then( () => {
resolve( resp ); resolve( resp );
} ); } );
@@ -44,7 +44,7 @@ class POSTHandler {
db.writeJSONDataSimple( 'seatplan', data.location, { 'draft': {}, 'save': data.data } ).then( resp => { db.writeJSONDataSimple( 'seatplan', data.location, { 'draft': {}, 'save': data.data } ).then( resp => {
db.getJSONDataSimple( 'locations', data.location ).then( dat => { db.getJSONDataSimple( 'locations', data.location ).then( dat => {
let s = dat; let s = dat;
s[ 'totalSeats' ] = data.data.seatInfo.count s[ 'totalSeats' ] = data.data.seatInfo.count;
db.writeJSONDataSimple( 'locations', data.location, s ).then( () => { db.writeJSONDataSimple( 'locations', data.location, s ).then( () => {
resolve( resp ); resolve( resp );
} ); } );

View File

@@ -12,7 +12,7 @@ const fs = require( 'fs' );
// const ph = require( './paymentHandler.js' ); // const ph = require( './paymentHandler.js' );
// const paymentHandler = new ph(); // const paymentHandler = new ph();
module.exports = ( app, settings ) => { module.exports = ( app ) => {
app.get( '/payments/canceled', ( req, res ) => { app.get( '/payments/canceled', ( req, res ) => {
res.sendFile( path.join( __dirname + '/../../ui/en/payments/canceled.html' ) ); res.sendFile( path.join( __dirname + '/../../ui/en/payments/canceled.html' ) );
} ); } );

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
const { createApp } = Vue; const { createApp } = Vue;
createApp( { createApp( {

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
const { createApp } = Vue; const { createApp } = Vue;
createApp( { createApp( {

View File

@@ -63,7 +63,7 @@
"vue": "^3.3.4" "vue": "^3.3.4"
}, },
"scripts": { "scripts": {
"test": "test.js" "lint": "eslint . --ext .js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -1,4 +1,4 @@
var theme = localStorage.getItem( 'theme' ) ?? ''; let theme = localStorage.getItem( 'theme' ) ?? '';
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || theme === '☼' ) { if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || theme === '☼' ) {
document.documentElement.classList.add( 'dark' ); document.documentElement.classList.add( 'dark' );
document.getElementById( 'themeSelector' ).innerHTML = '☼'; document.getElementById( 'themeSelector' ).innerHTML = '☼';
@@ -9,6 +9,7 @@ if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || theme === '&
theme = '☽'; theme = '☽';
} }
// eslint-disable-next-line no-unused-vars
function changeTheme () { function changeTheme () {
if ( theme === '☼' ) { if ( theme === '☼' ) {
document.documentElement.classList.remove( 'dark' ); document.documentElement.classList.remove( 'dark' );