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

Support parsing of Flow annotations #584

Closed
agigleux opened this issue May 12, 2017 · 16 comments
Closed

Support parsing of Flow annotations #584

agigleux opened this issue May 12, 2017 · 16 comments
Assignees
Milestone

Comments

@agigleux
Copy link
Member

Migrated from: https://jira.sonarsource.com/browse/SONARJS-828
Flow: https://flow.org/

@sattaman
Copy link

+1

2 similar comments
@ummahusla
Copy link

+1

@trietphamnm
Copy link

+1

@himynameisjon
Copy link

+1

2 similar comments
@r085741
Copy link

r085741 commented Jul 12, 2017

+1

@bendersej
Copy link

+1

@memelet
Copy link

memelet commented Aug 20, 2017

Can sonarjs be used with flow at all? We have a bunch of project that employ flow. Do people configure sonar to use js output from flow maybe?

@inverno
Copy link
Contributor

inverno commented Aug 22, 2017

@memelet what you propose could work and with source maps it might even be vaguely useful, but do consider that the reason we are not yet supporting flow annotation is not related to parsing them without failing, it's related to the information content they provide : if you are using flow and we run analysis on your sources (or output) without understanding the information provided by flow we might raise a lot of issues that are not relevant.
In short : you might try that, but please don't be upset if the analyzer raises obviously wrong issues.

@vilchik-elena vilchik-elena added this to the 3.2 milestone Aug 28, 2017
@kesor
Copy link

kesor commented Aug 30, 2017

@inverno at the moment the scanner cannot parse files annotated with flow. Any files that have flow annotations cause an ERROR: Unable to parse file and are being ignored.

@cszczotka
Copy link

hi,
Do you have plan to implement support for flow syntax in sonarqube javascript plugin ? Maybe you have same a workaround how to scan javascript code where is used flow ?
Regards,
Czeslaw

@pawelk
Copy link

pawelk commented Sep 11, 2017

@cszczotka I have added flow-remove-types to my project and pointed Sonarqube to scan the non-annotated JS. It's far from ideal and meant to be temporary, but at least the code gets scanned.

@vilchik-elena
Copy link
Contributor

vilchik-elena commented Sep 13, 2017

Flow features:

  • typed variable declaration
  • function declarations (declaration, expression, arrow, method): types for parameters, type for return, optional parameters, type for rest parameter
  • optional type
  • literal type
  • function type, with generics
  • object type, optional properties in object type, exact object type, indexer property for object type (aka map object)
  • array types
  • parenthesis in type (e.g. let arr2: (?number)[] = [1, 2];)
  • tuple types
  • typed properties in class declaration
  • type alias statement, with opaque, with supertype
  • import statements
  • export statements
  • declare type statement
  • interface type (properties, method, modifiers + and -)
  • generics: function declarations, class declarations, interface declarations, type aliases, function type. Parameterized generics. Super type for generic parameter (link).
  • union types
  • disjoint Unions
  • intersection types
  • typeof operator
  • type-casting
  • Utility Types ($Keys, $Diff etc)

@vilchik-elena
Copy link
Contributor

vilchik-elena commented Sep 14, 2017

@vilchik-elena
Copy link
Contributor

There is still some syntax not supported. See this issue #771

@vilchik-elena vilchik-elena added type: false positive Issue is reported when it should NOT be and removed type: false positive Issue is reported when it should NOT be labels Sep 29, 2017
@mkruneva
Copy link

Hi, I am still having issues with flow syntax ? Is there a workaround or any updates?

Thank you

@vilchik-elena
Copy link
Contributor

@mkruneva comment on #771 with examples

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

No branches or pull requests