Receive some parse error when scanning javascript with flow

Hi guys,

I hope you guys doing well.
I’m receiving some error when running sonar Scanner 3.3.0.1492 on javascript project with flow syntax.
I have tried to use Scanner 4.0.0.1744 and still received the same errors.

The errors are

ERROR: Parse error at line 14 column 3:
 4: 
 5: export type ReduxProps = {|
 6:   result: ?CSAdminSearchResult,
 7: |};
 8: 
 9: export type ReactProps = {|
10:   entityRef: string,
11: |};
12: 
13: export type Props = {|
14:   ...ReduxProps,
  ^
15:   ...ReactProps,
16: |};
17: 

and

21:   };
22: }
23: 
24: function mapDispatchToProps(dispatch: AppDispatch): DispatchProps {
25:   return {
26:     useInitialise: useInitialise(dispatch),
27:   };
28: }
29: 
30: export default connect<
31:   ViewProps,
               ^
32:   ReactProps,
33:   StateProps,
34:   DispatchProps,
35:   AppState,
36:   AppDispatch,
37: >(
38:   mapStateToProps,
39:   mapDispatchToProps,
40: );
41: 

In our build script, we have to strip out these scripts. I have thought to do the same before scanning. And it is not a good way.
Do you have any suggestions?

1 Like

Hi,

Scanner version has nothing to do with parsing, as it’s javascript analyzer component duty. Indeed we don’t have a full support for Flow syntax, check this thread.

Thank you Elena.