1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  */
    
  7. 
    
  8. 'use strict';
    
  9. 
    
  10. const minimist = require('minimist');
    
  11. const runESLint = require('../eslint');
    
  12. 
    
  13. async function main() {
    
  14.   console.log('Linting all files...');
    
  15.   // https://circleci.com/docs/2.0/env-vars/#circleci-environment-variable-descriptions
    
  16.   if (!process.env.CI) {
    
  17.     console.log('Hint: run `yarn linc` to only lint changed files.');
    
  18.   }
    
  19. 
    
  20.   // eslint-disable-next-line no-unused-vars
    
  21.   const {_, ...cliOptions} = minimist(process.argv.slice(2));
    
  22. 
    
  23.   if (await runESLint({onlyChanged: false, ...cliOptions})) {
    
  24.     console.log('Lint passed.');
    
  25.   } else {
    
  26.     console.log('Lint failed.');
    
  27.     process.exit(1);
    
  28.   }
    
  29. }
    
  30. 
    
  31. main();