Skip to content

Commit

Permalink
Autofix imports when running replace-fork (facebook#20251)
Browse files Browse the repository at this point in the history
* Pass extra CLI args through to ESLint

These now work:

```
yarn run lint --fix
yarn run linc --fix
```

* Autofix imports when running replace-fork

We have a custom ESLint rule that can autofix cross-fork imports.

Usually, after running the `replace-fork` script, you need to run
`yarn lint --fix` to fix the imports.

This combines the two steps into one.
  • Loading branch information
acdlite authored and koto committed Jun 15, 2021
1 parent cefd043 commit 31d2a08
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/merge-fork/replace-fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

const {promisify} = require('util');
const glob = promisify(require('glob'));
const {spawnSync} = require('child_process');
const fs = require('fs');

const stat = promisify(fs.stat);
Expand All @@ -14,6 +15,9 @@ const copyFile = promisify(fs.copyFile);
async function main() {
const oldFilenames = await glob('packages/react-reconciler/**/*.old.js');
await Promise.all(oldFilenames.map(unforkFile));

// Use ESLint to autofix imports
spawnSync('yarn', ['linc', '--fix']);
}

async function unforkFile(oldFilename) {
Expand Down

0 comments on commit 31d2a08

Please sign in to comment.