Code Monkey home page Code Monkey logo

Comments (6)

layershifter avatar layershifter commented on June 16, 2024 1

@ivi-hamiti thanks for heads up, I made a typo in description. Updated it to contain a proper package name 👍

Direct link on NPM: https://www.npmjs.com/package/griffel-codemod-shorthands

from griffel.

layershifter avatar layershifter commented on June 16, 2024 1

@ivi-hamiti thanks, fixed in [email protected] 👍

from griffel.

ivi-hamiti avatar ivi-hamiti commented on June 16, 2024

I noticed the codemod is not published in npm, is there any support for automatic migration or has this to be done manually?

from griffel.

ivi-hamiti avatar ivi-hamiti commented on June 16, 2024

Noticed there is an issue with the following shorthands codemod migration, if the last parameter is 0 it is omitted

{
  ...shorthands.gap('4px', 0),
  ...shorthands.margin('4px', 0),
  ...shorthands.padding('4px', 0)
}

is migrated to

{
  gap: '4px',  // wrong should had been '4px 0'
  margin: '4px', // wrong should had been '4px 0'
  padding: '4px' // wrong should had been '4px 0'
}

Second problem is that shorthands.gap parameter order is wrongly migrated

{
  ...shorthands.gap('4px', '8px')
}

is migrated to

{
  gap: '4px 8px' // wrong should had been '8px 4px'
}

based on mdn gap docs the syntax of gap is

gap: <row-gap> <column-gap>

while the gap function definition has it reverse

from griffel.

layershifter avatar layershifter commented on June 16, 2024

Noticed there is an issue with the following shorthands codemod migration, if the last parameter is 0 it is omitted

I cannot reproduce this using [email protected]. Can you please check using that version?

Second problem is that shorthands.gap parameter order is wrongly migrated

Ouch, indeed. Pushed a fix and released [email protected] 👍

from griffel.

ivi-hamiti avatar ivi-hamiti commented on June 16, 2024

was able to reproduce with [email protected] but instead of string values i had tokens values

import { makeStyles, shorthands, tokens } from '@fluentui/react-components';

export const useStyles = makeStyles({
    root: {
        ...shorthands.margin(tokens.spacingVerticalM, 0),
    },
});

this is wrongly migrated to

import { makeStyles, tokens } from '@fluentui/react-components';

export const useStyles = makeStyles({
    root: {
        margin: tokens.spacingVerticalM,
    },
});

from griffel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.