Skip to content

Add/remove "port" keyword before "module" based on whether ports are defined #826

Description

@jfmengels

I don't know why the compiler requires the port keyword to be present in modules to be present (and inversely to be absent when none are defined), but I think the formatter would be a great place to fix this issue automatically.

The idea would basically be to automatically add or remove the port keyword based on the presence of ports in the file. This would remove the one feedback cycle with the compiler and the need to resolve this manually.

Examples

port module A exposing (..)

a = 1
-->
module A exposing (..)

a = 1
module A exposing (..)

port toJS : String -> Cmd msg
-->
port module A exposing (..)

port toJS : String -> Cmd msg

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions