-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P1: [Darkside] Primitives spacing -> space migrations #3597
Conversation
🦋 Changeset detectedLatest commit: 6d19a42 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Storybook demo / Chromatic📝 Changes to review: 11b7d26ddb | 91 components | 135 stories |
@navikt/aksel/src/codemod/transforms/darkside/primitives-spacing/spacing.ts
Outdated
Show resolved
Hide resolved
|
||
path.node.specifiers.forEach((specifier) => { | ||
if ( | ||
specifier.type === "ImportSpecifier" && | ||
specifier.imported.name === name | ||
) { | ||
foundName = specifier.local | ||
? specifier.local.name | ||
: specifier.imported.name; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if we already discussed this, and I am not even sure i want it, but just in case we do --> should we add an option for default imports?
path.node.specifiers.forEach((specifier) => { | |
if ( | |
specifier.type === "ImportSpecifier" && | |
specifier.imported.name === name | |
) { | |
foundName = specifier.local | |
? specifier.local.name | |
: specifier.imported.name; | |
} | |
// Check for named imports | |
path.node.specifiers.forEach((specifier) => { | |
if ( | |
specifier.type === "ImportSpecifier" && | |
specifier.imported.name === name | |
) { | |
foundName = specifier.local | |
? specifier.local.name | |
: specifier.imported.name; | |
} | |
// Check for default imports. i.e.: | |
// import Box from "@navikt/ds-react/Box" | |
if ( | |
specifier.type === "ImportDefaultSpecifier" && | |
typeof path.node.source.value === "string" && | |
path.node.source.value.endsWith(`/${name}`) | |
) { | |
foundName = specifier.local.name; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't really found any cases where this is used, but could make sense just in case. If we add this, we will need to handle the name differently since
import * as Box from "@navikt/ds-react/Box`
leads to components being used like
<Box.Box>
Description
This is the start of various migrations for new tokens.
space
-tokenNext up will be CSS, SCSS, Less and JS token migrations from a-spacing -> a-space.
Component Checklist 📝
@navikt/core/css/config/_mappings.js
)@navikt/core/css/tokens.json
)@navikt/aksel-stylelint/src/deprecations.ts
)@navikt/core/react/src/index.ts
and@navikt/core/react/package.json
)@navikt/core/css/index.css
)<Component>: <gitmoji?> <Text>.
E.g. "Button: ✨ Add feature xyz.")