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

Problem with default export after update to 2.1.0 #653

Closed
adascal opened this issue Nov 4, 2016 · 13 comments
Closed

Problem with default export after update to 2.1.0 #653

adascal opened this issue Nov 4, 2016 · 13 comments

Comments

@adascal
Copy link

adascal commented Nov 4, 2016

Hi, after updating from version 2.0.1 to 2.1.0 I start getting error for code like:

export default from './Map.jsx';

Stack trace:

Node must be provided when reporting error if location is not provided
AssertionError: Node must be provided when reporting error if location is not provided
at EventEmitter.module.exports.api.report (/node_modules/eslint/lib/eslint.js:970:20)
at RuleContext.report (/node_modules/eslint/lib/rule-context.js:144:21)
at EventEmitter.Program:exit (/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js:69:19)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:188:7)
at NodeEventGenerator.leaveNode (/node_modules/eslint/lib/util/node-event-generator.js:49:22)
at CodePathAnalyzer.leaveNode (/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:628:23)
at CommentEventGenerator.leaveNode (/node_modules/eslint/lib/util/comment-event-generator.js:110:23)
at Controller.leave (/node_modules/eslint/lib/eslint.js:930:36)
at Controller.__execute (/node_modules/estraverse/estraverse.js:397:31)

@adascal adascal changed the title Problem if default export after update to 2.1.0 Problem with default export after update to 2.1.0 Nov 4, 2016
@yvele
Copy link

yvele commented Nov 4, 2016

I was going to open the exact same issue.

eslint@3.9.1 with eslint-plugin-import@2.0.1

@adascal
Copy link
Author

adascal commented Nov 4, 2016

eslint@3.9.1 with eslint-plugin-import@2.0.1 work fine for me...
Check installed module, maybe it's 2.1.0? :)

@adascal adascal closed this as completed Nov 4, 2016
@adascal adascal reopened this Nov 4, 2016
@yvele
Copy link

yvele commented Nov 4, 2016

@adascal I'm using the exact same versions as you and I'm having the same error with an index.jshaving export foo from "./foo";

@ljharb
Copy link
Member

ljharb commented Nov 4, 2016

@adascal you're using proposed syntax https://github.com/leebyron/ecmascript-export-default-from - which isn't part of the language, and is only stage 1. Are you using babel-eslint for this?

@yvele export notDefault from 'path' is in the language. export default from 'path' is not, which is what the OP is using.

@yvele
Copy link

yvele commented Nov 4, 2016

@ljharb Yep. I'm not using default but I still have the Node must be provided.. error

PS: eslint@3.9.1 with eslint-plugin-import@2.0.1

@ljharb
Copy link
Member

ljharb commented Nov 4, 2016

Ah, gotcha, thanks for clarifying.

@adascal
Copy link
Author

adascal commented Nov 4, 2016

@ljharb, yes, I'm using babel-eslint

@benmosher
Copy link
Member

Hmm, I wonder if it's a babel-eslint change... not sure what would get into that situation. Regardless, we've got a bug here. Thanks for reporting!

@r3nya
Copy link

r3nya commented Nov 6, 2016

So … We can use this way:

export { default } from './Map.jsx';

instead

export default from './Map.jsx';

cc @adascal

@Jaxenormus
Copy link

I'm still getting this issue on 2.21.2

AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided
    at assertValidNodeInfo (/usr/local/lib/node_modules/eslint/lib/linter/report-translator.js:98:9)
    at /usr/local/lib/node_modules/eslint/lib/linter/report-translator.js:311:9
    at Object.report (/usr/local/lib/node_modules/eslint/lib/linter/linter.js:917:41)
    at Program (/Users/Caleb/Desktop/Barnabus-development/main-bot/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js:265:23)
    at /usr/local/lib/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/usr/local/lib/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/usr/local/lib/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/usr/local/lib/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/usr/local/lib/node_modules/eslint/lib/linter/node-event-generator.js:297:14)

@ljharb
Copy link
Member

ljharb commented Jun 16, 2020

@CalebDelbridge can you file a new issue? it'd be great if you also provided your eslint/plugin versions, as well as the code that's causing this to crash.

@Jinwan5290
Copy link

sometime, this error maybe occured by export enum in ts file, finally I give up use enum to fix the error. but enum is a nice feature,anyone know how to change the lint rule to use enum

@yangtao00
Copy link

yangtao00 commented May 13, 2021

sometime, this error maybe occured by export enum in ts file, finally I give up use enum to fix the error. but enum is a nice feature,anyone know how to change the lint rule to use enum

@Jinwan5290
try this way

// .eslintrc.js
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['warn']

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

8 participants