Skip to content

Commit f37d3a3

Browse files
Merge pull request #158 from KristjanESPERANTO/linter
Okay, I'm merging this PR 🙂
2 parents 13f74d2 + 56242e8 commit f37d3a3

25 files changed

Lines changed: 167 additions & 188 deletions

.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"browser": true,
5+
"commonjs": true,
6+
"es2021": true
7+
},
8+
"extends": ["airbnb-base", "plugin:json/recommended", "prettier"],
9+
"parserOptions": {
10+
"ecmaVersion": "latest",
11+
"sourceType": "module"
12+
},
13+
"plugins": ["prettier"],
14+
"root": true,
15+
"globals": {
16+
"moment": "readonly"
17+
},
18+
"rules": {
19+
"default-case": "off",
20+
"global-require": "off",
21+
"prefer-destructuring": "off",
22+
"prettier/prettier": "error",
23+
"import/no-dynamic-require": "off",
24+
"import/no-unresolved": "off",
25+
"no-param-reassign": ["error", { "props": true, "ignorePropertyModificationsFor": ["arrs", "calendar", "dom", "e", "payload", "slotDom", "targetDom"] }],
26+
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
27+
"no-prototype-builtins": "off"
28+
}
29+
}

.github/linters/.eslintrc.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/superlinter.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Super-Linter
22

33
# Run this workflow every time a new commit pushed to your repository
4-
on: push
4+
on: [push, pull_request]
55

66
jobs:
77
# Set the job key. The key is displayed as the job name
@@ -27,11 +27,12 @@ jobs:
2727
env:
2828
DEFAULT_BRANCH: main
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.js
30+
LINTER_RULES_PATH: /
31+
CSS_FILE_NAME: .stylelintrc.json
32+
JAVASCRIPT_DEFAULT_STYLE: prettier
33+
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
34+
JSCPD_CONFIG_FILE: .jscpd.json
3135
YAML_CONFIG_FILE: .yamllint.yaml
32-
# the standard config conflicts heavily with the upstream config.js
33-
# hence I opted to disable it
34-
VALIDATE_JAVASCRIPT_STANDARD: false
35-
# the klaernie example k8s deployment has duplicated segments on purpose (same filter for two seperate calendars, in two config instances).
36-
# JSCPD detects these, but they are unavoidable
37-
VALIDATE_JSCPD: false
36+
# Exclude symlinks because JSCPD has a problem with them
37+
# (You could add nore using |. Like this: .*(docs/index.md|filex.js|.filey.yaml).*)
38+
FILTER_REGEX_EXCLUDE: .*(docs/index.md).*

.jscpd.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ignore": [
3+
"docs/Configuration/Views/week,-month.md"
4+
]
5+
}

CALEXT2_CellSlot.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,13 @@ class CellSlot extends Slot {
1111
this.makeSlotDomClass(view, daySeq, weekSeq);
1212
}
1313

14-
static factory(view, slotPeriods, weekSeq = 0, events) {
15-
const slots = [];
16-
for (let i = 0; i < slotPeriods.length; i++) {
17-
const slot = new CellSlot(view, slotPeriods[i], i, weekSeq);
18-
// slot.assign(events)
19-
slots.push(slot);
20-
}
21-
return slots;
22-
}
23-
2414
init(view) {
2515
this.makeDom();
2616
this.makeSlotHeader(view);
27-
this.adjustSlotHeight(view, this.contentDom);
17+
CellSlot.adjustSlotHeight(view, this.contentDom);
2818
}
2919

30-
adjustSlotHeight(view, dom) {
20+
static adjustSlotHeight(view, dom) {
3121
view.adjustSlotHeight(dom);
3222
}
3323

CALEXT2_Event.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ class Event {
1717

1818
destroy() {
1919
this.dom.remove();
20-
for (const property in this) {
20+
this.forEach((property) => {
2121
if (this.hasOwnProperty(property)) {
2222
this[property] = null;
2323
}
24-
}
24+
});
2525
}
2626

2727
draw(slot, targetDom) {
28-
// eslint-disable-next-line no-unused-vars
29-
const useEventTimeRelative = slot.useEventTimeRelative;
3028
const hideOverflow = slot.hideOverflow;
3129
const eventDom = this.dom;
3230
eventDom.style.opacity = 0;
@@ -49,12 +47,12 @@ class Event {
4947
return 0;
5048
}
5149

52-
drawSleeve(slot, sleeve) {
53-
// to implement
54-
}
50+
/* TODO: To implement */
51+
/* drawSleeve(slot, sleeve) {
52+
...
53+
} */
5554

5655
makeEventDom() {
57-
const event = this.data;
5856
const locale = this.locale;
5957
const now = moment().locale(locale);
6058

@@ -68,6 +66,7 @@ class Event {
6866
return isMulti;
6967
};
7068

69+
const event = this.data;
7170
const eventDom = document.createElement("div");
7271
eventDom.classList.add("event");
7372

CALEXT2_Scene.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Scene {
1111
this.nextUid = uid === sceneLength - 1 ? 0 : uid + 1;
1212
this.previousUid = uid === 0 ? sceneLength - 1 : uid - 1;
1313
this.viewNames =
14-
!scene.views || scene.views.length == 0
14+
!scene.views || scene.views.length === 0
1515
? cfgs.views.map((v) => v.name)
1616
: scene.views;
1717
this.views = [];
@@ -20,9 +20,9 @@ class Scene {
2020
draw(events) {
2121
this.clearViews();
2222
this.viewNames.forEach((viewName) => {
23-
const viewConfig = this.config.views.find((config) => {
24-
if (config.name === viewName) return true;
25-
});
23+
const viewConfig = this.config.views.find(
24+
(config) => config.name === viewName
25+
);
2626
viewConfig.sceneClassName = this.className;
2727
const view = View.makeByName(viewConfig, events);
2828
if (view) {

CALEXT2_Slot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ class Slot {
3030

3131
destroy() {
3232
this.dom.remove();
33-
for (const property in this) {
33+
this.forEach((property) => {
3434
if (this.hasOwnProperty(property)) {
3535
this[property] = null;
3636
}
37-
}
37+
});
3838
}
3939

4040
static factory(view, slotPeriods, events) {
@@ -76,7 +76,7 @@ class Slot {
7676
event.startHere = true;
7777
if (eE.isBetween(this.start, this.end, null, "(])"))
7878
event.endHere = true;
79-
if (eE.format("HHmmss") == "000000")
79+
if (eE.format("HHmmss") === "000000")
8080
event.endDate = moment(eE).add(-1, "second").endOf("day").format("X");
8181
this.events.push(event);
8282
}

0 commit comments

Comments
 (0)