Skip to content

Commit

Permalink
feat: pass print options to block codemod
Browse files Browse the repository at this point in the history
  • Loading branch information
Martí Malek committed Aug 29, 2023
1 parent f81d034 commit 24e4f2b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CloseIcon } from '@freenow/wave';

export const CloseIconWrapper = () => (
<CloseIcon data-testid="dismissBanner" color="var(--wave-b-color-white)" cursor="pointer" size={18} />
<CloseIcon data-testid="dismissBanner" color={'var(--wave-b-color-white)'} cursor="pointer" size={18} />
);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const GhostIcon = () => (
<svg fill="none" viewBox="0 0 16 16" width="100%">
<path d="M1 6v9h1v1h2v-1h1v-1h1v1h1v1h2v-1h1v-1h1v1h1v1h2v-1h1V6h-1V3h-1V2h-1V1h-2V0H6v1H4v1H3v1H2v3H1z" />
<path fill="var(--wave-b-color-blue-primary-1100)" d="M5 7h1v3H5zm5 0h1v3h-1z" />
<path fill="var(--wave-b-color-white)" d="M5 6h1v1H5zm5 0h1v1h-1z" />
<path fill={'var(--wave-b-color-blue-primary-1100)'} d="M5 7h1v3H5zm5 0h1v3h-1z" />
<path fill={'var(--wave-b-color-white)'} d="M5 6h1v1H5zm5 0h1v1h-1z" />
</svg>
);
6 changes: 4 additions & 2 deletions src/codemods/block-to-width-100.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { API, FileInfo } from 'jscodeshift';
import { Options } from 'recast';

module.exports = (file: FileInfo, api: API) => {
module.exports = (file: FileInfo, api: API, options: Options) => {
const j = api.jscodeshift;
const ast = j(file.source);
const printOptions = options ?? { quote: 'single' };

const localButtonNames = [];

Expand Down Expand Up @@ -53,5 +55,5 @@ module.exports = (file: FileInfo, api: API) => {
});
});

return ast.toSource({ quote: 'single' });
return ast.toSource(printOptions);
};

0 comments on commit 24e4f2b

Please sign in to comment.