Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 756 Bytes

README.md

File metadata and controls

52 lines (44 loc) · 756 Bytes

ToNamedParameter Codemod

transform

export const defineTest = (
  dirName,
  transformName,
  options,
  testFilePrefix,
  only = false,
) => {
  console.log('ok')
}

to

export const defineTest = ({
  dirName,
  transformName,
  options,
  testFilePrefix,
  only = false,
}) => {
  console.log('ok')
}

Config

module.exports = {
  // function call name
  callee: 'defineTest',
  // list of all parameters
  parameters: [
    'dirName',
    'transformName',
    'options',
    'testFilePrefix',
    'only',
  ],
}

Usage

find packages/codemod/src -iname '*.spec.ts' -print | xargs jscodeshift -t packages/codemod/src/toNamedParameters/ToNamedParameters.ts --config toNamed.codemod.config.js