You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
3.2 KiB
29 lines
3.2 KiB
2 years ago
|
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
||
|
|
||
|
module.exports = {
|
||
|
meta: {
|
||
|
type: 'suggestion',
|
||
|
docs: {
|
||
|
url: (0, _docsUrl2['default'])('no-named-default') },
|
||
|
|
||
|
schema: [] },
|
||
|
|
||
|
|
||
|
create: function () {function create(context) {
|
||
|
return {
|
||
|
'ImportDeclaration': function () {function ImportDeclaration(node) {
|
||
|
node.specifiers.forEach(function (im) {
|
||
|
if (im.importKind === 'type' || im.importKind === 'typeof') {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (im.type === 'ImportSpecifier' && (im.imported.name || im.imported.value) === 'default') {
|
||
|
context.report({
|
||
|
node: im.local,
|
||
|
message: 'Use default import syntax to import \'' + String(im.local.name) + '\'.' });
|
||
|
}
|
||
|
});
|
||
|
}return ImportDeclaration;}() };
|
||
|
|
||
|
}return create;}() };
|
||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0Iiwibm9kZSIsInNwZWNpZmllcnMiLCJmb3JFYWNoIiwiaW0iLCJpbXBvcnRLaW5kIiwiaW1wb3J0ZWQiLCJuYW1lIiwidmFsdWUiLCJyZXBvcnQiLCJsb2NhbCIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiJhQUFBLHFDOztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFB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