Skip to content

Commit 0b5cfba

Browse files
authored
fix: enhance handling for comments after value (#14) (#16)
1 parent 98f6cd1 commit 0b5cfba

9 files changed

Lines changed: 21 additions & 21 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "DNB Eufemia Tools",
44
"description": "DNB Eufemia Design System Extension",
55
"categories": [],
6-
"version": "1.3.1",
6+
"version": "1.3.2",
77
"publisher": "dnbexperience",
88
"author": "Tobias Høegh <tobias.hoegh@dnb.no>",
99
"license": "SEE LICENSE IN LICENSE",

src/rules/__tests__/handleCalc.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('convert', () => {
6868
const result = rule.convert?.convertHandler?.(text, line)
6969

7070
expect(result).toEqual({
71-
documentation: "Convert 10.5px to calc('x-small')",
71+
documentation: "Convert `10.5px` to `calc('x-small')`",
7272
label: "10.5px 👉 calc('x-small')",
7373
px: '10.5px',
7474
pxValue: 10.5,
@@ -88,7 +88,7 @@ describe('convert', () => {
8888

8989
expect(result).toEqual({
9090
documentation:
91-
"Convert 10.5rem to calc('xx-large', 'xx-large', 'xx-large')",
91+
"Convert `10.5rem` to `calc('xx-large', 'xx-large', 'xx-large')`",
9292
label: "10.5rem 👉 calc('xx-large', 'xx-large', 'xx-large')",
9393
px: '168px',
9494
pxValue: 168,
@@ -107,7 +107,7 @@ describe('convert', () => {
107107
const result = rule.convert?.convertHandler?.(text, line)
108108

109109
expect(result).toEqual({
110-
documentation: "Convert 1rem to calc('small')",
110+
documentation: "Convert `1rem` to `calc('small')`",
111111
label: "1rem 👉 calc('small')",
112112
px: '16px',
113113
pxValue: 16,

src/rules/__tests__/handleSpacing.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('convert', () => {
6868
const result = rule.convert?.convertHandler?.(text, line)
6969

7070
expect(result).toEqual({
71-
documentation: 'Convert 10.5px to var(--spacing-x-small)',
71+
documentation: 'Convert `10.5px` to `var(--spacing-x-small)`',
7272
label: '10.5px 👉 var(--spacing-x-small)',
7373
px: '10.5px',
7474
pxValue: 10.5,
@@ -88,7 +88,7 @@ describe('convert', () => {
8888

8989
expect(result).toEqual({
9090
documentation:
91-
'Convert 10.5rem to calc(var(--spacing-xx-large) + var(--spacing-xx-large) + var(--spacing-xx-large))',
91+
'Convert `10.5rem` to `calc(var(--spacing-xx-large) + var(--spacing-xx-large) + var(--spacing-xx-large))`',
9292
label:
9393
'10.5rem 👉 calc(var(--spacing-xx-large) + var(--spacing-xx-large) + var(--spacing-xx-large))',
9494
px: '168px',
@@ -109,7 +109,7 @@ describe('convert', () => {
109109
const result = rule.convert?.convertHandler?.(text, line)
110110

111111
expect(result).toEqual({
112-
documentation: 'Convert 1rem to var(--spacing-small)',
112+
documentation: 'Convert `1rem` to `var(--spacing-small)`',
113113
label: '1rem 👉 var(--spacing-small)',
114114
px: '16px',
115115
pxValue: 16,

src/rules/__tests__/handleValues.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('convert', () => {
6868
const result = rule.convert?.convertHandler?.(text, line)
6969

7070
expect(result).toEqual({
71-
documentation: 'Convert -168px to -10.5rem',
71+
documentation: 'Convert `-168px` to `-10.5rem`',
7272
label: '-168px 👉 -10.5rem',
7373
px: '-168px',
7474
pxValue: -168,
@@ -87,7 +87,7 @@ describe('convert', () => {
8787
const result = rule.convert?.convertHandler?.(text, line)
8888

8989
expect(result).toEqual({
90-
documentation: 'Convert -10.5rem to -168px',
90+
documentation: 'Convert `-10.5rem` to `-168px`',
9191
label: '-10.5rem 👉 -168px',
9292
px: '-168px',
9393
pxValue: -168,

src/rules/handleCalc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export const handleCalc = (): Rule => {
4141
label,
4242
documentation: localize(
4343
'handleCalc.documentation',
44-
`Convert {0}${unit} to {1}`,
45-
value,
44+
'Convert `{0}` to `{1}`',
45+
value + unit,
4646
toValue,
4747
conf.rootFontSize
4848
),

src/rules/handleFontSize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export const handleFontSize = (): Rule => {
3636
label,
3737
documentation: localize(
3838
'handleFontSize.documentation',
39-
`Convert \`{0}${unit}\` to \`{1}\``,
40-
fromValue,
39+
'Convert `{0}` to `{1}`',
40+
fromValue + unit,
4141
toValue,
4242
conf.rootFontSize
4343
),

src/rules/handleLineHeight.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export const handleLineHeight = (): Rule => {
3636
label,
3737
documentation: localize(
3838
'handleLineHeight.documentation',
39-
`Convert \`{0}${unit}\` to \`{1}\``,
40-
fromValue,
39+
'Convert `{0}` to `{1}`',
40+
fromValue + unit,
4141
toValue,
4242
conf.rootFontSize
4343
),

src/rules/handleSpacing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export const handleSpacing = (): Rule => {
4242
label,
4343
documentation: localize(
4444
'handleSpacing.documentation',
45-
`Convert {0}${unit} to {1}`,
46-
value,
45+
'Convert `{0}` to `{1}`',
46+
value + unit,
4747
toValue,
4848
conf.rootFontSize
4949
),

src/rules/handleValues.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ export const handleValues = (): Rule => {
3535
label,
3636
documentation: localize(
3737
'handleValues.documentation',
38-
`Convert {0}${fromUnit} to {1}${toUnit}`,
39-
fromValue,
40-
toValue,
38+
'Convert `{0}` to `{1}`',
39+
fromValue + fromUnit,
40+
toValue + toUnit,
4141
conf.rootFontSize
4242
),
4343
}
@@ -66,7 +66,7 @@ export const handleValues = (): Rule => {
6666
to: `${toValue}${toUnit}`,
6767
documentation: localize(
6868
'handleValues.documentation.hover',
69-
`Equivalent to \`{0}\``,
69+
'Equivalent to `{0}`',
7070
toValue + toUnit,
7171
conf.rootFontSize
7272
),

0 commit comments

Comments
 (0)