Git Product home page Git Product logo

Comments (4)

Janiczek avatar Janiczek commented on September 2, 2024 2

My expectations are:

  1. It would be nice to report that we should use Attrs. (This is something our rule doesn't do, if yours does it that's way cool!)
  2. Most likely yes. If we found another conflict, we'd add another allowed alias and tweak that way. I guess this has some overlap with (4)...
  3. Probably not. But it's hard for me to imagine a scenario like that. Ideally we'd have all such aliases written out in the rule config.
  4. Yes, that would be nice. (Again, our rule doesn't do that but it's a nice to have. Also, your note about (4) makes sense to me and I agree with it.)

from elm-review-imports.

sparksp avatar sparksp commented on September 2, 2024

Sure thing. The rule would currently ignore Html.Attributes.Extra not using its preferred alias because of the collisions with other configured aliases - but that does mean it wouldn't enforce any alternative, any would be allowed. I can see this would be useful, but there's a few situations that I want to understand to make sure I get this right for you. Assuming the following config...

config =
    [ NoInconsistentAliases.config
        [ ( "Html.Attributes", "Attrs", [] )
        , ( "Gwi.Html.Attributes", "Attrs", [] )
        , ( "Html.Attributes.Extra", "Attrs", [ "Attrs_" ] )
        ]
        |> NoInconsistentAliases.rule
    ]
  1. If you import Html.Attributes.Extra as Attrs_ but nothing else is imported as Attrs would you expect the rule to report that you should use Attrs, or say nothing because it's one of your configured aliases?
  2. Would you expect Gwi.Html.Attributes MUST be aliased as Attrs (if it's aliased) even if another module is using the Attrs alias?
  3. Does your answer to (2) change if the other Attrs module isn't in your config?
  4. Would you expect import Html.Attributes.Extra as Attrs to be reported if something else is also aliased to Attrs (because there's another alias it could use)? Or would it be ignored because it's using one of it's allowed aliases?

(4) comes up for me when I use Svg.Attributes alongside Html.Attributes - on their own I like them to be aliased as Attr but when they're together I would prefer to alias Svg.Attributes as SvgAttr.

from elm-review-imports.

sparksp avatar sparksp commented on September 2, 2024

Thanks for your answers - I think they align with how I saw this going. The rule currently avoids or ignores conflicts so I need to change the logic a bit to force aliases that are configured, that'll probably simplify things for me overall.

from elm-review-imports.

sparksp avatar sparksp commented on September 2, 2024

I've made some good progress over at #31 however I realised as I was writing up the PR that the imports are checked in module alphabetical order and you might have some other ordering in mind (e.g., config). This will require some reorganising/rethinking of the final evaluation but shouldn't be impossible.

from elm-review-imports.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.