Skip to content

Commit

Permalink
fix: enhance handling for comments after value (#14) (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jan 4, 2023
1 parent 98f6cd1 commit 0b5cfba
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "DNB Eufemia Tools",
"description": "DNB Eufemia Design System Extension",
"categories": [],
"version": "1.3.1",
"version": "1.3.2",
"publisher": "dnbexperience",
"author": "Tobias Høegh <[email protected]>",
"license": "SEE LICENSE IN LICENSE",
Expand Down
6 changes: 3 additions & 3 deletions src/rules/__tests__/handleCalc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('convert', () => {
const result = rule.convert?.convertHandler?.(text, line)

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

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

expect(result).toEqual({
documentation: "Convert 1rem to calc('small')",
documentation: "Convert `1rem` to `calc('small')`",
label: "1rem 👉 calc('small')",
px: '16px',
pxValue: 16,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/__tests__/handleSpacing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('convert', () => {
const result = rule.convert?.convertHandler?.(text, line)

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

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

expect(result).toEqual({
documentation: 'Convert 1rem to var(--spacing-small)',
documentation: 'Convert `1rem` to `var(--spacing-small)`',
label: '1rem 👉 var(--spacing-small)',
px: '16px',
pxValue: 16,
Expand Down
4 changes: 2 additions & 2 deletions src/rules/__tests__/handleValues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('convert', () => {
const result = rule.convert?.convertHandler?.(text, line)

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

expect(result).toEqual({
documentation: 'Convert -10.5rem to -168px',
documentation: 'Convert `-10.5rem` to `-168px`',
label: '-10.5rem 👉 -168px',
px: '-168px',
pxValue: -168,
Expand Down
4 changes: 2 additions & 2 deletions src/rules/handleCalc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const handleCalc = (): Rule => {
label,
documentation: localize(
'handleCalc.documentation',
`Convert {0}${unit} to {1}`,
value,
'Convert `{0}` to `{1}`',
value + unit,
toValue,
conf.rootFontSize
),
Expand Down
4 changes: 2 additions & 2 deletions src/rules/handleFontSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const handleFontSize = (): Rule => {
label,
documentation: localize(
'handleFontSize.documentation',
`Convert \`{0}${unit}\` to \`{1}\``,
fromValue,
'Convert `{0}` to `{1}`',
fromValue + unit,
toValue,
conf.rootFontSize
),
Expand Down
4 changes: 2 additions & 2 deletions src/rules/handleLineHeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const handleLineHeight = (): Rule => {
label,
documentation: localize(
'handleLineHeight.documentation',
`Convert \`{0}${unit}\` to \`{1}\``,
fromValue,
'Convert `{0}` to `{1}`',
fromValue + unit,
toValue,
conf.rootFontSize
),
Expand Down
4 changes: 2 additions & 2 deletions src/rules/handleSpacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const handleSpacing = (): Rule => {
label,
documentation: localize(
'handleSpacing.documentation',
`Convert {0}${unit} to {1}`,
value,
'Convert `{0}` to `{1}`',
value + unit,
toValue,
conf.rootFontSize
),
Expand Down
8 changes: 4 additions & 4 deletions src/rules/handleValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const handleValues = (): Rule => {
label,
documentation: localize(
'handleValues.documentation',
`Convert {0}${fromUnit} to {1}${toUnit}`,
fromValue,
toValue,
'Convert `{0}` to `{1}`',
fromValue + fromUnit,
toValue + toUnit,
conf.rootFontSize
),
}
Expand Down Expand Up @@ -66,7 +66,7 @@ export const handleValues = (): Rule => {
to: `${toValue}${toUnit}`,
documentation: localize(
'handleValues.documentation.hover',
`Equivalent to \`{0}\``,
'Equivalent to `{0}`',
toValue + toUnit,
conf.rootFontSize
),
Expand Down

0 comments on commit 0b5cfba

Please sign in to comment.