@kcws/lintstaged-config
Version:
kamontat's lintstaged config
32 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.eslint = void 0;
const cmd_1 = require("../utils/cmd");
/**
* create command with input option.
*
* @remarks
*
* Function type: {@link BaseActionFn} and
* Option type: {@link IEslintOptions}
*
* @param option - customize option
* @returns command
*
* @beta
*/
const eslint = (option) => {
var _a, _b, _c;
const args = [(0, cmd_1.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(" ");
};
exports.eslint = eslint;
//# sourceMappingURL=eslint.js.map