Skip to content

Instantly share code, notes, and snippets.

@leomelzer
Last active November 7, 2019 08:55
Show Gist options
  • Save leomelzer/fbce12f0f19e8c7c8cb1536a8aa961a1 to your computer and use it in GitHub Desktop.
Save leomelzer/fbce12f0f19e8c7c8cb1536a8aa961a1 to your computer and use it in GitHub Desktop.
$ jscodeshift -t removeStoryConfig.js **/*.story.js
export const usePlaceholder = () => (
<TextField placeholder="I am a placeholder" />
);
usePlaceholder.story = {
name: 'use placeholder'
};
export const usePlaceholder = () => (
<TextField placeholder="I am a placeholder" />
);
/**
* @param {import('@types/jscodeshift').FileInfo} fileInfo
* @param {import('@types/jscodeshift').API} api
*/
module.exports = function(fileInfo, api) {
return api
.jscodeshift(fileInfo.source)
.find(api.jscodeshift.MemberExpression)
.filter(path => path.value.property.name === 'story')
.forEach(path => {
api.jscodeshift(path.parent).remove();
})
.toSource({ quote: 'single' });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment