-
-
Notifications
You must be signed in to change notification settings - Fork 30
Add rule prefer-object-rule
#101
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
Add rule prefer-object-rule
#101
Conversation
create(context) { | ||
return { Program() { context.report() } }; | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a duplicate example of the above.
|
||
module.exports = (context) => { | ||
return { Program() { context.report() } }; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally wouldn't bother showing multiple ways of defining the same function or object. A single function (incorrect) example and a single object (correct) example get the idea across. But up to you.
return { Program() { context.report() } }; | ||
}, | ||
}; | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule doc could have a ## References
section which links to this doc:
Adds a simple rule to help enforce that a rule uses object style rule definitions instead of function style.
I wanted this to help me migrate a legacy codebase of ~300 rules.
This rule pairs well and help with the
require-meta-*
rules as it allows their fixers to work.Currently those rules will report an error, but not fix function style rules.