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

import/order with named fails when exporting uses spread operator. #3145

Open
UnderKoen opened this issue Jan 17, 2025 · 5 comments · May be fixed by #3146
Open

import/order with named fails when exporting uses spread operator. #3145

UnderKoen opened this issue Jan 17, 2025 · 5 comments · May be fixed by #3146

Comments

@UnderKoen
Copy link

Rule:

'import/order': [
  'warn',
  {
    named: true,
  },
],

minimal repro case:

const test = {
  a: 1,
  browser: 2,
};

module.exports = {
  ...test,
  target: 'node',
};
@ljharb
Copy link
Member

ljharb commented Jan 17, 2025

What does native node do when importing this module into ESM? I assume it breaks cjs-module-lexer's static analysis as well?

@ljharb
Copy link
Member

ljharb commented Jan 20, 2025

By ignore, that means it won’t treat those as named imports, which would match the current behavior of this plugin?

@UnderKoen
Copy link
Author

Currently it crashes. As node.right.properties[i].key is undefined. That why there is just an truthy check added in #3146

@ljharb
Copy link
Member

ljharb commented Jan 20, 2025

aha :-) ok, i'll give that PR a review then.

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

Successfully merging a pull request may close this issue.

2 participants