From 453df3ff72dae3ebd1e1dcd6f965c4f251b0553c Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Fri, 13 Nov 2020 13:01:25 -0600 Subject: [PATCH] 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. --- scripts/merge-fork/replace-fork.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/merge-fork/replace-fork.js b/scripts/merge-fork/replace-fork.js index 5267d105a0..b51515643b 100644 --- a/scripts/merge-fork/replace-fork.js +++ b/scripts/merge-fork/replace-fork.js @@ -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); @@ -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) {