Git Product home page Git Product logo

Comments (7)

sergets avatar sergets commented on May 27, 2024 2

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.

vmit avatar vmit commented on May 27, 2024

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.

ikokostya avatar ikokostya commented on May 27, 2024
  1. This rule can be applied to JavaScript style guide too (ts extends js style guide).
  2. 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.

dmikis avatar dmikis commented on May 27, 2024

@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.

ikokostya avatar ikokostya commented on May 27, 2024

@dmikis Whenever possible.

from mapsapi-codestyle.

stale avatar stale commented on May 27, 2024

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.

stale avatar stale commented on May 27, 2024

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)

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.