mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
41 lines
5.0 KiB
JavaScript
41 lines
5.0 KiB
JavaScript
|
'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-default-export') },
|
||
|
|
||
|
schema: [] },
|
||
|
|
||
|
|
||
|
create: function () {function create(context) {
|
||
|
// ignore non-modules
|
||
|
if (context.parserOptions.sourceType !== 'module') {
|
||
|
return {};
|
||
|
}
|
||
|
|
||
|
var preferNamed = 'Prefer named exports.';
|
||
|
var noAliasDefault = function () {function noAliasDefault(_ref) {var local = _ref.local;return (
|
||
|
'Do not alias `' + String(local.name) + '` as `default`. Just export ' + ('`' + String(
|
||
|
local.name) + '` itself instead.'));}return noAliasDefault;}();
|
||
|
|
||
|
return {
|
||
|
ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) {
|
||
|
context.report({ node: node, message: preferNamed });
|
||
|
}return ExportDefaultDeclaration;}(),
|
||
|
|
||
|
ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) {
|
||
|
node.specifiers.forEach(function (specifier) {
|
||
|
if (specifier.type === 'ExportDefaultSpecifier' &&
|
||
|
specifier.exported.name === 'default') {
|
||
|
context.report({ node: node, message: preferNamed });
|
||
|
} else if (specifier.type === 'ExportSpecifier' &&
|
||
|
specifier.exported.name === 'default') {
|
||
|
context.report({ node: node, message: noAliasDefault(specifier) });
|
||
|
}
|
||
|
});
|
||
|
}return ExportNamedDeclaration;}() };
|
||
|
|
||
|
}return create;}() };
|
||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kZWZhdWx0LWV4c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