2017-11-05 02:09:28 +08:00
|
|
|
/**
|
2022-10-18 23:19:24 +08:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2017-11-05 02:09:28 +08:00
|
|
|
*
|
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2020-11-14 03:00:45 +08:00
|
|
|
const minimist = require('minimist');
|
2017-12-11 23:52:46 +08:00
|
|
|
const runESLint = require('../eslint');
|
2017-11-28 07:30:36 +08:00
|
|
|
|
2021-11-19 05:12:18 +08:00
|
|
|
async function main() {
|
|
|
|
|
console.log('Linting changed files...');
|
2017-11-05 02:09:28 +08:00
|
|
|
|
2021-11-19 05:12:18 +08:00
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
|
const {_, ...cliOptions} = minimist(process.argv.slice(2));
|
|
|
|
|
|
|
|
|
|
if (await runESLint({onlyChanged: true, ...cliOptions})) {
|
|
|
|
|
console.log('Lint passed for changed files.');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('Lint failed for changed files.');
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
2017-11-28 21:54:46 +08:00
|
|
|
}
|
2021-11-19 05:12:18 +08:00
|
|
|
|
|
|
|
|
main();
|