Skip to content

Flowtype comments markers #661

@qzb

Description

@qzb

Flowtype supports annotating code with comments (only block comments /* ... */). It uses three different markers ( :, ::, flow-include), none of them is currently recognized by standard. Flowtype ignores whitespaces before markers, so standard doesn't brake anything, but placing spaces before these markers is inconsistent - they are not required before other markers like * and !. My proposition is to add : and :: to list of markers for block comments. I'm not sure if flow-include should be also added, it is just an alias for ::, and markers like this looks kind of strange without whitespace:

/*flow-include declare type foo = number */    // looks strange, currently disallowed
/* flow-include declare type foo = number */   // looks ok

On other hand space before : marker could actually improve readability:

function foo (arg /* : number */) {}   // with whitespace - currently valid
function foo (arg /*: number */) {}    // without whitespace - currently invalid

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions