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

89 lines
2.6 KiB
JavaScript

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',
});
}
}
}
}
},
};
},
};