@kcws/lintstaged-config
Version:
kamontat's lintstaged config
28 lines • 960 B
JavaScript
import { getCommand } from "../utils/cmd";
/**
* create command with input option.
*
* @remarks
*
* Function type: {@link BaseActionFn} and
* Option type: {@link IEslintOptions}
*
* @param option - customize option
* @returns command
*
* @beta
*/
export const eslint = (option) => {
var _a, _b, _c;
const args = [getCommand("eslint")];
if ((_a = option === null || option === void 0 ? void 0 : option.fix) !== null && _a !== void 0 ? _a : true)
args.push("--fix");
const maxWarnings = (_b = option === null || option === void 0 ? void 0 : option.maxWarnings) !== null && _b !== void 0 ? _b : 0;
if (maxWarnings >= 0)
args.push("--max-warnings", maxWarnings.toString());
const files = (_c = option === null || option === void 0 ? void 0 : option.files) !== null && _c !== void 0 ? _c : [];
if (files.length > 0)
args.push(...files);
return args.join(" ");
};
//# sourceMappingURL=eslint.js.map