| 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 changed files...'); |
| 15 | |
| 16 | const {_, ...cliOptions} = minimist(process.argv.slice(2)); |
| 17 | |
| 18 | if (await runESLint({onlyChanged: true, ...cliOptions})) { |
| 19 | console.log('Lint passed for changed files.'); |
| 20 | } else { |
| 21 | console.log('Lint failed for changed files.'); |
| 22 | process.exit(1); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | main(); |