Match-id-30ecadc80ad5388949a0fc159b3355ae65b8f9b3
This commit is contained in:
parent
6ba8beea86
commit
e0ac32cda9
25
.eslintrc.js
25
.eslintrc.js
|
@ -1,19 +1,13 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
'plugin:@typescript-eslint/eslint-recommended',
|
||||||
"plugin:@typescript-eslint/recommended",
|
'plugin:@typescript-eslint/recommended',
|
||||||
'prettier',
|
'prettier',
|
||||||
],
|
],
|
||||||
root: true,
|
root: true,
|
||||||
|
|
||||||
plugins: [
|
plugins: ['jest', 'no-for-of-loops', 'no-function-declare-after-return', 'react', '@typescript-eslint'],
|
||||||
'jest',
|
|
||||||
'no-for-of-loops',
|
|
||||||
'no-function-declare-after-return',
|
|
||||||
'react',
|
|
||||||
'@typescript-eslint',
|
|
||||||
],
|
|
||||||
|
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
|
@ -34,8 +28,8 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
'semi': ['warn', 'always'],
|
semi: ['warn', 'always'],
|
||||||
'quotes': ['warn', 'single'],
|
quotes: ['warn', 'single'],
|
||||||
'accessor-pairs': 'off',
|
'accessor-pairs': 'off',
|
||||||
'brace-style': ['error', '1tbs'],
|
'brace-style': ['error', '1tbs'],
|
||||||
'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
|
'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
|
||||||
|
@ -44,19 +38,18 @@ module.exports = {
|
||||||
// 尾随逗号
|
// 尾随逗号
|
||||||
'comma-dangle': ['error', 'only-multiline'],
|
'comma-dangle': ['error', 'only-multiline'],
|
||||||
|
|
||||||
|
'no-constant-condition': 'off',
|
||||||
'no-for-of-loops/no-for-of-loops': 'error',
|
'no-for-of-loops/no-for-of-loops': 'error',
|
||||||
'no-function-declare-after-return/no-function-declare-after-return': 'error',
|
'no-function-declare-after-return/no-function-declare-after-return': 'error',
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
isDev: true
|
isDev: true,
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: [
|
files: ['scripts/__tests__/**/*.js'],
|
||||||
'scripts/__tests__/**/*.js'
|
|
||||||
],
|
|
||||||
globals: {
|
globals: {
|
||||||
container: true
|
container: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {Props} from '../DOMOperator';
|
||||||
* @param doc 指定 document
|
* @param doc 指定 document
|
||||||
*/
|
*/
|
||||||
export function getFocusedDom(doc?: Document): HorizonDom | null {
|
export function getFocusedDom(doc?: Document): HorizonDom | null {
|
||||||
let currentDocument = doc ?? document;
|
const currentDocument = doc ?? document;
|
||||||
|
|
||||||
return currentDocument.activeElement ?? currentDocument.body;
|
return currentDocument.activeElement ?? currentDocument.body;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ export function onlyUpdateChildVNodes(processing: VNode): VNode | null {
|
||||||
sibling = sibling.next;
|
sibling = sibling.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
putChildrenIntoQueue(processing.child);
|
putChildrenIntoQueue(processing.child);
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ export function onlyUpdateChildVNodes(processing: VNode): VNode | null {
|
||||||
|
|
||||||
markVNodePath(vNode);
|
markVNodePath(vNode);
|
||||||
|
|
||||||
putChildrenIntoQueue(vNode)
|
putChildrenIntoQueue(vNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 子树无需工作
|
// 子树无需工作
|
||||||
|
|
|
@ -53,7 +53,7 @@ export function setParentsChildShouldUpdate(parent: VNode | null) {
|
||||||
// 设置节点的所有父节点的childShouldUpdate
|
// 设置节点的所有父节点的childShouldUpdate
|
||||||
export function updateParentsChildShouldUpdate(vNode: VNode) {
|
export function updateParentsChildShouldUpdate(vNode: VNode) {
|
||||||
let node = vNode.parent;
|
let node = vNode.parent;
|
||||||
let isShouldUpdate = vNode.shouldUpdate || vNode.childShouldUpdate;
|
const isShouldUpdate = vNode.shouldUpdate || vNode.childShouldUpdate;
|
||||||
|
|
||||||
if (isShouldUpdate) { // 开始节点是shouldUpdate或childShouldUpdate
|
if (isShouldUpdate) { // 开始节点是shouldUpdate或childShouldUpdate
|
||||||
// 更新从当前节点到根节点的childShouldUpdate为true
|
// 更新从当前节点到根节点的childShouldUpdate为true
|
||||||
|
|
Loading…
Reference in New Issue