-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Mark deprecated rules as deprecated in their metadata #911
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,20 @@ describe('all rule files should be exported by the plugin', function() { | |
}); | ||
}); | ||
|
||
describe('deprecated rules', function() { | ||
it('marks all deprecated rules as deprecated', function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should just use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lol i see this in your OP now. yeah i think it might be worth it - There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
ruleFiles.forEach(function(ruleName) { | ||
var inDeprecatedRules = Boolean(plugin.deprecatedRules[ruleName]); | ||
var isDeprecated = plugin.rules[ruleName].meta.deprecated; | ||
if (inDeprecatedRules) { | ||
assert(isDeprecated, ruleName + ' metadata should mark it as deprecated'); | ||
} else { | ||
assert(!isDeprecated, ruleName + ' metadata should not mark it as deprecated'); | ||
} | ||
}); | ||
}); | ||
}); | ||
|
||
describe('configurations', function() { | ||
it('should export a \'recommended\' configuration', function() { | ||
assert(plugin.configs.recommended); | ||
|
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 seems like the
react/
prefix won't actually be there for the deprecated rules?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 don't believe it needs to be. It wasn't before -
deprecatedRules
was defined directly as:The
react/
prefix is only needed foractiveRulesConfig
, because those are used to define theall
configuration, whereasrules
anddeprecatedRules
both use the un-prefixed names.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.
That seems odd to me but I believe you that the behavior won't be changed by this PR - so while I think all the exported rule name should have the prefix, that clearly is out of scope of this PR. Thanks for clarifying!
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.
Here's the relevant code from ESLint (from https://github.com/eslint/eslint/blob/master/lib/rules.js#L54-L63):
You can see that it takes the responsibility of prefixing the plugin name.
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.
hm, that's a good point. thanks