Update: m-c is now reformatted, trees will reopen shortly

2019-07-05 Thread Victor Porof
Hey folks,

The tree has been reformatted[0] using Prettier, and moving forwards we will 
enforce the new JS coding style across the entire codebase. Central, inbound 
and autoland will reopen shortly.


Rebasing

If you have any pending patches touching JS code, you’ll likely require to 
rebase. To make this process as seamless as possible, please run `./mach 
bootstrap` and say yes to everything.

If you run into any trouble, make sure you read the wiki[1]. The parent 
changeset of the reformat (b7030ce607ec) has been tagged[2] as 
`PRE_TREEWIDE_PRETTIER_FORMAT`. We also recommend first rebasing to this parent 
changeset if your patches are old.


Developing

We recommend setting up your editor to format on save, or alternatively using a 
commit hook.

Check out the guides on setting up your development environment here: 
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style/Formatting_JS_Code_With_Prettier_and_eslint
 

 


Configuring

Code quality configurations for eslint are entirely determined by the options 
defined in .eslintrc.js. However, coding style configurations are largely 
predetermined within Prettier itself, and we only specify a minimal set of 
options in .prettierrc.

There may be technical reasons to get Prettier to ignore a block of code (e.g. 
JS parser tests). For that, use  `/* eslint-disable prettier/prettier */` or 
`// prettier-ignore`. But these ignores are for technical reasons only, not for 
stylistic preference reasons. See the wiki for more info[3].


Victor

[0] 
https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=041abaa4aa85f5a776e2a6d6fa3e6874d007faad
 

 
[1] 
https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=8484541d66d7f30289f295c2f72c79ac660b6560
 

  
[2] 
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style/Formatting_JS_Code_With_Prettier_and_eslint#Merging_formatted_and_unformatted_code
 

  
[3] 
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style/Formatting_JS_Code_With_Prettier_and_eslint#Configuration
 

  
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Update: m-c is now reformatted, trees will reopen shortly

2019-07-07 Thread Marco Bonardo
Hi,
the new style in some cases doesn't look more readable than before, and
some files grew a lot vertically due to huge amount of added newlines.
For example:
   Assert.equal(newPrincipalURI, originalPrincipalURI,
 "content has the same principal");
now has to be written as:
Assert.equal(
  newPrincipalURI,
  originalPrincipalURI,
  "content has the same principal"
);

Multi-condition ifs:
if (cond1 &&
cond2 &&
cond3) {
now are
if (
  cond1 &&
  cond2 &&
  cond3
) {

Also assignments
let revHost = host.split("")
.reverse()
.join("") + ".";
now are
let revHost =
  host
.split("")
.reverse()
.join("") + ".";

Are all of these expected, or are there parts that should land yet?

Cheers,
Marco
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Update: m-c is now reformatted, trees will reopen shortly

2019-07-08 Thread Victor Porof
Hey Marco,

The whitespace changes are expected; there are no other parts which await 
landing.

Readability might be better or similar as before, depending on the original 
code. And having more consistency and predictability, not just within teams but 
within Mozilla, is a good thing. This reduces time spent talking about and 
adjusting whitespace when writing, reviewing, and discussing code.

Tweaking "code quality" rules in Eslint continues as before (assuming they 
don’t interfere with Prettier), and this could affect the final output; it is 
still up to Prettier to enforce this consistency.

Victor

> On 7. Jul 2019, at 23:36, Marco Bonardo  wrote:
> 
> Hi,
> the new style in some cases doesn't look more readable than before, and some 
> files grew a lot vertically due to huge amount of added newlines.
> For example:
>Assert.equal(newPrincipalURI, originalPrincipalURI,
>  "content has the same principal");
> now has to be written as:
> Assert.equal(
>   newPrincipalURI,
>   originalPrincipalURI,
>   "content has the same principal"
> );
> 
> Multi-condition ifs:
> if (cond1 &&
> cond2 &&
> cond3) {
> now are
> if (
>   cond1 &&
>   cond2 &&
>   cond3
> ) {
> 
> Also assignments
> let revHost = host.split("")
> .reverse()
> .join("") + ".";
> now are
> let revHost =
>   host
> .split("")
> .reverse()
> .join("") + ".";
> 
> Are all of these expected, or are there parts that should land yet?
> 
> Cheers,
> Marco
> 

___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform