2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-02 16:04:07 +03:00

Enable unicorn/no-array-for-each rule

This commit is contained in:
XhmikosR
2021-07-30 09:28:51 +03:00
parent 2b4d0d166b
commit 666fe596bf
23 changed files with 132 additions and 117 deletions
+5 -3
View File
@@ -125,7 +125,7 @@ const getElement = obj => {
}
const typeCheckConfig = (componentName, config, configTypes) => {
Object.keys(configTypes).forEach(property => {
for (const property of Object.keys(configTypes)) {
const expectedTypes = configTypes[property]
const value = config[property]
const valueType = value && isElement(value) ? 'element' : toType(value)
@@ -135,7 +135,7 @@ const typeCheckConfig = (componentName, config, configTypes) => {
`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
)
}
})
}
}
const isVisible = element => {
@@ -217,7 +217,9 @@ const onDOMContentLoaded = callback => {
// add listener on the first call when the document is in loading state
if (!DOMContentLoadedCallbacks.length) {
document.addEventListener('DOMContentLoaded', () => {
DOMContentLoadedCallbacks.forEach(callback => callback())
for (const callback of DOMContentLoadedCallbacks) {
callback()
}
})
}
+2 -2
View File
@@ -114,11 +114,11 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
const attributeList = [].concat(...element.attributes)
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])
attributeList.forEach(attribute => {
for (const attribute of attributeList) {
if (!allowedAttribute(attribute, allowedAttributes)) {
element.removeAttribute(attribute.nodeName)
}
})
}
}
return createdDocument.body.innerHTML
+3 -1
View File
@@ -85,7 +85,9 @@ class ScrollBarHelper {
if (isElement(selector)) {
callBack(selector)
} else {
SelectorEngine.find(selector, this._element).forEach(callBack)
for (const sel of SelectorEngine.find(selector, this._element)) {
callBack(sel)
}
}
}