eslint-plugin-lean-imports
Version:
ESLint Plugin to make sure your imports only import the bits you need
25 lines (22 loc) • 945 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (context) {
// merge rules with default
var libraries = context.options ? context.options[0] : [];
return {
ImportDeclaration: function ImportDeclaration(node) {
var index = libraries.indexOf(node.source.value);
if (index !== -1) {
context.report(node.source, "Importing the entire " + libraries[index] + " library is not permitted, please import the specific functions you need");
}
}
};
};
module.exports = exports['default']; /**
* @fileoverview Rule to enforce an entire library is not imported
* @author Matt Smith
* @author Hugo Dozois-Caouette
* @copyright 2015 Matt Smith. All rights reserved.
*/