Last active
December 1, 2017 08:41
-
-
Save perjansson/bca2ccdb968c48530466a2d949512c79 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const transformer = (file, api) => { | |
| const j = api.jscodeshift; | |
| const root = j(file.source); | |
| const multiLineArrays = path => { | |
| const { loc } = path.node; | |
| return loc.start.line < loc.end.line; | |
| } | |
| return root | |
| .find(j.ArrayExpression) | |
| .filter(multiLineArrays) | |
| .forEach(path => path.node.original = null) | |
| .toSource({ trailingComma: 1, wrapColumn: 1}); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment