Opened on 07/19/2017 at 12:49:40 PM
Closed on 07/24/2017 at 11:35:01 AM
Last modified on 08/18/2017 at 02:24:43 PM
#5429 closed defect (fixed)
ESLint v4.0.0 breaks eslint-config-eyeo
Reported by: | mjethani | Assignee: | kzar |
---|---|---|---|
Priority: | Unknown | Milestone: | |
Module: | Sitescripts | Keywords: | |
Cc: | kvas, sebastian, kzar, hfiguiere | Blocked By: | |
Blocking: | #5449 | Platform: | Unknown / Cross platform |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
https://codereview.adblockplus.org/29492585/ |
Description (last modified by mjethani)
Environment
ESLint v4.0.0
adblockpluschrome repo at changeset 7aeb2fb83e11
eslint-config-eyeo 1.0.4
How to reproduce
- Run the command eslint *.js lib/ qunit/ ext/ chrome/ from the repo
Observed behaviour
104 errors.
Expected behaviour
No errors.
Notes
It seems there have been major breaking changes in ESLint 4.0.0. Either we update the config and fix our code where appropriate, or we stick with the v3.x.x.
Attachments (0)
Change History (20)
comment:1 Changed on 07/19/2017 at 12:50:32 PM by mjethani
- Cc kvas sebastian kzar added
comment:3 Changed on 07/19/2017 at 12:58:27 PM by mjethani
comment:4 Changed on 07/19/2017 at 01:09:33 PM by mjethani
In particular ESLint 4.0.0 doesn't like this:
const {Export1, Export2, Export3, Export4, Export5} = require("example");
We have to change it to one of the following two:
const {Export1, Export2, Export3, Export4, Export5} = require("example");
const { Export1, Export2, Export3, Export4, Export5 } = require("example");
Also it doesn't like this:
return value1 && (flag ? value2 : value3);
We have to change it to:
return value1 && ( flag ? value2 : value3 );
comment:5 Changed on 07/19/2017 at 01:20:33 PM by mjethani
As part of fixing this issue, we should probably update the value of "eslint" in "peerDependencies" to just "4". This will allow for only minor and patch level changes (i.e. non-breaking). With the latest version of NPM it's possible to install modules locally and run them easily from the command line.
comment:7 Changed on 07/19/2017 at 01:45:48 PM by mjethani
The workaround for development purposes for now is to use npm install -g eslint@3.19 eslint-config-eyeo to install version 3.19 of ESLint along with the config.
In addition, we should add "ObjectExpression": "first" to fix the one error that was introduced in adblockpluschrome with changeset 0259a924a1af.
comment:8 Changed on 07/19/2017 at 01:59:40 PM by sebastian
This seems like a regression bug in ESLint to me, in particular in those cases where there is no option we could add to our configuration in order to restore the previous behavior. We should file issues with upstream ESLint, and stick with ESLint 3.19 for the time being, IMO. I'd rather not perform random changes to our code, some of which might even degrade readability.
comment:9 Changed on 07/19/2017 at 02:09:51 PM by mjethani
comment:10 Changed on 07/19/2017 at 06:09:27 PM by hfiguiere
- Cc hfiguiere added
comment:11 Changed on 07/21/2017 at 09:14:53 AM by mjethani
I have filed two bugs in ESLint: #8977, #8979.
Meanwhile, we have the option of using indent-legacy if we want to upgrade to ESLint 4 without making any code changes. Alternatively, we could stick with ESLint 3.19. The third option, of course, is to update the configuration and make minor changes to the code.
comment:12 Changed on 07/21/2017 at 09:29:51 AM by mjethani
Well, it looks like the second bug is fixed in the next release, which happily is today. This leaves us with the option of configuration updates and one small change to our code.
Note that there is another change but that's a genuine error that we should fix.
comment:13 Changed on 07/21/2017 at 07:52:59 PM by mjethani
comment:14 Changed on 07/24/2017 at 11:10:06 AM by abpbot
A commit referencing this issue has landed:
Issue 5429 - Upgrade to ESLint 4
comment:15 Changed on 07/24/2017 at 11:17:22 AM by abpbot
A commit referencing this issue has landed:
Issue 5429 - Release eslint-config-eyeo 2.0.0
comment:16 Changed on 07/24/2017 at 11:24:20 AM by kzar
- Owner set to kzar
- Review URL(s) modified (diff)
Since much of the team are away I have made the minimum configuration changes required to have ESLint 4 behave like ESLint 3 for now. (I've switched from indent to indent-legacy and added the ignoreEOLComments option to no-multi-spaces.)
I've gone with Manish's suggestion of specifying ESLint 4 now, so when ESLint 5 is released we won't be upgraded accidentally. I've also gone with his suggestion of updating the eslint-config-eyeo version to 2.0.0 since the indent-legacy option is not supported for older version of ESLint and so this is a breaking change.
I will now file an issue where we can continue the discussion about indentation for our ESLint configuration and our coding style guide.
comment:17 Changed on 07/24/2017 at 11:26:37 AM by mjethani
Confirmed, this works on adblockpluschrome, adblockplusui, and adblockpluscore master with eslint-config-eyeo 2.0.0 and ESLint 4.
comment:18 Changed on 07/24/2017 at 11:33:30 AM by kzar
- Blocking 5449 added
comment:19 Changed on 07/24/2017 at 11:35:01 AM by kzar
- Resolution set to fixed
- Status changed from new to closed
I've created #5449 for the discussion and further work required regarding indentation.
comment:20 Changed on 08/18/2017 at 02:24:43 PM by mjethani
- Review URL(s) modified (diff)
I was able to fix many of the errors by adding the following to my .eslintrc.json:
For the rest, I had to make changes to the code as there's no good way to disable those checks.