const { CLIEngine } = require('eslint');

const cli = new CLIEngine({});

module.exports = {
  '*.js': (files) =>
    'eslint --cache --fix --max-warnings=0 ' +
    files.filter((file) => !cli.isPathIgnored(file)).join(' '),
  'lib/**/*.js': function libFlow(files) {
    return 'yarn workspace lib flow --quiet';
  },
  'web/**/*.js': function webFlow(files) {
    return 'yarn workspace web flow --quiet';
  },
  'native/**/*.js': function nativeFlow(files) {
    return 'yarn workspace native flow --quiet';
  },
  'server/**/*.js': function serverFlow(files) {
    return 'yarn workspace server flow --quiet';
  },
};

const { CLIEngine } = require('eslint');

const cli = new CLIEngine({});

module.exports = {
  '*.js': (files) =>
    'eslint --cache --fix --max-warnings=0 ' +
    files.filter((file) => !cli.isPathIgnored(file)).join(' '),
  'lib/**/*.js': function libFlow(files) {
    return 'yarn workspace lib flow --quiet';
  },
  '{web,lib}/**/*.js': function webFlow(files) {
    return 'yarn workspace web flow --quiet';
  },
  '{native,lib}/**/*.js': function nativeFlow(files) {
    return 'yarn workspace native flow --quiet';
  },
  '{server,web,lib}/**/*.js': function serverFlow(files) {
    return 'yarn workspace server flow --quiet';
  },
};

Make sure lint-staged checks all dependent projects
Make sure lint-staged checks all dependent projects

Summary:
I noticed that `lint-staged` failed to catch an issue in D421 where an export was removed from `lib` that `server` depended on.

Running Flow in `server` would've caught it, but `lint-staged` is only set up to do that for changes in the `server` folder.

This diff updates `lint-staged` so that it runs Flow in all directories whenever something in `lib` changes. It also makes sure to run Flow in `server` when something in `web` changes.

Test Plan: Remove `threadIsWithBlockedUserOnly` from export list in `lib/shared/thread-utils.js` and make sure `lint-staged` errors

Reviewers: KatPo, palys-swm

Reviewed By: KatPo

Subscribers: zrebcu411, Adrian

Differential Revision: https://phabricator.ashoat.com/D425
