eslint-plugin-codelyzer
Version:
40 lines (39 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var create_eslint_rule_1 = require("../util/create-eslint-rule");
var selectors_1 = require("../util/selectors");
var utils_1 = require("../util/utils");
exports.RULE_NAME = 'no-inputs-metadata-property';
var METADATA_PROPERTY_NAME = 'inputs';
var STYLE_GUIDE_LINK = 'https://angular.io/styleguide#style-05-12';
exports.default = create_eslint_rule_1.createESLintRule({
name: exports.RULE_NAME,
meta: {
type: 'suggestion',
docs: {
description: "Disallows usage of the `" + METADATA_PROPERTY_NAME + "` metadata property. See more at " + STYLE_GUIDE_LINK + ".",
category: 'Best Practices',
recommended: false
},
schema: [],
messages: {
noInputsMetadataProperty: "Use @" + utils_1.AngularInnerClassDecorators.Input + " rather than the `" + METADATA_PROPERTY_NAME + "` metadata property (" + STYLE_GUIDE_LINK + ")"
}
},
defaultOptions: [],
create: function (context) {
var _a;
return _a = {},
_a[selectors_1.COMPONENT_OR_DIRECTIVE_CLASS_DECORATOR] = function (node) {
var propertyExpression = utils_1.getDecoratorPropertyValue(node, METADATA_PROPERTY_NAME);
if (!propertyExpression) {
return;
}
context.report({
node: propertyExpression.parent,
messageId: 'noInputsMetadataProperty'
});
},
_a;
}
});