'use strict';var _contextCompat = require('eslint-module-utils/contextCompat');

var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
  meta: {
    type: 'suggestion',
    docs: {
      category: 'Helpful warnings',
      description: 'Forbid the use of mutable exports with `var` or `let`.',
      url: (0, _docsUrl2['default'])('no-mutable-exports') },

    schema: [] },


  create: function () {function create(context) {
      function checkDeclaration(node) {var
        kind = node.kind;
        if (kind === 'var' || kind === 'let') {
          context.report(node, 'Exporting mutable \'' + String(kind) + '\' binding, use \'const\' instead.');
        }
      }

      /** @type {(scope: import('eslint').Scope.Scope, name: string) => void} */
      function checkDeclarationsInScope(_ref, name) {var variables = _ref.variables;
        variables.
        filter(function (variable) {return variable.name === name;}).
        forEach(function (variable) {
          variable.defs.
          filter(function (def) {return def.type === 'Variable' && def.parent;}).
          forEach(function (def) {
            checkDeclaration(def.parent);
          });
        });
      }

      return {
        /** @param {import('estree').ExportDefaultDeclaration} node */
        ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) {
            var scope = (0, _contextCompat.getScope)(context, node);

            if ('name' in node.declaration && node.declaration.name) {
              checkDeclarationsInScope(scope, node.declaration.name);
            }
          }return ExportDefaultDeclaration;}(),

        /** @param {import('estree').ExportNamedDeclaration} node */
        ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) {
            var scope = (0, _contextCompat.getScope)(context, node);

            if ('declaration' in node && node.declaration) {
              checkDeclaration(node.declaration);
            } else if (!('source' in node) || !node.source) {
              node.specifiers.forEach(function (specifier) {
                checkDeclarationsInScope(scope, specifier.local.name);
              });
            }
          }return ExportNamedDeclaration;}() };

    }return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 5052 characters]