TL;DR: Add Flow header to all JavaScript files:
git grep -L '// @flow' -- **/*.js | xargs sed -i '' '1s|^|// @flow\n\n|'
This article goes over how to add Flow header // @flow
to JavaScript files.
Find files
Find files without // @flow
in a Git repository:
git grep -L '// @flow' -- **/*.js
To search in the src
directory:
git grep -L '// @flow' -- src/**/*.js
Insert header
Prepend // @flow
to file.js
:
sed -i '' '1s|^|// @flow\n\n|' file.js
Prepend // @flow
to files without Flow header:
git grep -L '// @flow' -- src/**/*.js | xargs sed -i '' '1s|^|// @flow\n\n|'