How to use the eslint-module-utils/ExportMap.get function in eslint-module-utils

To help you get started, we’ve selected a few eslint-module-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benmosher / eslint-plugin-import / src / rules / namespace.js View on Github external
'ExportNamespaceSpecifier': function (namespace) {
      var declaration = importDeclaration(context)

      var imports = Exports.get(declaration.source.value, context)
      if (imports == null) return null

      if (imports.errors.length) {
        imports.reportErrors(context, declaration)
        return
      }

      if (!imports.size) {
        context.report(namespace,
          `No exported names found in module '${declaration.source.value}'.`)
      }
    },
github benmosher / eslint-plugin-import / src / rules / namespace.js View on Github external
function processBodyStatement(declaration) {
        if (declaration.type !== 'ImportDeclaration') return

        if (declaration.specifiers.length === 0) return

        const imports = Exports.get(declaration.source.value, context)
        if (imports == null) return null

        if (imports.errors.length) {
          imports.reportErrors(context, declaration)
          return
        }

        for (let specifier of declaration.specifiers) {
          switch (specifier.type) {
            case 'ImportNamespaceSpecifier':
              if (!imports.size) {
                context.report(specifier,
                  `No exported names found in module '${declaration.source.value}'.`)
              }
              namespaces.set(specifier.local.name, imports)
              break