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

Fix: don't throw if rule is in old format (fixes #6848) #6850

Merged
merged 1 commit into from Aug 9, 2016

Conversation

vitorbal
Copy link
Member

@vitorbal vitorbal commented Aug 5, 2016

What issue does this pull request address?
#6848: internal-no-invalid-meta was throwing an error when it ran on a rule in the old format.

What changes did you make? (Give an overview)
I changed internal-no-invalid-meta so it now reports a linting error when the rule is in the old format, instead of throwing an unrecognizable error.

Is there anything you'd like reviewers to focus on?
Nothing in particular.

@mention-bot
Copy link

@vitorbal, thanks for your PR! By analyzing the annotation information on this pull request, we identified @mysticatea to be a potential reviewer

@eslintbot
Copy link

LGTM

@gyandeeps
Copy link
Member

LGTM, waiting for others to review.
Also I think this should be Chore since this has no impact on users.

@platinumazure
Copy link
Member

Question: Do we want to tolerate exports assignment style? If not, should we try to lint against that in this rule?

Example:

// Header comments

// Requirements, etc.

exports.meta = {
    docs: {},
    fix: false,
    recommended: false,
    schema: []
};

exports.create = function(context) {
    // etc.
};

@platinumazure
Copy link
Member

@gyandeeps It does impact our build tooling though, so one could argue Build: as well, I think. Personally, I'm okay with Fix: since I think I've seen it used in other internal-only/build cases. But that's just my two cents.

@mysticatea
Copy link
Member

LGTM, thank you!

As the history of the file, Chore: seems to be proper.

@vitorbal
Copy link
Member Author

vitorbal commented Aug 8, 2016

@platinumazure IMO I think it would be valuable to lint against the exports assignment style you mentioned.
First, because the format suggested in the documentation is a different one, and we should maintain consistency (at least internally, if we ever expose these rules for plugins, we can revisit this).
Second, because maintaining that consistency also means the complexity of this internal rule is reduced, since we don't have to account for different "exports styles" in the rules and can cut some corners.

So I'm 👍 for linting for the correct exports format :)
Question, though: should it be a separate rule, since this one should be more focused on linting the meta property?

@ilyavolodin
Copy link
Member

This is an internal rule that should only be used on ESLint repository, while style shown by @platinumazure is valid, it's not the style we use for our rule, and will be noted during code review. So I think this rule doesn't need to check that style. If anything, we might want to create another rule that would enforce module.exports for rules to be an object and not to use multiple module.exports statements. LGTM

@ilyavolodin ilyavolodin merged commit 80789ab into eslint:master Aug 9, 2016
@vitorbal vitorbal deleted the issue6848 branch August 9, 2016 08:50
@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
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants