Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/loud-sheep-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris-migrator': patch
---

Update `replace-typography-declarations` comment strategy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {toPx} from '@shopify/polaris-tokens';

import {POLARIS_MIGRATOR_COMMENT} from '../../constants';
import {
createInlineComment,
getFunctionArgs,
isNumericOperator,
isSassFunction,
Expand Down Expand Up @@ -67,11 +68,11 @@ const plugin = (options: PluginOptions = {}): Plugin => {
handlers[decl.prop]();

if (targets.some(({replaced}) => !replaced || hasNumericOperator)) {
decl.before(postcss.comment({text: POLARIS_MIGRATOR_COMMENT}));
decl.before(
postcss.comment({
text: `${decl.prop}: ${parsedValue.toString()};`,
}),
createInlineComment(POLARIS_MIGRATOR_COMMENT, {prose: true}),
);
decl.before(
createInlineComment(`${decl.prop}: ${parsedValue.toString()};`),
);
} else {
decl.value = parsedValue.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
}

.font-size {
/* LENGTHS */
// LENGTHS
font-size: 12px;
font-size: 1rem;
/* Ignore */
// Ignore
font-size: 1em;
font-size: #{1px};
/* Comment */
// Comment
font-size: 10px;
font-size: 12px + 1px;

/* FONT-SIZE FUNCTION */
// FONT-SIZE FUNCTION
font-size: font-size(caption);
font-size: font-size(caption, base);
font-size: font-size(caption, large-screen);
/* Comment */
// Comment
font-size: font-size($invalid);
font-size: font-size(caption, $invalid);
font-size: font-size();
font-size: font-size(caption, base, $too-many-args);

/* REM FUNCTION */
// REM FUNCTION
font-size: rem(12px);
font-size: rem(1rem);
/* Comment */
// Comment
font-size: rem(1em);
font-size: rem(10px);
font-size: rem($invalid);
Expand All @@ -42,44 +42,44 @@
}

.font-weight {
/* LENGTHS */
// LENGTHS
font-weight: 400;
font-weight: 700;
/* Comment */
// Comment
font-weight: 300;
font-weight: 400 + 300;

/* ALIAS */
// ALIAS
font-weight: normal;
font-weight: bold;
/* Ignore */
// Ignore
font-weight: inherit;
/* Comment */
// Comment
font-weight: bolder;
}

.font-line-height {
/* LENGTHS */
// LENGTHS
line-height: 16px;
line-height: 1rem;
/* Comment */
// Comment
line-height: 10px;

/* LINE-HEIGHT FUNCTION */
// LINE-HEIGHT FUNCTION
line-height: line-height(caption);
line-height: line-height(caption, base);
line-height: line-height(caption, large-screen);
line-height: line-height(display-x-large, base);
/* Comment */
// Comment
line-height: line-height($invalid);
line-height: line-height(caption, $invalid);
line-height: line-height();
line-height: line-height(caption, base, $too-many-args);

/* REM FUNCTION */
// REM FUNCTION
line-height: rem(16px);
line-height: rem(1rem);
/* Comment */
// Comment
line-height: rem(1em);
line-height: rem(10px);
line-height: rem($invalid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,151 +6,151 @@
}

.font-size {
/* LENGTHS */
// LENGTHS
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-200);
/* Ignore */
// Ignore
font-size: 1em;
font-size: #{1px};
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: 10px; */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: 10px;
font-size: 10px;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: var(--p-font-size-75) + 1px; */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: var(--p-font-size-75) + 1px;
font-size: 12px + 1px;

/* FONT-SIZE FUNCTION */
// FONT-SIZE FUNCTION
font-size: 0.8125rem;
font-size: 0.8125rem;
font-size: var(--p-font-size-75);
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: font-size($invalid); */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: font-size($invalid);
font-size: font-size($invalid);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: font-size(caption, $invalid); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: font-size(caption, $invalid);
font-size: font-size(caption, $invalid);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: font-size(); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: font-size();
font-size: font-size();
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: font-size(caption, base, $too-many-args); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: font-size(caption, base, $too-many-args);
font-size: font-size(caption, base, $too-many-args);

/* REM FUNCTION */
// REM FUNCTION
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-200);
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: rem(1em); */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: rem(1em);
font-size: rem(1em);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: rem(10px); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: rem(10px);
font-size: rem(10px);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: rem($invalid); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: rem($invalid);
font-size: rem($invalid);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: rem(); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: rem();
font-size: rem();
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: rem(var(--p-font-size-75), $too-many-args); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: rem(var(--p-font-size-75), $too-many-args);
font-size: rem(12px, $too-many-args);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: var(--p-font-size-75) 1px; */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: var(--p-font-size-75) 1px;
font-size: rem(12px) 1px;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: rem(1px) var(--p-font-size-75); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: rem(1px) var(--p-font-size-75);
font-size: rem(1px) 12px;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: rem(#{10px + 2px}) var(--p-font-size-75); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: rem(#{10px + 2px}) var(--p-font-size-75);
font-size: rem(#{10px + 2px}) 12px;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-size: var(--p-font-size-75) + #{10px + 2px}; */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-size: var(--p-font-size-75) + #{10px + 2px};
font-size: rem(12px) + #{10px + 2px};
}

.font-weight {
/* LENGTHS */
// LENGTHS
font-weight: var(--p-font-weight-regular);
font-weight: var(--p-font-weight-bold);
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-weight: 300; */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-weight: 300;
font-weight: 300;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-weight: var(--p-font-weight-regular) + 300; */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-weight: var(--p-font-weight-regular) + 300;
font-weight: 400 + 300;

/* ALIAS */
// ALIAS
font-weight: var(--p-font-weight-regular);
font-weight: var(--p-font-weight-bold);
/* Ignore */
// Ignore
font-weight: inherit;
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* font-weight: bolder; */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// font-weight: bolder;
font-weight: bolder;
}

.font-line-height {
/* LENGTHS */
// LENGTHS
line-height: var(--p-font-line-height-1);
line-height: var(--p-font-line-height-1);
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: 10px; */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: 10px;
line-height: 10px;

/* LINE-HEIGHT FUNCTION */
// LINE-HEIGHT FUNCTION
line-height: var(--p-font-line-height-2);
line-height: var(--p-font-line-height-2);
line-height: var(--p-font-line-height-1);
line-height: 2.25rem;
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: line-height($invalid); */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: line-height($invalid);
line-height: line-height($invalid);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: line-height(caption, $invalid); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: line-height(caption, $invalid);
line-height: line-height(caption, $invalid);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: line-height(); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: line-height();
line-height: line-height();
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: line-height(caption, base, $too-many-args); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: line-height(caption, base, $too-many-args);
line-height: line-height(caption, base, $too-many-args);

/* REM FUNCTION */
// REM FUNCTION
line-height: var(--p-font-line-height-1);
line-height: var(--p-font-line-height-1);
/* Comment */
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: rem(1em); */
// Comment
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: rem(1em);
line-height: rem(1em);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: rem(10px); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: rem(10px);
line-height: rem(10px);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: rem($invalid); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: rem($invalid);
line-height: rem($invalid);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: rem(); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: rem();
line-height: rem();
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: rem(var(--p-font-line-height-1), $too-many-args); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: rem(var(--p-font-line-height-1), $too-many-args);
line-height: rem(16px, $too-many-args);
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: var(--p-font-line-height-1) 1px; */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: var(--p-font-line-height-1) 1px;
line-height: rem(16px) 1px;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: rem(1px) var(--p-font-line-height-1); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: rem(1px) var(--p-font-line-height-1);
line-height: rem(1px) 16px;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: rem(#{10px + 6px}) var(--p-font-line-height-1); */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: rem(#{10px + 6px}) var(--p-font-line-height-1);
line-height: rem(#{10px + 6px}) 16px;
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
/* line-height: var(--p-font-line-height-1) + #{10px + 6px}; */
// polaris-migrator: Unable to migrate the following expression. Please upgrade manually.
// line-height: var(--p-font-line-height-1) + #{10px + 6px};
line-height: rem(16px) + #{10px + 6px};
}
Loading