Skip to content

Instantly share code, notes, and snippets.

@leomelzer
Last active Nov 7, 2019
Embed
What would you like to do?
$ 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