Open johnd0e opened 5 years ago
So if we prefer to keep existing style's elements then we should use eslint. Otherwise, we could use some 'opinionated' formatter, like prettier or StandardJS.
Project code style is specified in https://github.com/IITC-CE/ingress-intel-total-conversion/blob/master/HACKING.md#code-style
But eslint only reports discrepancy to code style? I think utility itself should format code to our style
Project code style is specified in https://github.com/IITC-CE/ingress-intel-total-conversion/blob/master/HACKING.md#code-style
Great. I will make .eslintrc
with that rules.
But eslint only reports discrepancy to code style?
There is --fix
option.
But not all issues could be resolves automatically.
I think utility itself should format code to our style
prettier
is even more automatic, but it's rules are predefined, so we can use it only if we agree with the whole style.
P.S. Anyway, we need to merge all old PR's before any global changes.
BTW, found inconsistency in the document. Here is a rule:
- there should be a space after
if
,for
, etc. E.g.if (true) { doStuff(); } else { dontDoStuff(); }
But see at example two lines upper:
- opening brace on the same line:
if(blub) {
And perhaps we need to add some other rules to the list. E.g. https://eslint.org/docs/rules/semi
Here is the same specification with eslint rules' references added (.eslintrc
will follow).
Perhaps we should add some more rules, so consider it's still a draft.
Please follow the these guidelines. Some are just preference, others are good practice.
===
and !==
. Why do I want this?if (blub) {
} else if (blub) {
or } else {
if
, for
, etc.
E.g. if (true) { doStuff(); } else { dontDoStuff(); }
// this is a comment
$('body').append('<div id="soup">Soup!</div>');
.grep -nE "[[:space:]]+$" «filename»
In current code base we can see now a variety of different styles. It would be great to bring everything to some common code style.
So let's discuss here:
Elements of iitc-code uniform style
Tools to implement style checking, and ways to include them in our CI-chain.