Comments (4)
My expectations are:
- 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!) - 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)...
- 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.
- 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.
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
]
- If you
import Html.Attributes.Extra as Attrs_
but nothing else is imported asAttrs
would you expect the rule to report that you should useAttrs
, or say nothing because it's one of your configured aliases? - Would you expect
Gwi.Html.Attributes
MUST be aliased asAttrs
(if it's aliased) even if another module is using theAttrs
alias? - Does your answer to (2) change if the other
Attrs
module isn't in your config? - Would you expect
import Html.Attributes.Extra as Attrs
to be reported if something else is also aliased toAttrs
(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.
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.
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)
- Ensure Consistent Aliases
- Check for default exposes HOT 1
- Shadowing when aliasing a type with the same name HOT 2
- Forbid aliases for certain imports HOT 1
- Collision detection with preferred aliases HOT 1
- Alternate way to configure consistent alias rule HOT 2
- NoModuleOnExposedName fix can introduce name collision HOT 6
- Enforce preferred names
- Applying the fix doesn't always update instances of Module.Constructor HOT 3
- Enforce consistency for every alias
- Shadowing issue with record pattern matching for NoModuleOnExposedNames
- Enforce use of an alias when one is known
- Do not allow exposed names to be qualified HOT 1
- False negative on `Json.Decode` when `Json.Decode.Extra` import is also present
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elm-review-imports.