Skip to content

Commit 9a11a89

Browse files
committed
Backport warn for service-name
1 parent cb97248 commit 9a11a89

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

rules/service-name.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ function getConfig(options) {
4444
return config;
4545
}
4646

47+
/**
48+
* Used only by `ForDeprecatedBehavior()` for making sure it was run only one time
49+
* @type {boolean}
50+
*/
51+
var didWarnForDeprecatedBehavior = false;
52+
53+
/**
54+
* Warn if API is deprecated
55+
* @param {Array.<*>} options
56+
*/
57+
function warnForDeprecatedBehavior(options) {
58+
if (didWarnForDeprecatedBehavior) {
59+
return;
60+
}
61+
didWarnForDeprecatedBehavior = true;
62+
63+
var config = getConfig(options);
64+
65+
/* istanbul ignore if */
66+
if (config.oldBehavior) {
67+
// eslint-disable-next-line
68+
console.warn('The rule `angular/service-name` will be split up to different rules in the next version. Please read the docs for more information');
69+
}
70+
}
71+
4772
module.exports = {
4873
meta: {
4974
schema: [{
@@ -53,6 +78,9 @@ module.exports = {
5378
}]
5479
},
5580
create: function(context) {
81+
82+
warnForDeprecatedBehavior(context.options);
83+
5684
return {
5785

5886
CallExpression: function(node) {

0 commit comments

Comments
 (0)