Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/rules/enforce-style-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ module.exports = {
return {}
}

const topLevelElements = documentFragment.children.filter(isVElement)
const topLevelStyleTags = topLevelElements.filter(
(element) => element.rawName === 'style'
const topLevelStyleTags = documentFragment.children.filter(
/** @returns {element is VElement} */
(element) => isVElement(element) && element.rawName === 'style'
)

if (topLevelStyleTags.length === 0) {
Expand Down
7 changes: 4 additions & 3 deletions lib/rules/require-explicit-slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ module.exports = {
if (!documentFragment) {
return {}
}
const scripts = documentFragment.children
.filter(utils.isVElement)
.filter((element) => element.name === 'script')
const scripts = documentFragment.children.filter(
/** @returns {element is VElement} */
(element) => utils.isVElement(element) && element.name === 'script'
)
if (scripts.every((script) => !utils.hasAttribute(script, 'lang', 'ts'))) {
return {}
}
Expand Down
7 changes: 4 additions & 3 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2643,9 +2643,10 @@ function getScriptSetupElement(context) {
if (!df) {
return null
}
const scripts = df.children
.filter(isVElement)
.filter((e) => e.name === 'script')
const scripts = df.children.filter(
/** @returns {e is VElement} */
(e) => isVElement(e) && e.name === 'script'
)
if (scripts.length === 2) {
return scripts.find((e) => hasAttribute(e, 'setup')) || null
} else {
Expand Down
7 changes: 4 additions & 3 deletions lib/utils/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,10 @@ function buildPseudoNthVElementMatcher(testIndex) {
*/
function buildPseudoNthOfTypeVElementMatcher(testIndex) {
return (element) => {
const elements = element.parent.children
.filter(isVElement)
.filter((e) => e.rawName === element.rawName)
const elements = element.parent.children.filter(
/** @returns {e is VElement} */
(e) => isVElement(e) && e.rawName === element.rawName
)
return testIndex(elements.indexOf(element), elements.length)
}
}
Expand Down
7 changes: 4 additions & 3 deletions lib/utils/style-variables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ function getStyleVariablesContext(context) {
if (!df) {
return null
}
const styles = df.children
.filter(isVElement)
.filter((e) => e.name === 'style')
const styles = df.children.filter(
/** @returns {e is VElement} */
(e) => isVElement(e) && e.name === 'style'
)
if (styles.length === 0) {
return null
}
Expand Down