-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Ensure it's safe to perform suffix-less migrations #14979
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
Ensure it's safe to perform suffix-less migrations #14979
Conversation
ecc48ad to
ac11740
Compare
1350885 to
f005932
Compare
philipp-spiess
left a comment
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! One comment about the moved printCandidate which I think should be moved back into the condition (otherwise we force every candidate through the candidate deseiralization/serialization logic.
|
|
||
| // The printCandidate function will already put the exclamation mark in the | ||
| // right place, so we just need to mark this candidate as requiring a | ||
| // migration. | ||
| return printCandidate(designSystem, candidate) |
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.
Let's move this back inside the if condition, otherwise all candidates that are not ending with an exclamation mark are force-reprinted which does seem unexpected (e.g. if we have a serialize/deserialize issue it now affects all candidates)
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.
Aha, I messed it up due to the refactor and deleted the wrong }. Fixed now!
Had incorrect location of closing `}` due to refactor. This fixes it.
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
This PR makes sure that migrations from suffix-less candidates (e.g.:
`rounded`, `blur`, `shadow`) are safe to be migrated.
In some code snippets that's not always the case.
Given the following code snippet:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur?: boolean,
rounded?: boolean,
shadow?: boolean,
]
function Star({ point: [cx, cy, dim, blur, rounded, shadow] }: { point: Star }) {
return <svg class="rounded shadow blur" filter={blur ? 'url(…)' : undefined} />
}
```
Without this change, it would result in:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur-sm?: boolean,
rounded-sm?: boolean,
shadow-sm?: boolean,
]
function Star({ point: [cx, cy, dim, blur-sm, rounded-sm, shadow-sm] }: { point: Star }) {
return <svg class="rounded-sm shadow-sm blur-sm" filter={blur-sm ? 'url(…)' : undefined} />
}
```
But with this change, it results in:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur?: boolean,
rounded?: boolean,
shadow?: boolean,
]
function Star({ point: [cx, cy, dim, blur, rounded, shadow] }: { point: Star }) {
return <svg class="rounded-sm shadow-sm blur-sm" filter={blur ? 'url(…)' : undefined} />
}
```
Notice how the classes inside the `class` attribute _are_ converted, but
the ones in the types or as part of the JavaScript code (e.g.:
`filter={blur ? 'url(…)' : undefined}`) are not.
---------
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
This PR makes sure that migrations from suffix-less candidates (e.g.:
`rounded`, `blur`, `shadow`) are safe to be migrated.
In some code snippets that's not always the case.
Given the following code snippet:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur?: boolean,
rounded?: boolean,
shadow?: boolean,
]
function Star({ point: [cx, cy, dim, blur, rounded, shadow] }: { point: Star }) {
return <svg class="rounded shadow blur" filter={blur ? 'url(…)' : undefined} />
}
```
Without this change, it would result in:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur-sm?: boolean,
rounded-sm?: boolean,
shadow-sm?: boolean,
]
function Star({ point: [cx, cy, dim, blur-sm, rounded-sm, shadow-sm] }: { point: Star }) {
return <svg class="rounded-sm shadow-sm blur-sm" filter={blur-sm ? 'url(…)' : undefined} />
}
```
But with this change, it results in:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur?: boolean,
rounded?: boolean,
shadow?: boolean,
]
function Star({ point: [cx, cy, dim, blur, rounded, shadow] }: { point: Star }) {
return <svg class="rounded-sm shadow-sm blur-sm" filter={blur ? 'url(…)' : undefined} />
}
```
Notice how the classes inside the `class` attribute _are_ converted, but
the ones in the types or as part of the JavaScript code (e.g.:
`filter={blur ? 'url(…)' : undefined}`) are not.
---------
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
This PR makes sure that migrations from suffix-less candidates (e.g.:
`rounded`, `blur`, `shadow`) are safe to be migrated.
In some code snippets that's not always the case.
Given the following code snippet:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur?: boolean,
rounded?: boolean,
shadow?: boolean,
]
function Star({ point: [cx, cy, dim, blur, rounded, shadow] }: { point: Star }) {
return <svg class="rounded shadow blur" filter={blur ? 'url(…)' : undefined} />
}
```
Without this change, it would result in:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur-sm?: boolean,
rounded-sm?: boolean,
shadow-sm?: boolean,
]
function Star({ point: [cx, cy, dim, blur-sm, rounded-sm, shadow-sm] }: { point: Star }) {
return <svg class="rounded-sm shadow-sm blur-sm" filter={blur-sm ? 'url(…)' : undefined} />
}
```
But with this change, it results in:
```tsx
type Star = [
x: number,
y: number,
dim?: boolean,
blur?: boolean,
rounded?: boolean,
shadow?: boolean,
]
function Star({ point: [cx, cy, dim, blur, rounded, shadow] }: { point: Star }) {
return <svg class="rounded-sm shadow-sm blur-sm" filter={blur ? 'url(…)' : undefined} />
}
```
Notice how the classes inside the `class` attribute _are_ converted, but
the ones in the types or as part of the JavaScript code (e.g.:
`filter={blur ? 'url(…)' : undefined}`) are not.
---------
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
This PR makes sure that migrations from suffix-less candidates (e.g.:
rounded,blur,shadow) are safe to be migrated.In some code snippets that's not always the case.
Given the following code snippet:
Without this change, it would result in:
But with this change, it results in:
Notice how the classes inside the
classattribute are converted, but the ones in the types or as part of the JavaScript code (e.g.:filter={blur ? 'url(…)' : undefined}) are not.