-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: support multiple imports of one module with multiple lines #30314
base: develop
Are you sure you want to change the base?
Conversation
|
@wenfw Could you write a test for this change? |
e.g. ``` import { a, b, c, } from 'x'; ```
@jennifer-shehane Test cases have been updated. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @wenfw. Thank you for the contribution! At first glance I am not sure exactly what this is solving. Can you add a more descriptive PR description to describe the current problem and how your solution addresses that problem?
@AtofStryker The import {
a,
b,
c,
} from 'x'; Changing it to Using the current regular expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -38,7 +55,7 @@ describe('supports every combination of import syntax in a single file', () => { | |||
}) | |||
|
|||
it('Import { export1 } from "./kitchenSink"', () => { | |||
expect(export1).to.deep.eq(export1) | |||
expect(export1).to.deep.eq('export1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(export1).to.deep.eq('export1') | |
expect(export1).to.eq('export1') |
The
.
in RegExp matches all characters except line terminators, so the following won't match:Changing it to
[^;'"]
allows it to match all characters, including\n
, except for;'"
, which resolves the issue.Using the current regular expression
/(?<=^|\s)import (.+?) from ['"](.*?)['"]/g
will cause the new test cases to fail.Additional details
Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?