Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why Use single quotes for strings & Extra semicolon ? #788

Closed
xgqfrms-GitHub opened this issue Feb 19, 2017 · 6 comments

Comments

@xgqfrms-GitHub
Copy link

commented Feb 19, 2017

After you did this, the codes looks very ugly & not conform with the ECMAScript standard & JSON standard!

@ltngames

This comment has been minimized.

Copy link

commented Feb 19, 2017

Then don't use it, totally an optional thing, no one is going to force you to use it.

@xgqfrms-GitHub

This comment has been minimized.

Copy link
Author

commented Feb 19, 2017

ofcourse!

@LinusU

This comment has been minimized.

Copy link
Member

commented Feb 19, 2017

not conform with the ECMAScript standard

What do you mean with this? The code style that we are providing is 100% in line with the ECMAScript standard as far as I can understand...

@xgqfrms-GitHub

This comment has been minimized.

Copy link
Author

commented Feb 19, 2017

JSON recommanded to using double quotes!

https://jsonformatter.curiousconcept.com/

{
    "key1":"value1",
    "key2":"value2",
    "key3":"value3"
}

json-valid double quotes

{
     'key1': "value1",
    "key2": "value2",
    "key3": "value3"
}

{
    "key1": 'value1',
    "key2": "value2",
    "key3": "value3"
}

{
      key1: 'value1',
    "key2": "value2",
    "key3": "value3"
}

RFC 4627

json-invalid single quotes
json-invalid single quotes 2
json-invalid single quotes 3

https://www.ietf.org/rfc/rfc4627.txt
https://tools.ietf.org/html/rfc4627

2.5.  Strings

   The representation of strings is similar to conventions used in the C
   family of programming languages.  A string begins and ends with
   quotation marks.  All Unicode characters may be placed within the
   quotation marks except for the characters that must be escaped:
   quotation mark, reverse solidus, and the control characters (U+0000
   through U+001F).

   Any character may be escaped.  If the character is in the Basic
   Multilingual Plane (U+0000 through U+FFFF), then it may be
   represented as a six-character sequence: a reverse solidus, followed
   by the lowercase letter u, followed by four hexadecimal digits that
   encode the character's code point.  The hexadecimal letters A though
   F can be upper or lowercase.  So, for example, a string containing
   only a single reverse solidus character may be represented as
   "\u005C".

   Alternatively, there are two-character sequence escape
   representations of some popular characters.  So, for example, a
   string containing only a single reverse solidus character may be
   represented more compactly as "\\".

   To escape an extended character that is not in the Basic Multilingual
   Plane, the character is represented as a twelve-character sequence,
   encoding the UTF-16 surrogate pair.  So, for example, a string
   containing only the G clef character (U+1D11E) may be represented as
   "\uD834\uDD1E".

rfc-4627

ECMA-404

json-invalid ecma-404

ECMA-404 The JSON Data Interchange Standard.
ecma-404 double quotes

http://www.json.org/
https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf

@ltngames

This comment has been minimized.

Copy link

commented Feb 19, 2017

That is JSON not JavaScript which has nothing to do with this Standard. This is a Javascript standard not a JSON standard.

@LinusU

This comment has been minimized.

Copy link
Member

commented Feb 19, 2017

As previous comment said, you are talking about JSON, not JavaScript...

I don't think that many people at all are always quoting their keys when they write javascript, and anyhow, we would be able to change that at this point...

Closing since I don't think that we need to change anything...

@LinusU LinusU closed this Feb 19, 2017

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.