Skip to content

Support export = TypeScript syntax #1818

@AndrewLeedham

Description

@AndrewLeedham

When using the TypeScript syntax export = function name() {} I get the following error:

TypeError: Cannot read property 'name' of undefined
Occurred while linting *redacted*/rollup-plugin-strip-exports/source/__tests__/options.test.ts:1
    at *redacted*/rollup-plugin-strip-exports/node_modules/eslint-plugin-import/lib/ExportMap.js:599:70
    at Array.forEach (<anonymous>)
    at Function.ExportMap.parse (*redacted*/rollup-plugin-strip-exports/node_modules/eslint-plugin-import/lib/ExportMap.js:508:12)
    at Function.ExportMap.for (*redacted*/rollup-plugin-strip-exports/node_modules/eslint-plugin-import/lib/ExportMap.js:369:25)
    at Function.ExportMap.get (*redacted*/rollup-plugin-strip-exports/node_modules/eslint-plugin-import/lib/ExportMap.js:324:23)
    at processBodyStatement (*redacted*/rollup-plugin-strip-exports/node_modules/eslint-plugin-import/lib/rules/namespace.js:67:47)
    at Array.forEach (<anonymous>)
    at Program (*redacted*/rollup-plugin-strip-exports/node_modules/eslint-plugin-import/lib/rules/namespace.js:96:14)
    at *redacted*/rollup-plugin-strip-exports/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)

Swapping the code from export = function name() {} to export default function name() {} resolves the issue, so it seems the plugin is not accounting for the export = syntax.

Using [email protected] with [email protected] and @typescript-eslint/[email protected]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions