odin-default-js-exercises/node_modules/eslint-plugin-import/lib/rules/no-named-default.js

22 lines
2.0 KiB
JavaScript
Raw Normal View History

2017-12-15 18:56:14 +00:00
'use strict';
module.exports = {
meta: {
docs: {}
},
create: function (context) {
return {
'ImportDeclaration': function (node) {
node.specifiers.forEach(function (im) {
if (im.type === 'ImportSpecifier' && im.imported.name === 'default') {
context.report({
node: im.local,
message: `Use default import syntax to import '${im.local.name}'.` });
}
});
}
};
}
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vLW5hbWVkLWRlZmF1bHQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwiY3JlYXRlIiwiY29udGV4dCIsIm5vZGUiLCJzcGVjaWZpZXJzIiwiZm9yRWFjaCIsImltIiwidHlwZSIsImltcG9ydGVkIiwibmFtZSIsInJlcG9ydCIsImxvY2FsIiwibWVzc2FnZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQUEsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU07QUFERixHQURTOztBQUtmQyxVQUFRLFVBQVVDLE9BQVYsRUFBbUI7QUFDekIsV0FBTztBQUNMLDJCQUFxQixVQUFVQyxJQUFWLEVBQWdCO0FBQ25DQSxhQUFLQyxVQUFMLENBQWdCQyxPQUFoQixDQUF3QixVQUFVQyxFQUFWLEVBQWM7QUFDcEMsY0FBSUEsR0FBR0MsSUFBSCxLQUFZLGlCQUFaLElBQWlDRCxHQUFHRSxRQUFILENBQVlDLElBQVosS0FBcUIsU0FBMUQsRUFBcUU7QUFDbkVQLG9CQUFRUSxNQUFSLENBQWU7QUFDYlAsb0JBQU1HLEdBQUdLLEtBREk7QUFFYkMsdUJBQVUsd0NBQXVDTixHQUFHSyxLQUFILENBQVNGLElBQUssSUFGbEQsRUFBZjtBQUdEO0FBQ0YsU0FORDtBQU9EO0F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