@samitouri / QOS-React-2 / commits / 453df3ff72

Autofix imports when running replace-fork (#20251)

* 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.

Andrew Clark committed Nov 13, 2020 at 13:01 UTC 453df3ff72dae3ebd1e1dcd6f965c4f251b0553c
1 file changed +4
scripts/merge-fork/replace-fork.js
+4
@@ -6,6 +6,7 @@
6
7 const {promisify} = require('util');
8 const glob = promisify(require('glob'));
9 +const {spawnSync} = require('child_process');
10 const fs = require('fs');
11
12 const stat = promisify(fs.stat);
@@ -14,6 +15,9 @@ const copyFile = promisify(fs.copyFile);
15 async function main() {
16 const oldFilenames = await glob('packages/react-reconciler/**/*.old.js');
17 await Promise.all(oldFilenames.map(unforkFile));
18 +
19 + // Use ESLint to autofix imports
20 + spawnSync('yarn', ['linc', '--fix']);
21 }
22
23 async function unforkFile(oldFilename) {