codemod-v4
codemod-v4 copied to clipboard
the way that jscodeshift read gitignore is not correct
https://github.com/facebook/jscodeshift/blob/5a6a868433d7e27104d02b1a90917adc0b47589a/src/ignoreFiles.js#L54
没有合理处理 ! negative part
function shouldIgnore(path) {
const matched = matchers.length ? mm.any(path, matchers, { dot:true }) : false;
return matched;
}
mm.any('src/index.tsx', ['**/!a.tsx','!a.tsx' ], { dot: true }) // true
@afc163 我考虑先禁用掉 gitignore 的读取,因为上面 minimatch 的规则貌似有点不太对劲,待进一步深入解决,然后我先把 .umi
等加到 ignore config 里面,
试试 https://www.npmjs.com/package/globby#globbygitignoreoptions ?
试试 https://www.npmjs.com/package/globby#globbygitignoreoptions ?
minimatch 是 jscodeshift 自己内部用的,我这边是发现他读取 gitignore 是不对的,好几个项目他把所有的 js 文件都 ignore 掉了