Last active
November 7, 2019 08:55
-
-
Save leomelzer/fbce12f0f19e8c7c8cb1536a8aa961a1 to your computer and use it in GitHub Desktop.
$ jscodeshift -t removeStoryConfig.js **/*.story.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const usePlaceholder = () => ( | |
<TextField placeholder="I am a placeholder" /> | |
); | |
usePlaceholder.story = { | |
name: 'use placeholder' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const usePlaceholder = () => ( | |
<TextField placeholder="I am a placeholder" /> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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