Skip to content

Commit

Permalink
Merge branch 'main' of github.com:facebook/stylex into shorthands-border
Browse files Browse the repository at this point in the history
  • Loading branch information
mellyeliu committed Dec 20, 2024
2 parents b169237 + db00997 commit 42f44bf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/eslint-plugin/src/utils/splitShorthands.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,18 @@ export function splitSpecificShorthands(
right: 'inline-end',
};

// Apply inline transformation to directional properties
const inlineProperties = ['border-width', 'border-color', 'border-style'];
// List directional properties for later inline transform if needed
const directionalProperties = [
'border-width',
'border-color',
'border-style',
];

const longformStyle: { [key: string]: number | string } = {};

Object.entries(longform).forEach(([key, val]) => {
const newKey =
inlineProperties.includes(property) &&
directionalProperties.includes(property) &&
_preferInline &&
/-(left|right)/.test(key)
? key.replace(
Expand All @@ -212,7 +216,6 @@ export function splitSpecificShorthands(
)
: key;

// Apply the corrected value, adding spaces or stripping important if necessary
const correctedVal = addSpacesAfterCommasInParentheses(val);
longformStyle[toCamelCase(newKey)] = allowImportant
? correctedVal
Expand Down

0 comments on commit 42f44bf

Please sign in to comment.