Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

use standard formatter #128

Closed
vvo opened this issue Jul 1, 2015 · 10 comments · Fixed by #134
Closed

use standard formatter #128

vvo opened this issue Jul 1, 2015 · 10 comments · Fixed by #134
Assignees
Milestone

Comments

@vvo
Copy link
Contributor

vvo commented Jul 1, 2015

To end issues about style and stop having to reformat every line of code written by different people, we could use the standard formatter: https://github.com/feross/standard

  • have a look at the predefined rules
  • there is no configuration only a standard style builtin
  • there is an automatic formatter and editor plugins
  • it's basically like gofmt but in JavaScript
  • it's based on eslint

I would be happy to switch all our JavaScript projects to standard format and start building things the fastest way instead of wrapping our mind and our code to the current project lead preferences.

So that you never find yourself contributing to an Algolia project and using your valuable time to align things, put a space there and there, remove a space there, fight with parenthesis, brackets, equals.

A good number of projects are using standard, including the whole npm codebase.

What do you think?

@redox
Copy link
Contributor

redox commented Jul 1, 2015

👍

@bobylito
Copy link
Contributor

bobylito commented Jul 1, 2015

Cool :) PR it? :)

On Wed, Jul 1, 2015 at 12:04 PM, Sylvain Utard notifications@github.com
wrote:

[image: 👍]


Reply to this email directly or view it on GitHub
#128 (comment)
.

Alexandre Stanislawski
Software Engineer
Algolia

@vvo
Copy link
Contributor Author

vvo commented Jul 1, 2015

I will!

@bobylito
Copy link
Contributor

bobylito commented Jul 1, 2015

Thanks :)
On Jul 1, 2015 1:17 PM, "Vincent Voyer" notifications@github.com wrote:

I will!


Reply to this email directly or view it on GitHub
#128 (comment)
.

@vvo vvo self-assigned this Jul 1, 2015
@vvo
Copy link
Contributor Author

vvo commented Jul 2, 2015

So standard helps but still leave a lot of cases unresolved like writing var a = [ 1, 2 ] or var a = [1,2] etc..

This will be a good first pass but we will move to http://jscs.info/ soon so that we end style conversations for good!

@pixelastic
Copy link
Contributor

Oh good, one style guide to rule them all. I'm in favor of that. For jscs, we could just use one of the predefined style guide (AirBnB for example) and move on.

vvo pushed a commit that referenced this issue Jul 2, 2015
Following #128 and various discussions we already had on code style, I
implemented `algolia-standard` in the project.

The goal of this PR is to provide a solid ground for an easy linter
that we can use on all our projects.

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

You can find the rules here: https://github.com/algolia/standard#rules

We can discuss the rules of course 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.

- 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 pushed a commit that referenced this issue Jul 2, 2015
Following #128 and various discussions we already had on code style, I
implemented `algolia-standard` in the project.

The goal of this PR is to provide a solid ground for an easy linter
that we can use on all our projects.

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

You can find the rules here: https://github.com/algolia/standard#rules

We can discuss the rules of course 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.

- 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
Copy link
Contributor Author

vvo commented Jul 2, 2015

No convinced by JSCS nor standard so I forked standard just like uber did for instance https://github.com/uber/standard.

@bobylito
Copy link
Contributor

bobylito commented Jul 3, 2015

What are your arguments against standard or JSCS? (just curious)

vvo pushed a commit that referenced this issue Jul 5, 2015
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
Copy link
Contributor Author

vvo commented Jul 5, 2015

So I have detailed pro/cons and whys in #134

vvo pushed a commit that referenced this issue Jul 5, 2015
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 pushed a commit that referenced this issue Jul 6, 2015
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 pushed a commit that referenced this issue Jul 6, 2015
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
@redox redox added this to the 2.next milestone Jul 6, 2015
@vvo
Copy link
Contributor Author

vvo commented Jul 21, 2015

was done

@vvo vvo closed this as completed Jul 21, 2015
dhayab pushed a commit to algolia/instantsearch that referenced this issue Jul 10, 2023
Following algolia/algoliasearch-helper-js#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 algolia/algoliasearch-helper-js#128
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants