Skip to content

Commit 4aef395

Browse files
Johann-SXhmikosR
authored andcommitted
Disable ESlint on no-return-assign and temporary for arrow-body-style
1 parent 2970d14 commit 4aef395

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
"no-param-reassign": "off",
7070
"no-proto": "error",
7171
"no-restricted-properties": "error",
72-
"no-return-assign": "error",
7372
"no-return-await": "error",
7473
"no-script-url": "error",
7574
"no-self-compare": "error",

js/src/alert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Alert {
6666

6767
const customEvent = this._triggerCloseEvent(rootElement)
6868

69-
if (customEvent.defaultPrevented) {
69+
if (customEvent === null || customEvent.defaultPrevented) {
7070
return
7171
}
7272

js/src/dom/selectorEngine.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ if (!Element.prototype.matches) {
1616
}
1717

1818
// closest polyfill (see: https://mzl.la/2vXggaI)
19+
let fnClosest = null
1920
if (!Element.prototype.closest) {
20-
Element.prototype.closest = (element, selector) => {
21+
fnClosest = (element, selector) => {
2122
let ancestor = element
2223
if (!document.documentElement.contains(element)) {
2324
return null
@@ -33,10 +34,13 @@ if (!Element.prototype.closest) {
3334

3435
return null
3536
}
37+
} else {
38+
// eslint-disable-next-line arrow-body-style
39+
fnClosest = (element, selector) => {
40+
return element.closest(selector)
41+
}
3642
}
3743

38-
const fnClosest = Element.prototype.closest
39-
4044
const SelectorEngine = {
4145
matches(element, selector) {
4246
return fnMatches.call(element, selector)
@@ -56,7 +60,7 @@ const SelectorEngine = {
5660
},
5761

5862
closest(element, selector) {
59-
return fnClosest.call(element, selector)
63+
return fnClosest(element, selector)
6064
}
6165
}
6266

0 commit comments

Comments
 (0)