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

New rule: No over-separating modules in an MVC style #1

Open
jfmengels opened this issue Sep 25, 2020 · 0 comments
Open

New rule: No over-separating modules in an MVC style #1

jfmengels opened this issue Sep 25, 2020 · 0 comments
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed

Comments

@jfmengels
Copy link
Owner

jfmengels commented Sep 25, 2020

What problems does it solve:

The official guide explains the problem quite well.

What the rule should do:

Report when it looks like parts of the projects are structured like an MVC construct, separated into multiple files. So if you have multiples files named Xyz.<name> where at least two of the names is Model, View, Update, ..., then they should be reported.

Example of things the rule would report:

-- src/SideBar/Model.elm
module SideBar.Model exposing (Model)
               ^^^^^
-- src/SideBar/Update.elm
module SideBar.Update exposing (Msg, update)
               ^^^^^^
-- src/SideBar/View.elm
module SideBar.View exposing (view)
               ^^^^

The ^^^^ indicate where I think the error should appear.

The same issue should also be reported if the module names are not prefixed.

-- src/Model.elm
module Model exposing (Model)
       ^^^^^
-- src/Update.elm
module Update exposing (Msg, update)
       ^^^^^^
-- src/View.elm
module View exposing (view)
       ^^^^

The contents of the module and what it exposes should not matter.

Example of things the rule would not report:

No apparent over-separation from the module name

module SideBar exposing (Model, Msg, view, update)

Only a single oddly named module per "component", which likely indicates an odd naming for the module, but not an over-separation problem.

-- src/SideBar/Model.elm
module SideBar.Model exposing (Model)
-- src/Header/Update.elm
module Header.Update exposing (Msg, update)

When (not) to enable this rule:

This rule will only be useful for applications.

I am looking for:

  • Someone to implement it (I can provide help and guidance)
  • A good rule name. NoMVCSeparation, NoOverSeparatingModules?
  • What names should be reported.

Model, View, Update, Subscriptions. Types? Maybe also Msg and/or Init? Let me know what you have seen used!
Lamdera needs a Types.elm module at the root of the project, but as long as users don't create another module with a "smelly" name, it should be fine.

@jfmengels jfmengels added help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest labels Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant