Comments (10)
For almost all points, there are going to be no strong reasons to pick one way over the other, and trying to enforce a custom format manually is a exercise in futility. I would recommend finding a formatter (StyLua seems good), pick the configuration that you like, and just roll with that. Any variability allowed by the the formatter is fair game.
from fusion.
I would use the Roblox styleguide - it just saves time having this discussion.
Styleguides tend to be more arbitrary than practical. However special consideration should be given for how the diffs and readers are affected.
from fusion.
This is definitely stuff we need to sort out, so thanks for raising the issue!
Quick comment on:
Empty blocks or single statement blocks being multi-line
I try not to place multiple things on the same line for diffing purposes - imagine we have the following code:
if x < 0 then return end
If we had to add some code to run inside that special case, it wouldn't diff as nicely:
- if x < 0 then return end
+ if x < 0 then
+ doSomething(x)
+ return
+ end
Versus the current standard, which diffs better:
if x < 0 then
return
end
if x < 0 then
+ doSomething(x)
return
end
By the way, anyone else who has issues with formatting, please drop them in here - we need to review this before we write too much code 🙂
from fusion.
I would use the Roblox styleguide - it just saves time having this discussion.
Styleguides tend to be more arbitrary than practical. However special consideration should be given for how the diffs and readers are affected.
The Roblox styleguide is quite outdated, and does not cover a range of topics, most notably Luau types.
Can highly recommend StyLua. It does however automatically create parentheses for constructors like
New("Frame" )({})
.
This is an ongoing issue in StyLua. JohnnyMorganz/StyLua#242
from fusion.
For reference, the current style guide (needs updating): https://github.com/Elttob/Fusion/blob/main/style-guide.md
from fusion.
I try not to place multiple things on the same line for diffing purposes - imagine we have the following code:
if x < 0 then return endIf we had to add some code to run inside that special case, it wouldn't diff as nicely:
- if x < 0 then return end + if x < 0 then + doSomething(x) + return + end
I don't see this bigger diff as a big issue, because the affected lines are still correct. The reason for trailing commas and final newlines are that the diffs would affect unrelated lines. That's not the case here, so I don't think the same reasoning should apply.
from fusion.
I think it'll be worth waiting to see what other people think then - I remain unconvinced, but I'm open to changing my mind if other people also think differently.
from fusion.
If we strictly use the Roblox Lua guidelines, multiple statements should be on multiple lines https://roblox.github.io/lua-style-guide/#general-punctuation
from fusion.
Can highly recommend StyLua. It does however automatically create parentheses for constructors like New("Frame" )({})
.
from fusion.
Deferring to v0.3
from fusion.
Related Issues (20)
- Fusion.Children should parent things in batching order HOT 7
- Allow T everywhere we publicly accept StateObject<T> HOT 1
- Dissolve state objects that don't deal with state HOT 4
- Rename CanBeState<T> to be more concise HOT 7
- Dealing with re-entrant updates HOT 2
- Introduce a more efficient connector between state and data model properties
- Heuristic memoisation for state objects HOT 1
- Add debugging protocol for non-invasive inspection
- Change design of Observer to allow pooling listeners HOT 1
- Reuse scopes from primitive computed objects HOT 3
- Test what an ideal scope pool size is HOT 1
- Integrate under-documented APIs into tutorials
- Explore safer interpretations of `deriveScope` HOT 1
- Spring setters don't work immediately after construction
- Memoise special key generation functions
- Poor typechecking for use functions with UsedAs<T>
- Derive scopes with additional methods HOT 2
- Standard set of reactive graph shapes for testing HOT 1
- Write tutorial for `Safe` expressions
- Broken default props link (still uses .lua)
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 fusion.