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

var arr = [ 1, 2 ] and arr = [1,2] allowed #180

Closed
vvo opened this issue Jul 2, 2015 · 3 comments

Comments

@vvo
Copy link

commented Jul 2, 2015

Reading https://github.com/feross/eslint-config-standard/blob/114e768090adff82ed8f8641e60ae5568b3dcdbd/eslintrc.json#L175 means that you can write your code:

var arr = [ 1, 2 ]
// or
var arr = [1,2]
  1. is that true?
  2. I thought the goal of standard was to avoid such situations but I may be wrong and http://jscs.info/overview.html may be a better solution
  3. if the goal of standard is to avoid such issues then forgive me and close it :)
@dcousens

This comment has been minimized.

Copy link
Member

commented Jul 2, 2015

var arr = [1,2]

That is not allowed, and will give you a warning regards the trailing space.

@dcousens dcousens closed this Jul 2, 2015

@feross

This comment has been minimized.

Copy link
Member

commented Jul 2, 2015

@dcousens You're right, but there's still a bit of ambiguity here. Both of these are allowed:

var arr = [ 1, 2 ]
var arr = [1, 2]

Similarly to my comment here, I would like to enforce [ 1, 2 ] but I think it may be too late to make a change like that without upsetting tons of users.

@dcousens

This comment has been minimized.

Copy link
Member

commented Jul 3, 2015

@feross heh, true, I don't think I've ever written an array like [ 1, 2 ], but in terms of consistency, you're entirely correct that it is the right choice.

vvo added a commit to algolia/algoliasearch-helper-js that referenced this issue Jul 5, 2015

chore: code style change, lint using modified eslint-config-airbnb
Following #128 and various discussions we already had on code style, I
configured our lint on airbnb/javascript style guide using eslint.

I chose to stay with ESLint because:
- it's becoming a good linting standard and has the best support for both ES6,
  jsx, react..
- already what we know, do not have to change again
- other alternatives were not as good as what we wanted

Not a single linter has a "Automatically reformat this whole code
option, do it well". ESLint has some wishes for ESLint 2.0 but may be
later.

In the end we will struggle a little bit on following our own Algolia
style at the begining but it will be worth it soon as we will be more
and more JavaScript`er. I recall @bobylito wanting to do so early on
when we both joined. Well, now it's time!

The goal of this PR is to provide a solid ground for our linting rules
amongst all our JS projects.

The currently picked coding style is the one from Airbnb, with
modifications.

You can find the modified rules here: https://github.com/algolia/eslint-config-algolia#rules

One of the not so obvious rule is the semi colon remove, I was convinced
by https://github.com/feross/standard#rules and
https://github.com/yyx990803/semi#but-semicolons-are-required

I assume there are some rules like spacing aroud parentheses and
brackets that will be a big change for you @bobylito (and it's your
project so I am dropping your name here!)

But we need to try to find a style that is both OUR style and also will
not give our future open source contributors too much WTF moments when
encountering our style.

On this subject, http://sideeffect.kr/popularconvention/#javascript is a
good data based source.

We can discuss, add, remove, edit the rules as long as we do not discuss them
every week!

Other projects:

- Original feross/standard:
After trying it I discovered some rules were not strict enough and
would lead to again style discussions. Has some sort of formatter but
not very good. Based on eslint.

Ref:
- standard/standard#180

- JSCS:
I tried JSCS: good but only oriented on style, no rules on unused
variables or ways to prevent bugs like eslint does. Has some sort of
formatter, but not very good.

Ultimately eslint will have a good formatter, in the meantime we will
all switch to some new coding style, for good :-)?

fixes #128

vvo added a commit to algolia/algoliasearch-helper-js that referenced this issue Jul 5, 2015

chore: code style change, lint using modified eslint-config-airbnb
Following #128 and various discussions we already had on code style, I
configured our lint on airbnb/javascript style guide using eslint.

I chose to stay with ESLint because:
- it's becoming a good linting standard and has the best support for both ES6,
  jsx, react..
- already what we know, do not have to change again
- other alternatives were not as good as what we wanted

Not a single linter has a "Automatically reformat this whole code
option, do it well". ESLint has some wishes for ESLint 2.0 but may be
later.

In the end we will struggle a little bit on following our own Algolia
style at the begining but it will be worth it soon as we will be more
and more JavaScript`er. I recall @bobylito wanting to do so early on
when we both joined. Well, now it's time!

The goal of this PR is to provide a solid ground for our linting rules
amongst all our JS projects.

The currently picked coding style is the one from Airbnb, with
modifications.

You can find the modified rules here: https://github.com/algolia/eslint-config-algolia#rules

One of the not so obvious rule is the semi colon remove, I was convinced
by https://github.com/feross/standard#rules and
https://github.com/yyx990803/semi#but-semicolons-are-required

I assume there are some rules like spacing aroud parentheses and
brackets that will be a big change for you @bobylito (and it's your
project so I am dropping your name here!)

But we need to try to find a style that is both OUR style and also will
not give our future open source contributors too much WTF moments when
encountering our style.

On this subject, http://sideeffect.kr/popularconvention/#javascript is a
good data based source.

We can discuss, add, remove, edit the rules as long as we do not discuss them
every week!

Other projects:

- Original feross/standard:
After trying it I discovered some rules were not strict enough and
would lead to again style discussions. Has some sort of formatter but
not very good. Based on eslint.

Ref:
- standard/standard#180

- JSCS:
I tried JSCS: good but only oriented on style, no rules on unused
variables or ways to prevent bugs like eslint does. Has some sort of
formatter, but not very good.

Ultimately eslint will have a good formatter, in the meantime we will
all switch to some new coding style, for good :-)?

fixes #128

vvo added a commit to algolia/algoliasearch-helper-js that referenced this issue Jul 6, 2015

chore: code style change, lint using modified eslint-config-airbnb
Following #128 and various discussions we already had on code style, I
configured our lint on airbnb/javascript style guide using eslint.

I chose to stay with ESLint because:
- it's becoming a good linting standard and has the best support for
both ES6,
jsx, react..
- already what we know, do not have to change again
- other alternatives were not as good as what we wanted

Not a single linter has a "Automatically reformat this whole code
option, do it well". ESLint has some wishes for ESLint 2.0 but may be
later.

In the end we will struggle a little bit on following our own Algolia
style at the begining but it will be worth it soon as we will be more
and more JavaScript`er. I recall @bobylito wanting to do so early on
when we both joined. Well, now it's time!

The goal of this PR is to provide a solid ground for our linting rules
amongst all our JS projects.

The currently picked coding style is the one from Airbnb, with
modifications.

You can find the modified rules here: https://github.com/algolia
/eslint-config-algolia#rules

I assume there are some rules like spacing aroud parentheses and
brackets that will be a big change for you @bobylito (and it's your
project so I am dropping your name here!)

But we need to try to find a style that is both OUR style and also
will
not give our future open source contributors too much WTF moments when
encountering our style.

On this subject, http://sideeffect.kr/popularconvention/#javascript is
a
good data based source.

We can discuss, add, remove, edit the rules as long as we do not
discuss them
every week!

Other projects:

- Original feross/standard:
After trying it I discovered some rules were not strict enough and
would lead to again style discussions. Has some sort of formatter but
not very good. Based on eslint.

Ref:
- standard/standard#180

- JSCS:
I tried JSCS: good but only oriented on style, no rules on unused
variables or ways to prevent bugs like eslint does. Has some sort of
formatter, but not very good.

Ultimately eslint will have a good formatter, in the meantime we will
all switch to some new coding style, for good :-)?

fixes #128

vvo added a commit to algolia/algoliasearch-helper-js that referenced this issue Jul 6, 2015

chore: code style change, lint using modified eslint-config-airbnb
Following #128 and various discussions we already had on code style, I
configured our lint on airbnb/javascript style guide using eslint.

I chose to stay with ESLint because:
- it's becoming a good linting standard and has the best support for
both ES6,
jsx, react..
- already what we know, do not have to change again
- other alternatives were not as good as what we wanted

Not a single linter has a "Automatically reformat this whole code
option, do it well". ESLint has some wishes for ESLint 2.0 but may be
later.

In the end we will struggle a little bit on following our own Algolia
style at the begining but it will be worth it soon as we will be more
and more JavaScript`er. I recall @bobylito wanting to do so early on
when we both joined. Well, now it's time!

The goal of this PR is to provide a solid ground for our linting rules
amongst all our JS projects.

The currently picked coding style is the one from Airbnb, with
modifications.

You can find the modified rules here: https://github.com/algolia
/eslint-config-algolia#rules

I assume there are some rules like spacing aroud parentheses and
brackets that will be a big change for you @bobylito (and it's your
project so I am dropping your name here!)

But we need to try to find a style that is both OUR style and also
will
not give our future open source contributors too much WTF moments when
encountering our style.

On this subject, http://sideeffect.kr/popularconvention/#javascript is
a
good data based source.

We can discuss, add, remove, edit the rules as long as we do not
discuss them
every week!

Other projects:

- Original feross/standard:
After trying it I discovered some rules were not strict enough and
would lead to again style discussions. Has some sort of formatter but
not very good. Based on eslint.

Ref:
- standard/standard#180

- JSCS:
I tried JSCS: good but only oriented on style, no rules on unused
variables or ways to prevent bugs like eslint does. Has some sort of
formatter, but not very good.

Ultimately eslint will have a good formatter, in the meantime we will
all switch to some new coding style, for good :-)?

fixes #128

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 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.