1.0.0 • Published 7 years ago
change-codemod v1.0.0
change-codemod
Codemods for automated JS code maintenance.
Setup
npm installAvailable codemods
lodash-to-object-spread
TARGET=path/to/your/js/repo npm run lodash-to-object-spreadDescription
Converts non-mutating usees of _.extend and _.assignIn to use object spread syntax.
Associated lint rule
change/prefer-object-spread-to-lodash
Development
Run tests
npm testCreating a new codemod
Writing your codemod
TODO
https://astexplorer.net/ is very helpful here.
Testing your codemod
See https://github.com/facebook/jscodeshift#unit-testing
Implementing a make task for your codemod
"lodash-to-object-spread": "TRANSFORM_PATH=path/to/your/transform.js npm run codemod && TRANSFORM_PATH=path/to/another/transform.js npm run codemod"1.0.0
7 years ago