转换错误...解析器插件:'decorators-legacy,decorators'

The*_*ird 5 jscodeshift

当我运行时出现以下错误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))
Run Code Online (Sandbox Code Playgroud)

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

Jam*_*and 2

第三者评论中提到的说明是正确的。
我需要babel5Compat.js使用此插件手动更新文件'decorators-legacy'

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

plugins: [
    // a list of plugins,
    'decorators-legacy',
]
Run Code Online (Sandbox Code Playgroud)