arco-cli
arco-cli copied to clipboard
fix: 替换ExpressionStatement为JSXElement
Types of changes
- [ ] New feature
- [x] Bug fix
- [ ] Documentation change
- [ ] Coding style change
- [ ] Refactoring
- [ ] Performance improvement
- [ ] Test cases
- [ ] Continuous integration
- [ ] Typescript definition change
- [ ] Breaking change
Background and context
背景
现在是替换%%content%%
,当尝试自动在生成的PROPS前插入时,会出现“;”分号。
出现问题
现有情况下,replaceWith的是ExpressionStatement,当改为insertBefore ExpressionStatement。生成的code中会出现“;” 分号
insertBefore JSXElement则表现正确
Solution
How is the change tested?
Changelog
Changelog(CN) | Changelog(EN) | Related issues |
---|
Checklist:
- [ ] Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
- [ ] Changes are submitted to the appropriate branch (e.g. features should be submitted to
feature
branch and others should be submitted tomaster
branch)
Other information
Hi,你说的生成的 Code 中会出现分号指的是?
Hi, 我用 PR 里的修改在本地跑了下,观察到最后的产物 markdownAst
转换后的代码还是带「分号」的。
分号指?这个分号吗 观察生成的代码
我是跑的单元测试 yarn run test
。你截图里的「生成的代码」是在哪一行生成的。最终产物里 %%Content%% 应该是会被替换掉的呀。
背景是这样的 ,我参考arco-cli代码 在 ## API前插入ast,把replaceWith
替换成insertBefore
发现的这个问题,本仓库使用replaceWith
是不会出现分号问题,觉得pr方案严谨些(笑(逃