chore: update format, lint, & pre-commit scripts; fix lint error
This commit is contained in:
parent
44ab909ea0
commit
1957d71170
2 changed files with 10 additions and 5 deletions
|
|
@ -14,6 +14,7 @@
|
|||
"cli": "node ./packages/core/cli/index.js",
|
||||
"test": "vitest --run",
|
||||
"lint": "eslint . --config eslint.config.mjs --cache",
|
||||
"lint:fix": "eslint . --config eslint.config.mjs --fix",
|
||||
"check": "npm run format && npm run lint",
|
||||
"format": "prettier . --write",
|
||||
"prepare": "husky"
|
||||
|
|
@ -35,11 +36,11 @@
|
|||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,mjs,cjs,json,.*rc}": [
|
||||
"npx prettier --write",
|
||||
"npx eslint --fix"
|
||||
"npm run format",
|
||||
"npm run lint:fix"
|
||||
],
|
||||
"*.json": [
|
||||
"npx prettier --write"
|
||||
"npm run format"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ function replaceSlots(fragmentNode, node) {
|
|||
if (n.type === ELEMENT_NODE && n.name === 'slot') {
|
||||
// find node child with same name attribute
|
||||
const currentSlotName = n.attributes?.['name'] ?? null
|
||||
let nodeChildren = []
|
||||
let nodeChildren
|
||||
|
||||
if (currentSlotName === null) {
|
||||
nodeChildren = node.children.filter(
|
||||
|
|
@ -78,7 +78,11 @@ function replaceSlots(fragmentNode, node) {
|
|||
})
|
||||
}
|
||||
|
||||
if (nodeChildren.length > 0 && !containsAll(slotted, nodeChildren)) {
|
||||
if (
|
||||
nodeChildren &&
|
||||
nodeChildren.length > 0 &&
|
||||
!containsAll(slotted, nodeChildren)
|
||||
) {
|
||||
slotted = [...slotted, ...nodeChildren]
|
||||
const index = n.parent.children.indexOf(n)
|
||||
n.parent.children.splice(index, 1, ...nodeChildren)
|
||||
|
|
|
|||
Loading…
Reference in a new issue