Comments (7)
I vote for this rule, we use it in our styleguide and I found out it helps maintain consistent terminology throughout the application.
{
id,
geoObject,
date,
label: caption
}
bends you towards choosing the right word between label
and caption
much stronger than
{
id: id,
geoObject: geoObject,
date: date,
label: caption
}
In fact, one perhaps will not even notice something is inconsistent in second case. Of course renaming is not possible everywhere, but at least every colon will mean "property and variable names here differ intentionally".
from mapsapi-codestyle.
I would not agree: using mixed syntax "breaks" your "scanning/reading patterns" and the shortened property look like something requiring your attention. Plus it has to be managed manually when you feractor a property/variable
BTW: literals with all identifier-properties looks really nice
from mapsapi-codestyle.
- This rule can be applied to JavaScript style guide too (
ts
extendsjs
style guide). - Personally I use shorthand properties, because I read it faster:
2 steps:
{bar: bar}
^-------------- 1) object has property `bar`
^--------- 2) which has value `bar`. There is additional attention, because value can be different.
vs 1 step:
{bar}
^-------------- 1) object has value `bar` with the same name.
from mapsapi-codestyle.
@ikokostya The question is do we use them everywhere possible or only when all properties of an literal are expressible that way?
from mapsapi-codestyle.
@dmikis Whenever possible.
from mapsapi-codestyle.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from mapsapi-codestyle.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from mapsapi-codestyle.
Related Issues (20)
- async without await HOT 1
- Use tslint "max-line-length" rule HOT 1
- Обязательный вызов конструктора родителя в конструкторе дочернего класса HOT 1
- Codestyle for ES6 HOT 3
- Enums code style HOT 12
- Spaces around comma HOT 3
- Required space in class methods names HOT 6
- JSCS 3 support for loris preset HOT 2
- Update eslint rules HOT 3
- Clarifying object notation HOT 2
- Class properties order HOT 5
- Type assertions style
- Move react preset to separate package
- Add tslint config
- Add rule for beginning underscore for private fields HOT 1
- Mandatory return type for functions and methods HOT 3
- Template parameter naming HOT 9
- Add rule for spaces in imports HOT 2
- Ternary operator HOT 4
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 mapsapi-codestyle.