feat: 实现减脂体重管理App完整功能
- 实现拍照识别食物功能(集成大语言模型视觉能力) - 实现智能对话功能(集成大语言模型流式输出) - 实现食物记录和卡路里管理功能 - 实现体重记录和统计功能 - 实现健康数据管理页面 - 配置数据库表结构(用户、食物记录、体重记录) - 实现Express后端API路由 - 配置Tab导航和前端页面 - 采用健康运动配色方案
This commit is contained in:
9
eslint-plugins/react-native/index.js
vendored
Normal file
9
eslint-plugins/react-native/index.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
const wrapScrollViewInView = require('./rule')
|
||||
|
||||
const plugin = {
|
||||
rules: {
|
||||
'wrap-horizontal-scrollview-inside-view': wrapScrollViewInView,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = plugin
|
||||
64
eslint-plugins/react-native/rule.js
vendored
Normal file
64
eslint-plugins/react-native/rule.js
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
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',
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user