Skip to content

Commit

Permalink
Setup linting and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin-Anders committed Apr 26, 2024
1 parent 77a1d8f commit 18e7c02
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 21 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint:check
6 changes: 2 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
presets: ["@vue/cli-plugin-babel/preset"],
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
"test-build": "mkdir -p ./public/cdn/current && uglifyjs ./src/js-web-interface/booking-manager-js.js > ./public/cdn/current/booking-manager.min.js",
"release:major": "npm version $(semver $npm_package_version -i major)",
"release:minor": "npm version $(semver $npm_package_version -i minor)",
"release:patch": "npm version $(semver $npm_package_version -i patch)"
"release:patch": "npm version $(semver $npm_package_version -i patch)",
"format:check": "prettier --check .",
"format:write": "prettier --write .",
"lint:check": "eslint .",
"lint:fix": "eslint --fix .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@babel/core": "^7.23.6",
Expand Down
25 changes: 16 additions & 9 deletions src/js-web-interface/booking-manager-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class BookingManager {
init() {
console.log("Initializing Booking Manager Integration.");


this.addLibScripts([
"https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js",
"https://cdn.jsdelivr.net/npm/@fullcalendar/[email protected]/locales-all.global.min.js",
Expand Down Expand Up @@ -210,9 +209,12 @@ class BookingManager {

for (let i = 0; i < calendarEls.length; i++) {
const calendarEl = calendarEls[i];
const initialView = calendarEl.getAttribute("data-view") || "dayGridMonth";
const initialView =
calendarEl.getAttribute("data-view") || "dayGridMonth";

console.log(`Binding data to element with class bm-calendar and initial view ${initialView}`);
console.log(
`Binding data to element with class bm-calendar and initial view ${initialView}`
);

this._fetchEvents().then((events) => {
this._initCalendar(calendarEl, initialView, events);
Expand All @@ -226,14 +228,19 @@ class BookingManager {
* The initial view of the calendar is determined by the "data-view" attribute of the element. If no "data-view" attribute is present, the default view is "dayGridMonth".
*/
initializeOccupancyCalendars() {
const calendarEls = document.getElementsByClassName("bm-occupancy-calendar");
const calendarEls = document.getElementsByClassName(
"bm-occupancy-calendar"
);

for ( let i = 0; i< calendarEls.length; i++ ) {
for (let i = 0; i < calendarEls.length; i++) {
const calendarEl = calendarEls[i];
const bookableIds = calendarEl.getAttribute("data-id")?.split(",");
const initialView = calendarEl.getAttribute("data-view") || "dayGridMonth";
const initialView =
calendarEl.getAttribute("data-view") || "dayGridMonth";

console.log(`Binding data to element with class bm-occupancy-calendar and initial view ${initialView}`);
console.log(
`Binding data to element with class bm-occupancy-calendar and initial view ${initialView}`
);

this._fetchOccupancies(bookableIds).then((occupancy) => {
this._initCalendar(calendarEl, initialView, occupancy);
Expand Down Expand Up @@ -301,7 +308,7 @@ class BookingManager {
.then(function (response) {
return response.text();
})
.then(function (text) {
.then(function () {
console.log("Signout successful");
})
.catch(function (err) {
Expand Down Expand Up @@ -471,7 +478,7 @@ class BookingManager {
try {
const response = await fetch(fetchUrl);
const apiResponse = await response.json();
return apiResponse.map(event => ({
return apiResponse.map((event) => ({
title: event.information.name,
start: `${event.information.startDate}T${event.information.startTime}`,
end: `${event.information.endDate}T${event.information.endTime}`,
Expand Down
1 change: 0 additions & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import Tickets from "@/views/Bookables/Tickets/Tickets";
import Bookings from "@/views/Management/Bookings";
import Settings from "@/views/Settings";
import EditBookable from "@/views/Bookables/EditBookable";
import { RolePermission } from "@/entities/role";
import ApiAuthService from "@/services/api/ApiAuthService";
import Coupons from "@/views/Management/Coupons";

Expand Down
1 change: 0 additions & 1 deletion src/services/permissions/TenantPermissionService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import user from "@/store/modules/user";
import Tenant from "@/entities/tenant";

class TenantPermissionService {
static isOwner(tenant) {
Expand Down
8 changes: 3 additions & 5 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module.exports = {
devServer: {
allowedHosts: 'all'
allowedHosts: "all",
},
lintOnSave: false,
transpileDependencies: [
'vuetify'
]
}
transpileDependencies: ["vuetify"],
};

0 comments on commit 18e7c02

Please sign in to comment.