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

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

Open
jfmengels opened this issue Nov 10, 2024 · 0 comments

Comments

@jfmengels
Copy link

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
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

1 participant