itowns
itowns copied to clipboard
Coding style: enable all airbnb rules
PR #212 enabled code style checking following airbnb coding style. Some of the existing problems were fixed, but there's some work left.
Let's use this issue to track down the remaining eslint disabled rules.
- [x] func-names
- [x] no-trailing-spaces
- [x] padded-blocks
- [x] one-var
- [x] no-use-before-define
- [ ] no-mixed-operators
- [ ] no-underscore-dangle
- [ ] eqeqeq
- [ ] max-len
- [ ] no-param-reassign
- [ ] no-else-return
- [ ] no-var
- [ ] vars-on-top
- [ ] no-shadow
- [x] no-unneeded-ternary ??? :hot_pepper:
- [ ] no-restricted-properties
- [ ] prefer-spread
- [x] default-case ??? :hot_pepper:
- [ ] camelcase
- [x] block-scoped-var ??? :hot_pepper:
- [ ] no-bitwise
- [ ] no-restricted-syntax
- [ ] guard-for-in ??? :hot_pepper:
- [x] no-tabs
- [ ] consistent-return
- [x] brace-style
- [ ] new-cap
- [x] no-cond-assign ??? :hot_pepper:
- [x] no-unused-expressions ??? :hot_pepper:
- [x] no-unused-vars
- [ ] no-continue
- [x] import/no-extraneous-dependencies
- [x] no-lonely-if ??? :hot_pepper:
- [x] no-prototype-builtins ??? :hot_pepper:
- [x] no-throw-literal ??? :hot_pepper:
- [x] operator-assignment ??? :hot_pepper:
- [x] no-return-assign ??? :hot_pepper:
- [x] no-useless-concat ??? :hot_pepper:
- [x] no-loop-func ??? :hot_pepper:
- [x] import/no-mutable-exports ??? :hot_pepper:
- [x] import/prefer-default-export ??? :hot_pepper:
- [x] import/no-named-as-default-member ??? :hot_pepper:
- [x] import/no-named-as-default ??? :hot_pepper:
- [x] import/newline-after-import ??? :hot_pepper:
- [x] import/no-unresolved ??? :hot_pepper:
- [x] import/extensions ??? :hot_pepper:
Also, we need to think about linebreak-style
(which is off
since https://github.com/iTowns/itowns2/commit/65ccaa7064395bac577414e7eee50976382d5d75). Apparently it causes errors on windows with some settings. Actually, as we use a .gitattribute in the repo maybe we don't need a rule about line ending in the linter if everybody use a git client that honors it (apparently, some of them ignore this file).
@nosy-b could you detail your setup here? (I mean, what editor and git client you use, and the relevant part of your .gitconfig
, especially core.autocrlf).
We also have end_of_line = lf
in .editorconfig...
My .gitconfig has core.autoclrf set to true. doc on this (I code on netbeans on both win and mac). I could tune it differently but should all external users on win have to do special things to clone and build the master without errors? I'm not an expert on this, I leave you this job :)
Looks like we could add
*.js eol=lf
to our .gitattributes
(in addition to the existing * text=auto
) to force the EOL to LF (therefore following our .editorconfig
and ESLint configurations)
See https://git-scm.com/docs/gitattributes#_end_of_line_conversion
Referencing https://github.com/iTowns/itowns2/pull/220 here. It will correct func-names
Referencing https://github.com/iTowns/itowns2/pull/226
Looks like we could add
*.js eol=lf
to our .gitattributes (in addition to the existing * text=auto) to force the EOL to LF (therefore
Maybe we can force eol to lf everywhere actually. We would also have the benefits of it on glsl, html, css files... Do you think it will work?
Maybe we can force eol to lf everywhere actually.
answering myself, the answer is probably no. Let's have a eol=lf for a selected set of extensions.
https://github.com/iTowns/itowns2/pull/224 corrected one-var
https://github.com/iTowns/itowns2/pull/227 corrected another bunch.
The current coding style seams good enough for now. Don't hesitate to reopen if you have new ideas on the subject.