Files
online_sys/frontend_大健康/fix_js_syntax.py
KQL a7242f0c69 Initial commit: 教务系统在线平台
- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸
- 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB
- 配置完善的.gitignore文件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 18:16:55 +08:00

61 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
修复JavaScript语法错误
移除多余的对象结构
"""
import re
def fix_js_syntax():
"""修复JavaScript语法错误"""
try:
# 读取文件
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
# 修复模式1: 移除多余的对象结束符
# 模式:] \n } \n ] \n },
# 应该是:] \n } \n },
content = re.sub(
r'(\s*\]\s*\}\s*\]\s*)(\},)',
r'\1,',
content,
flags=re.MULTILINE
)
# 修复模式2: 移除孤立的 },
content = re.sub(
r'(\s+\}\s*\]\s*)\s+\},\s*(\{)',
r'\1,\n \2',
content,
flags=re.MULTILINE
)
# 更具体的修复:找到问题的模式并修复
# 查找 " ]\n },\n {" 的模式,应该是 " },\n {"
content = re.sub(
r'(\s+\]\s*\}\s*)\n\s+\},\n(\s+\{)',
r'\1,\n\2',
content,
flags=re.MULTILINE
)
# 写回文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(content)
print("JavaScript语法错误修复完成")
return True
except Exception as e:
print(f"修复失败: {e}")
import traceback
traceback.print_exc()
return False
def main():
fix_js_syntax()
if __name__ == "__main__":
main()