fix: import/order named not working with spread operator#3146
fix: import/order named not working with spread operator#3146UnderKoen wants to merge 2 commits intoimport-js:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3146 +/- ##
==========================================
- Coverage 95.59% 95.17% -0.42%
==========================================
Files 83 83
Lines 3629 3630 +1
Branches 1282 1283 +1
==========================================
- Hits 3469 3455 -14
- Misses 160 175 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
We should only do this if node's cjs-module-lexer also recognizes it. Let's discuss in the issue. |
| test({ | ||
| options: [ | ||
| { | ||
| named: true, | ||
| }, | ||
| ], | ||
| code: ` | ||
| const test = { | ||
| a: 1, | ||
| browser: 2, | ||
| }; | ||
|
|
||
| module.exports = { | ||
| ...test, | ||
| platform: 'node', | ||
| }; | ||
| `, |
There was a problem hiding this comment.
i'd like to also include a test that demonstrates that we only recognize platform as a named export from this file.
There was a problem hiding this comment.
Im not that familiar with this codebase. How could I test this?
There was a problem hiding this comment.
you'd want to make a fixture file with this test code in it, and then make two test cases that import this test file - one that imports platform and works, and one that imports a and/or browser and fails.
There was a problem hiding this comment.
Im very sorry but can't figure it out. I added the cases but it doesn't fail? I suspect that I'm doing something wrong but cant figure out what.
There was a problem hiding this comment.
Can you push up what you have? I'll take a look.
There was a problem hiding this comment.
I tried looking at #3032 as it had fixture files I believe
Fixes #3145