Files
jaystar 28c4d7b3b4 feat: 实现减脂体重管理App完整功能
- 实现拍照识别食物功能(集成大语言模型视觉能力)
- 实现智能对话功能(集成大语言模型流式输出)
- 实现食物记录和卡路里管理功能
- 实现体重记录和统计功能
- 实现健康数据管理页面
- 配置数据库表结构(用户、食物记录、体重记录)
- 实现Express后端API路由
- 配置Tab导航和前端页面
- 采用健康运动配色方案
2026-02-02 15:17:50 +08:00

65 lines
1.7 KiB
JavaScript

module.exports = {
meta: {
type: 'problem',
docs: {
description: '禁止带有 horizontal: true 属性的 ScrollView 单独使用',
recommended: false,
},
schema: [],
messages: {
noSiblings: '禁止带有 props.horizontal: true 的 ScrollView 单独使用,需要在 ScrollView 外层使用一个单独的 View 组件进行包裹',
},
},
create(context) {
return {
JSXElement(node) {
const isScrollView = node.openingElement.name.name === 'ScrollView';
if (!isScrollView) {
return;
}
const hasHorizontalProp = node.openingElement.attributes.some(attr => {
if (attr.type === 'JSXAttribute' && attr.name.name === 'horizontal') {
if (!attr.value) {
return true;
}
if (
attr.value.type === 'JSXExpressionContainer' &&
attr.value.expression.value === true
) {
return true; // horizontal={true}
}
if (attr.value.type === 'Literal' && attr.value.value === true) {
return true; // horizontal={true} 的另一种形式
}
}
return false;
});
if (!hasHorizontalProp) {
return;
}
const parent = node.parent;
if (
parent.type === 'JSXFragment' ||
parent.type === 'JSXElement'
) {
const siblings = parent.children.filter(
child => child.type === 'JSXElement' && child !== node
);
if (siblings.length > 0) {
context.report({
node,
messageId: 'noSiblings',
});
}
}
},
};
},
}