eslint-plugin-private-props
Version:
Assume all properties/methods that begin with an underscore are private and generate errors for unused or undeclared properties.
18 lines (16 loc) • 429 B
JavaScript
var _ = require('lodash');
const MESSAGES = {
UNDECLARED: "'%s' is undeclared",
UNUSED: "'%s' is never used",
NO_USE: "'%s' used outside of object"
};
module.exports = _.extend(_.mapValues((MESSAGES), (val, key) => key), {
get(key /*, arguments */) {
var str = MESSAGES[key];
var argsIndex = 1;
var args = arguments;
return str.replace(/%s/g, function() {
return args[argsIndex++];
});
}
});