Skip to content

Instantly share code, notes, and snippets.

View ariabuckles's full-sized avatar
🍵
(boba) => <code />

Aria Buckles ariabuckles

🍵
(boba) => <code />
View GitHub Profile
@ariabuckles
ariabuckles / methods-to-class-properties.js
Last active April 19, 2019 20:30 — forked from satya164/class-properties-to-methods.js
Codemod to convert class methods to properties, and remove `.bind(this)` in JSX props
// Codemod to convert class methods to properties, and remove `.bind(this)` in JSX props.
// Doesn't support Flow annotations yet
export default function(file, api) {
const j = api.jscodeshift;
const isReactClass = p => {
const extended = p.node.superClass;
return (
extended && (
extended.type === 'MemberExpression' &&