This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
vvo
committed
Jul 5, 2015
1 parent
e1c6540
commit 1d10458
Showing
46 changed files
with
2,974 additions
and
2,926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,6 @@ | ||
{ | ||
"env" : { | ||
"node": true, | ||
"browser": true | ||
}, | ||
"rules" : { | ||
"brace-style": [2, "stroustrup", { "allowSingleLine": true }], | ||
"camelcase" : 1, | ||
"comma-spacing": [2, {"before": false, "after": true}], | ||
"comma-style": [2, "last"], | ||
"consistent-return" : 2, | ||
"consistent-this": [1, "self"], | ||
"curly" : [2,"multi-line"], | ||
"default-case": 1, | ||
"eqeqeq": [2, "smart"], | ||
"global-strict" : 0, | ||
"indent": [2, 2], | ||
"key-spacing" : [1, { "beforeColon" : true, "afterColon" : true }], | ||
"new-cap" : 2, | ||
"no-extra-bind" : 1, | ||
"no-multiple-empty-lines" : 1, | ||
"no-multi-spaces": 1, | ||
"no-spaced-func": 1, | ||
"no-trailing-spaces" : 2, | ||
"no-underscore-dangle": 0, | ||
"quotes" : [1, "double"], | ||
"semi": 2, | ||
"space-before-blocks": 1, | ||
"space-before-function-parentheses": [1, "never"], | ||
"space-infix-ops": 1, | ||
"space-in-parens": [1, "always"], | ||
"strict" : [2, "global"], | ||
"valid-jsdoc": [2, { "requireReturnDescription": false }] | ||
}, | ||
"globals" : { | ||
"module" : true, | ||
"require" : true | ||
} | ||
"extends": [ | ||
"eslint-config-airbnb", | ||
"eslint-config-algolia" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"plugins": ["plugins/markdown"], | ||
"opts" : { | ||
"template" : "node_modules/minami" | ||
"opts": { | ||
"template": "node_modules/minami" | ||
}, | ||
"markdown" : { | ||
"anchorInHeadings" : true | ||
"markdown": { | ||
"anchorInHeadings": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.