Comments

nod_ created an issue. See original summary.

nod_’s picture

nod_’s picture

Status: Active » Needs review
droplet’s picture

it doesn't impact the compiled js files too much

Thank GOD. Then, it's reviewable :)

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

I haven't really dive into the review. Will ESLint convert the code this way? ( Provided by Airbnb? )

Any way to ask CORE Committers feedback before patch review. Not sure if they accept big patch or not.

nod_’s picture

StatusFileSize
new163.23 KB

Yes eslint added that, running the current lint:core-js is the only thing I did.

Changes to the .js files only to help reviewing

The last submitted patch, 2: core-eslint-autofix-2880007-2.patch, failed testing.

droplet’s picture

Don't you believe or not. I scaned line-by-line :p. It's verrrrrry simple changes.

the failture on this test file:

diff --git a/core/modules/locale/tests/locale_test.js b/core/modules/locale/tests/locale_test.js

the point I mentioned on #4
https://github.com/airbnb/javascript#functions--spread-vs-apply

RTBC if you fix the test case

nod_’s picture

StatusFileSize
new893.4 KB

I removed locale_test.es6.js altogether and left locale_test.js as it was before the rename.

nod_’s picture

StatusFileSize
new5.67 KB
droplet’s picture

My first check, the patch looks okay.

These 2 commands will help you to review:

git diff --color-words=. --cached "*[^es6].js"
git diff --color-words=. --cached "*.es6.js"
I removed locale_test.es6.js altogether and left locale_test.js as it was before the rename.

Needs a follow-up to ignore it or other treatment, right?

nod_’s picture

I think we should leave it like that. Now that the .js files are generated there won't be strange formats of Drupal.t() in js files (in core at least).

We should do something when the code is changed to look for translations in ES6 files and not .js files. Until then going with only the js file is fine for me. If we introduce a es6 file for this one, the generated result doesn't help testing what needs to be tested at all.

droplet’s picture

Hmm.. make sense.

Guessing we need to file an issue soon to handle template literal. (PHP using regex to match it I bet)

Ideally, before we remove the older browser supports:
http://kangax.github.io/compat-table/es6/#test-template_literals

droplet’s picture

Now, the patch looks good. I will do my 2nd review this weekend.

droplet’s picture

Assigned: Unassigned » nod_
Status: Needs review » Needs work

After some more thoughts and review & tests. I think I will mark it as RTBC.

Needs a final rerolls.

GrandmaGlassesRopeMan’s picture

Status: Needs work » Needs review
StatusFileSize
new894.66 KB

@droplet @nod_

I just ran this against the latest HEAD, c122124367. 👍

✖ 1288 problems (528 errors, 760 warnings)

Status: Needs review » Needs work

The last submitted patch, 15: 2880007-15.patch, failed testing. View results

GrandmaGlassesRopeMan’s picture

Status: Needs work » Needs review
StatusFileSize
new894.64 KB
new1.43 KB

- Minor issue with escaped strings.

droplet’s picture

Assigned: nod_ » Unassigned
Status: Needs review » Needs work

Thanks for the reroll @drpal, so I can review it again :)

core/modules/locale/tests/locale_test.es6.js

We have to ignore this file completely to let the tests to catch the SINGLE / DOUBLE QUOTE bugs. (@see #8)

GrandmaGlassesRopeMan’s picture

Status: Needs work » Needs review
StatusFileSize
new893.49 KB
new3.97 KB

@droplet

Ah yes. Thanks for pointing that out. 👍

Status: Needs review » Needs work

The last submitted patch, 19: 2880007-19.patch, failed testing. View results

GrandmaGlassesRopeMan’s picture

Status: Needs work » Needs review
StatusFileSize
new893.14 KB
new3.27 KB

Sorry; I should have run that test locally before uploading. 🤔

droplet’s picture

Status: Needs review » Reviewed & tested by the community

🚀🚀🚀🚀🚀🚀

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 21: 2880007-21.patch, failed testing. View results

GrandmaGlassesRopeMan’s picture

Assigned: Unassigned » GrandmaGlassesRopeMan
GrandmaGlassesRopeMan’s picture

Assigned: GrandmaGlassesRopeMan » droplet
Status: Needs work » Needs review
StatusFileSize
new733.38 KB

- rerolled at 950362eb48.

droplet’s picture

Assigned: droplet » Unassigned
Status: Needs review » Needs work

Missing the JS files

GrandmaGlassesRopeMan’s picture

Assigned: Unassigned » droplet
Status: Needs work » Needs review
StatusFileSize
new893.17 KB

@droplet 👍

droplet’s picture

Status: Needs review » Reviewed & tested by the community

🚀🚀🚀🚀🚀🚀

droplet’s picture

Assigned: droplet » Unassigned

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 27: 2880007-27.patch, failed testing. View results

droplet’s picture

Status: Needs work » Needs review
StatusFileSize
new895.26 KB

Make life easier

.\node_modules\.bin\eslint.cmd --fix . || true && yarn build:js

git rm -f modules/locale/tests/locale_test.es6.js && git checkout 9a0e9a649a -- modules/locale/tests/locale_test.js && git add -u && git diff --cached > auto_fix_eslint_errors-2880007.patch
GrandmaGlassesRopeMan’s picture

Status: Needs review » Reviewed & tested by the community

Maybe this time? 🙅

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

Our pre-commit hooks would actually prevent committing this so I suggest we try to find another solution for #8.

droplet’s picture

Status: Needs work » Reviewed & tested by the community

AFAIK, Babel has no ignores syntax. Let's make the pre-commit hooks compatible with CORE. It's not worth to change the build script or introduce a pattern to our developers to handle this one exception. and may be the only one forever.

lauriii’s picture

Couldn't we add an eslint ignore to that file, so that the auto fix wouldn't make changes to the file?

droplet’s picture

I wish we can. The change comes from Babel rather than ESLint fix. To check out the unpatched you will have a clear overview :p

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

Thanks @droplet. I was first only looking at the failing tests, and noticed that the only test breaking changes come from eslint. Now that I dug a bit deeper it looks like we don't want babel to compile this since this it needed for the locale module regex tests. It seems like not having .es6 version of this file is the accurate thing to do.

I think we should add a comment to the file why this is the case since at least for me this wasn't obvious at first. Probably updating the file documentation to point out to the correct file would be a good start.

In the meanwhile, I will try to figure out what would be the best way to make the git hooks support this exception.

droplet’s picture

OK. I leave it for someone able to write a better comment :p

This line blocking the commit I think:
https://github.com/alexpott/d8githooks/blob/master/pre-commit-8-4#L127

droplet’s picture

Also, maybe we should do it (#37) in a new issue thread and don't mess with the big patch together. It's easier to review/rerolls.

EDIT:

OK. I've done it: #2889600: [regression] Restore \LocaleJavascriptTranslationTest test coverage and keep testing processed JS file

droplet’s picture

Status: Needs work » Needs review
StatusFileSize
new889.8 KB

I think we able to skip the local_test in this patch. Auto-fix ESLint doesn't fix all issues.

GrandmaGlassesRopeMan’s picture

Status: Needs review » Postponed
droplet’s picture

Why not commit it straightly? I removed the local_test change in #40.

ESLint on d.org is broken now, I think we will have 2 round or 3 autofix.

This issue will unlock manual code refactoring to ES6 standard I think. (Pretty a lot of work still)

GrandmaGlassesRopeMan’s picture

Status: Postponed » Reviewed & tested by the community

@droplet

Yep. This is blocking all progress on the manual code refactoring. I didn't notice that you'd removed the changes in #40, it's pretty hard to review this huge patch. We can figure out how to handle the locale_test.js regressions later.

lauriii’s picture

Status: Reviewed & tested by the community » Fixed

I did a couple of things to review the patch:

  • Run ./node_modules/.bin/eslint --fix . || true && yarn build:js and confirmed that only differences were that the patch from #40 has reverted changes to local_test. I agree that we should handle that in separated issue.
  • Skimmed through the changes to better understand how eslint has fixed the coding standard failures. One of the things that caught my attention was the removal of use strict which I think is fine after reading this Github issue.
  • Applied the patch and confirmed that at least few of the most popular pages render correctly since the lack of JS test coverage.

Committed 612c1fa and pushed to 8.4.x. Thanks!

  • lauriii committed 612c1fa on 8.4.x
    Issue #2880007 by drpal, nod_, droplet: Auto-fix ESLint errors and...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.