facebook / jscodeshift

A JavaScript codemod toolkit.
https://jscodeshift.com
MIT License
9.22k stars 477 forks source link

Adding --gitignore flag #508

Closed ElonVolo closed 2 months ago

ElonVolo commented 2 years ago

Adds a --gitignore flag that uses a .gitignore file in the current working directory to force jscodeshift to abstain from transforming files that match patterns specified in the .gitignore file.

Please note that this feature is added primarily for the benefit of beginners to jscodeshift, as a way to make the enormously timesaving technique of passing a project's .gitignore file to jscodeshift easily discoverable and learnable. The idea is that when the user looks at the jscodeshift help page, "--gitignore" jumps right out at them and they immediately make the connection.

It took me a year and a half of using jscodeshift before I realized I could simply just pass .gitignore to the utiliity, and creating a new ignore file for a freshly cloned project every day is an annoyance I wouldn't wish on others.

Due to the --gitignore flag being a discoverability feature, renaming it to something generic would impede the discoverability it's trying to promote.