Comments (3)
My initial thought is that this is probably a bit beyond the scope of elm-format, as I'm a bit more hesitant to move blocks of code around than I am about the existing features of sorting imports and exposing
clauses. Also, as you note, this may not be a good idea for all types and cases -- but then I think having special behavior for very specific code patterns is also not really in line with elm-format's general philosophy. Maybe some users have reason to have types and functions that are very similar to Msg
/update
but with different names, or maybe reason to have types called Msg
or functions called update
that are used for a slightly different purpose and they don't want this rule to apply. So I'd also be a bit hesitant about this given that it may be hard to determine a rule that will both satisfy most users, and avoid being confusing to folks who just want to use elm-format and not have to learn much about how to make it do what they expect.
However, I'm open to further discussion.
Also, FYI, there appears to be an existing elm-review rule that implements this https://package.elm-lang.org/packages/SiriusStarr/elm-review-no-unsorted/1.1.4/NoUnsortedCases/ so you could try that out and see if it either already solves your problem, or use it to learn a bit more about the details of how this should best behave.
from elm-format.
I agree that this is probably not best suited for elm-format
, if only for the fact that saving might introduce large changes in an editor when running elm-format
.
Limiting this to functions named update
(what about derivatives like updateHelp
?) is also non-elm-format
like. I agree that @SiriusStarr's elm-review
rule is probably a better solution (though I have not tried it out before).
from elm-format.
Yep, this is exactly what NoUnsortedCases
does, so that should work fine. Please let me know if you have questions or run into any issues with it.
from elm-format.
Related Issues (20)
- remove `\ ->` HOT 2
- in `import`: remove `exposing ()`
- Automatic fix request: module Path.To.File instead of module Main
- Performance drops exponentially with deeply nested lists HOT 2
- Critical severity vulnerability - json-schema (via binwrap) HOT 1
- Upgrade to optparse-applicative-0.17.*
- Planned for 0.10.0: Drop official support for Elm 0.17,0.18
- Use stm-conduit for logging
- Dependency updates for 0.8.6
- Upgrade to ghc 9.4
- Upgrade to hspec-golden >= 0.2.0.0
- Use hpack
- 0.8.6 failing to run on Windows HOT 18
- Expose elm-format as a Haskell library
- Formatting unspaced operators HOT 2
- Required parens around comments are removed HOT 1
- Upgrade to ghc 9.6
- Failing to install in Github Actions HOT 3
- Parse and format incomplete code
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-format.