Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newline-after-import will break when there is an export right after an import #2063

Closed
carlosnakane opened this issue May 14, 2021 · 5 comments

Comments

@carlosnakane
Copy link

carlosnakane commented May 14, 2021

Hello,
We found a bug when exporting right after importing like this:

import stub from './stub';

export {
    stub
}

It throws:

Oops! Something went wrong! :(

ESLint: 7.26.0

TypeError: Cannot read property 'type' of null
Occurred while linting C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\src\index.ts:1
    at isExportNameClass (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint-plugin-import\lib\rules\newline-after-import.js:51:69)
    at checkForNewLine (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint-plugin-import\lib\rules\newline-after-import.js:79:45)
    at checkImport (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint-plugin-import\lib\rules\newline-after-import.js:133:9)
    at C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint\lib\linter\node-event-generator.js:256:26)
    at NodeEventGenerator.applySelectors (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint\lib\linter\node-event-generator.js:285:22)
    at NodeEventGenerator.enterNode (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint\lib\linter\node-event-generator.js:299:14)
    at CodePathAnalyzer.enterNode (C:\Users\carlos.nakane\_repos\_temp\tp\eslint-plugin-import-bug-report\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:711:23)

The problem occurs when using eslint-import-plugin 2.23.0
It was fine when I was using 2.22.1

I created a repo to reproduce the problem https://github.com/carlosnakane/eslint-plugin-import-bug-report

@annguyen-dev
Copy link

The issue is still remaining. Why was it closed?

@ljharb
Copy link
Member

ljharb commented May 15, 2021

@annguyen-dev issues everywhere on GitHub are closed when the fix lands, not when the fix is released. The next release - which will be soon - will contain the fix.

@larshp
Copy link

larshp commented May 15, 2021

yea, also still experiencing the issue

@targos
Copy link

targos commented May 15, 2021

The last release on npm (2.23.1) doesn't contain the changes from 8d7ec17

See https://unpkg.com/browse/eslint-plugin-import@2.23.1/CHANGELOG.md and https://unpkg.com/browse/eslint-plugin-import@2.23.1/lib/rules/newline-after-import.js

@ljharb
Copy link
Member

ljharb commented May 15, 2021

@targos whoops, thanks. That will be tracked in #2077 and resolved shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants