feat: 实现减脂体重管理App完整功能
- 实现拍照识别食物功能(集成大语言模型视觉能力) - 实现智能对话功能(集成大语言模型流式输出) - 实现食物记录和卡路里管理功能 - 实现体重记录和统计功能 - 实现健康数据管理页面 - 配置数据库表结构(用户、食物记录、体重记录) - 实现Express后端API路由 - 配置Tab导航和前端页面 - 采用健康运动配色方案
This commit is contained in:
9
eslint-plugins/reanimated/index.js
Normal file
9
eslint-plugins/reanimated/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const banMixUse = require('./rule')
|
||||
|
||||
const plugin = {
|
||||
rules: {
|
||||
'ban-mix-use': banMixUse,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = plugin
|
||||
88
eslint-plugins/reanimated/rule.js
Normal file
88
eslint-plugins/reanimated/rule.js
Normal file
@@ -0,0 +1,88 @@
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description:
|
||||
'Disallow passing useAnimatedScrollHandler return value to ScrollView',
|
||||
recommended: 'error',
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
noUseAnimatedScrollHandlerOnScroll:
|
||||
'Do not pass useAnimatedScrollHandler return value to ScrollView, pass to Animated.ScrollView instead.',
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
// 记录 useAnimatedScrollHandler 的本地名字
|
||||
let useAnimatedScrollHandlerImportName = null;
|
||||
// 记录 ScrollView 的本地名字
|
||||
let scrollViewImportName = null;
|
||||
// 记录调用 useAnimatedScrollHandler 返回值的变量名
|
||||
const animatedScrollHandlerVars = new Set();
|
||||
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
if (node.source.value === 'react-native-reanimated') {
|
||||
for (const specifier of node.specifiers) {
|
||||
if (
|
||||
specifier.type === 'ImportSpecifier' &&
|
||||
specifier.imported.name === 'useAnimatedScrollHandler'
|
||||
) {
|
||||
useAnimatedScrollHandlerImportName = specifier.local.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node.source.value === 'react-native') {
|
||||
for (const specifier of node.specifiers) {
|
||||
if (
|
||||
specifier.type === 'ImportSpecifier' &&
|
||||
specifier.imported.name === 'ScrollView'
|
||||
) {
|
||||
scrollViewImportName = specifier.local.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
VariableDeclarator(node) {
|
||||
if (
|
||||
node.init &&
|
||||
node.init.type === 'CallExpression' &&
|
||||
node.init.callee.type === 'Identifier' &&
|
||||
node.init.callee.name === useAnimatedScrollHandlerImportName
|
||||
) {
|
||||
if (node.id.type === 'Identifier') {
|
||||
animatedScrollHandlerVars.add(node.id.name);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
JSXOpeningElement(node) {
|
||||
if (
|
||||
node.name.type === 'JSXIdentifier' &&
|
||||
node.name.name === scrollViewImportName
|
||||
) {
|
||||
for (const attr of node.attributes) {
|
||||
if (
|
||||
attr.type === 'JSXAttribute' &&
|
||||
attr.name.name === 'onScroll' &&
|
||||
attr.value &&
|
||||
attr.value.type === 'JSXExpressionContainer' &&
|
||||
attr.value.expression.type === 'Identifier'
|
||||
) {
|
||||
const varName = attr.value.expression.name;
|
||||
if (animatedScrollHandlerVars.has(varName)) {
|
||||
context.report({
|
||||
node: attr,
|
||||
messageId: 'noUseAnimatedScrollHandlerOnScroll',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user