Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-initial-state)/prettier app.ts parse error #902

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

stormslowly
Copy link
Member

after

ERROR parse /Users/example/git/problem/umi3-project/src/app.ts Failed
   5 |   if(true){
   6 |     console.log('yes')
>  7 |   },
     |    ^
   8 |   console.trace('xxxxxxxxxxxxytyyyyyyyyy')
   9 | }
  10 |
Unexpected token (7:3)
SyntaxError: Unexpected token (7:3)
    at Object._raise (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:28077:17)
    at Object.raiseWithData (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:28070:17)
    at Object.raise (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:28031:17)
    at Object.unexpected (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:37201:16)
    at Object.parseExprAtom (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38603:20)
    at Object.parseExprSubscripts (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38174:23)
    at Object.parseUpdate (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38154:21)
    at Object.parseMaybeUnary (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38132:23)
    at Object.parseMaybeUnary (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:34863:20)
    at Object.parseExprOps (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:37989:23)

before

Unexpected token (7:3)
SyntaxError: Unexpected token (7:3)
    at instantiate (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:26189:32)
    at constructor (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:26476:12)
    at Object.raise (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:29456:19)
    at Object.unexpected (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:29494:16)
    at Object.parseExprAtom (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:39240:22)
    at Object.parseExprSubscripts (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38765:23)
    at Object.parseUpdate (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38744:21)
    at Object.parseMaybeUnary (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38715:23)
    at Object.parseMaybeUnary (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:36917:20)
    at Object.parseMaybeUnaryOrPrivate (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38509:61)

@stormslowly stormslowly changed the title fix(plugin-initial-state)/prettier app.ts parse error [wip] fix(plugin-initial-state)/prettier app.ts parse error Sep 7, 2022
@codecov
Copy link

codecov bot commented Sep 7, 2022

Codecov Report

Merging #902 (3d3028e) into master (69bcf45) will decrease coverage by 0.49%.
The diff coverage is 26.82%.

@@            Coverage Diff             @@
##           master     #902      +/-   ##
==========================================
- Coverage   44.41%   43.92%   -0.50%     
==========================================
  Files          67       67              
  Lines        1727     1760      +33     
  Branches      474      478       +4     
==========================================
+ Hits          767      773       +6     
- Misses        951      978      +27     
  Partials        9        9              
Impacted Files Coverage Δ
packages/plugin-qiankun/src/master/index.ts 0.00% <0.00%> (ø)
packages/plugin-qiankun/src/slave/index.ts 0.00% <0.00%> (ø)
packages/plugin-initial-state/src/index.ts 74.07% <30.00%> (-25.93%) ⬇️
packages/plugin-model/src/utils/index.ts 88.18% <44.44%> (-7.39%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

const enable = shouldPluginEnable(entryFile);
let enable = false;

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

封装成一个公共方法?比如 tryCatchFriendlyParseError,捕获 & codeFrame 逻辑写里面,外部传个函数进去执行

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在各个包都是独立的,提取还是重复代码就没提取了。

@stormslowly stormslowly changed the title [wip] fix(plugin-initial-state)/prettier app.ts parse error fix(plugin-initial-state)/prettier app.ts parse error Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants