Ghost/core/test/utils/jscs-rules/disallow-object-controller.js

33 lines
978 B
JavaScript
Raw Normal View History

var assert = require('assert');
module.exports = function () {};
module.exports.prototype = {
configure: function (disallowObjectController) {
assert(
typeof disallowObjectController === 'boolean',
'disallowObjectController option requires boolean value'
);
assert(
disallowObjectController === true,
'disallowObjectController option requires true value or should be removed'
);
},
getOptionName: function () {
return 'disallowObjectController';
},
check: function (file, errors) {
var lines = file.getLines();
lines.forEach(function (line, index) {
2015-01-13 18:13:26 +03:00
var location = line.indexOf('ObjectController.extend');
if (location !== -1) {
errors.add('Ember.ObjectController is deprecated, please use Ember.Controller and access model properties directly.', index + 1, location + 1);
}
});
}
};