4

运行时出现以下错误jscodeshift -t ./react-codemod/transforms/React-PropTypes-to-prop-types.js ./src

Transformation error (This experimental syntax requires enabling one of the following parser plugin(s): 'decorators-legacy, decorators' (13:0))

我用谷歌搜索了一下,发现我必须设置--parser-configjscodeshift。我需要一个可以解决上述错误的示例 json 文件的帮助。

4

1 回答 1

2

The Third 在评论中提到的说明是正确的。
我需要用这个插件手动更新babel5Compat.js文件。'decorators-legacy'

// in ./node_modules/jscodeshift/parser/babel5Compat.js

plugins: [
    // a list of plugins,
    'decorators-legacy',
]
于 2021-03-03T15:54:53.320 回答