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

Unmatched rule names of scoped plugins. #6362

Closed
mysticatea opened this issue Jun 10, 2016 · 9 comments
Closed

Unmatched rule names of scoped plugins. #6362

mysticatea opened this issue Jun 10, 2016 · 9 comments
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
Milestone

Comments

@mysticatea
Copy link
Member

mysticatea commented Jun 10, 2016

What version of ESLint are you using?

  • v2.11.1

What parser (default, Babel-ESLint, etc.) are you using?

  • default.

Please show your full configuration:

{
    "plugins": [
        "@mysticatea/test"
    ],
    "rules": {
        "@mysticatea/test/test": "error"
    }
}

@mysticatea/test/test rule is:

    return {
        "Program": function(node) {
            context.report({
                node: node,
                message: "This is a test."
            })
        }
    }

What did you do? Please include the actual source code causing the issue.

  • eslint test.js

What did you expect to happen?

test.js
  1:1  error  This is a test  @mysticatea/test/test

✖ 1 problem (1 error, 0 warnings)

What actually happened? Please include the actual, raw output from ESLint.

test.js
  1:1  error  Definition for rule '@mysticatea/test/test' was not found  @mysticatea/test/test

✖ 1 problem (1 error, 0 warnings)

I think we should support @mysticatea/test/test form's rule specifier.
Thought?

@mysticatea mysticatea added bug ESLint is working incorrectly core Relates to ESLint's core APIs and features evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jun 10, 2016
@mysticatea mysticatea mentioned this issue Jun 11, 2016
7 tasks
@nzakas
Copy link
Member

nzakas commented Aug 3, 2016

@mysticatea I'm not sure what you're suggesting here. Can you explain some more?

@mysticatea
Copy link
Member Author

{
    "plugins": [
        "@mysticatea/test"
    ],
    "rules": {
        "@mysticatea/test/test": "error"
    }
}

I expected this "@mysticatea/test/test" to be the test rule of @mysticatea/eslint-plugin-test plugin.
But actually, ESLint throws "Rule not found" error.
"@mysticatea/eslint-plugin-test/test" throws "Rule not found" error as same.

On the other hand, "test/test" works unexpectedly for the test rule of @mysticatea/eslint-plugin-test plugin.

@mysticatea
Copy link
Member Author

My suggestion is:

  • "test/test" should pointer the test rule of eslint-plugin-test plugin.
  • "@mysticatea/test/test" should pointer the test rule of @mysticatea/eslint-plugin-test plugin.

So this may be a breaking change.

@nzakas
Copy link
Member

nzakas commented Aug 10, 2016

Oh wow, that's really bad. I agree with your suggestion. This is definitely breaking. We should try to get some feedback from the community to see how many people would be affected.

@nzakas nzakas added the breaking This change is backwards-incompatible label Aug 10, 2016
@pmcelhaney
Copy link
Contributor

I think there are two components here.

  • Non-breaking change: Make "@mystictea/test/test" find the rule.
  • Breaking change: Make "test/test" not find the rule.

You could probably go ahead and implement the non-breaking change and open another issue for the breaking change.

@platinumazure
Copy link
Member

What happens when there's an unscoped eslint-plugin-test with test rule (proper name "test/test") and a scoped eslint-plugin-test with test rule (proper name "@mysticatea/test/test", but may be found with "test/test") at the same time?

@scottnonnenberg
Copy link

I use scoped plugins and the need to drop the scope for the rule name was initially confusing. It would help people new to scoped stuff to make the rule names a bit more predictable. Maybe support both for a while in ESLint 3, then 4x could require the scope name?

@nzakas nzakas added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Aug 11, 2016
@nzakas
Copy link
Member

nzakas commented Aug 11, 2016

@pmcelhaney that's a good point, we can definitely add the correct scoped name resolution without removing the incorrect behavior, though that means naming clashes are still possible.

@platinumazure the plugin that was loaded last wins in that scenario. That's why this is a particularly nasty bug.

@scottnonnenberg Yes, this is a bug and not intentional. It's very confusing as it is.

@nzakas nzakas added the tsc agenda This issue will be discussed by ESLint's TSC at the next meeting label Aug 11, 2016
@nzakas
Copy link
Member

nzakas commented Aug 11, 2016

TSC Summary: We've uncovered a bug where scoped npm packages (such as @foo/eslint-plugin-bar) cannot have their rules configured using @foo/bar/rule and instead must use bar/rule. This is bad because it clashes with unscoped npm packages such as eslint-plugin-bar, leaving us in a situation where you cannot reliably use both plugins at the same time because the rules are occupying the same namespace. To fix this behavior would be a breaking change.

TSC Questions:

  1. Is this important enough to introduce a breaking change now?
  2. Should we do an incremental approach where we add the ability to reference scoped packages directly for a while and still allow referencing without the scope? Then we could remove the buggy behavior in a later major release.

@not-an-aardvark not-an-aardvark moved this from InProgress to Ready in v4.0.0 Mar 12, 2017
@ilyavolodin ilyavolodin moved this from Ready to Merged in v4.0.0 Apr 3, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
No open projects
v4.0.0
Merged
Development

No branches or pull requests

7 participants