Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update parser options #1094

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Update parser options #1094

wants to merge 2 commits into from

Conversation

Lysholm
Copy link

@Lysholm Lysholm commented May 3, 2018

Latest eslint version issues a deprecation warning for "parserOptions.ecmaFeatures.experimentalObjectRestSpread"
Removed it and changed ecmaVersion to 2018 as suggested on https://eslint.org/docs/user-guide/configuring#deprecated

Latest eslint version issues a deprecation warning for "parserOptions.ecmaFeatures.experimentalObjectRestSpread"
Removed it and changed ecmaVersion to 2018 as suggested on https://eslint.org/docs/user-guide/configuring#deprecated
@coveralls
Copy link

coveralls commented May 3, 2018

Coverage Status

Coverage decreased (-1.0%) to 97.184% when pulling 4155458 on Lysholm:patch-1 into f0d0c4f on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.177% when pulling 8eb6815 on Lysholm:patch-1 into f0d0c4f on benmosher:master.

ljharb
ljharb previously requested changes May 3, 2018
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest version is v4; you might be referring to the v5 alpha, and this warning still isn't set in stone there.

This plugin needs to retain compatibility with older eslint versions, which might not support this ecmaVersion, so I don't think this is a change we should make.

@Lysholm
Copy link
Author

Lysholm commented May 3, 2018

@ljharb You are right the warning is only present on the alpha channel, i was confused since the option was deprecated as of the documentation starting in eslint 4.18.0.

Espree 3.5 added the support for es2018 and was introduced in eslint 4.4, so eslint versions prior to that would probably break. That makes this a breaking change.

Still think it should be done though, but maybe hold off until eslint 5 is released and add a recommended-legacy config file and update docs to reflect.

@Lysholm
Copy link
Author

Lysholm commented May 3, 2018

@ljharb At second look, it doesn't look like this object rest spread config is done at all in the documented way of setting up eslint-plugin-import (import/error + import/warning prebaked configs). Should it even be there at all? It's atleast a point of confusion that recommended is equal to error + warning except for this one thing.

@ljharb
Copy link
Member

ljharb commented May 3, 2018

As the comment says, it's needed for parsing dependencies.

I don't think it's worth a breaking change, I think we need to find a backwards compatible way to do it.

@Lysholm
Copy link
Author

Lysholm commented May 3, 2018

@ljharb: I think there's something i don't understand here. Is the recommended config not meant to be used?

Most people probably set this up copying the settings off the readme:

extends: [
        "eslint:recommended",
        "plugin:import/warnings",
        "plugin:import/errors"
]

That seems to work and doesn't end up setting the parser options at all so this is a non issue for everyone who read the readme and not blindly configured from pattern matching setup of other plugins. ;)

Is there some special use case for

extends: [
    "eslint:recommended",
    "plugin:import/recommended"
]

or is the difference accidental?

@ljharb
Copy link
Member

ljharb commented May 3, 2018

@benmosher, any context?

@benmosher
Copy link
Member

Honestly, it's been ages since I've looked at that file. I am not sure if that block is even needed. I think it may be a vestige from a time when plugins didn't have access to parser or options. This particular block actually seems to stem from #416.

I would probably move to just drop that whole parserOptions bit, feels like an over-reach at this point to include it. is that a semver-major event, though?

Making import/recommended preset equal to import/warnings + import/errors presets.
@Lysholm
Copy link
Author

Lysholm commented May 4, 2018

Should be a semver-patch event. I tested eslint-plugin-import 2.11.0 against eslint 1.10.3 (the latest version without the changes you referred to) and it's not supported. So no semver-major event.

@ljharb
Copy link
Member

ljharb commented May 4, 2018

So someone without those parser settings, but who uses the recommended config, but whose code relies on the parser settings - what happens to them with this change?

@benmosher
Copy link
Member

I honestly only vaguely remember. I want to say that I was just trying to be helpful and cover bases because I ran into a situation where the linted code didn't use spread, but some ES-module dependency did.

So really, only that exact situation. Is a breaking change, I think, technically, but also feels like a pretty niche case.

@ljharb ljharb dismissed their stale review May 4, 2018 19:27

unblocking. i think the change is fine, but it’s technically semver-major.

@Lysholm
Copy link
Author

Lysholm commented May 7, 2018

@ljharb Good catch, it would break for them so semver-major then.

@ljharb
Copy link
Member

ljharb commented May 7, 2018

It seems worth holding off on a semver-major release, however, at least until eslint 5 is out - we can drop support for eslint v2 at that time - so perhaps we should wait to merge this until then (and right after the last non-major release prior to v3 is published)?

@Lysholm
Copy link
Author

Lysholm commented May 7, 2018

That makes sense to me

@benmosher benmosher added this to the v3 - import/order internal milestone May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants