UNPKG

@kcws/lintstaged-config

Version:
51 lines 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defineDefaultConfig = void 0; const actions_1 = require("../actions"); /** * A function to define default configuration for lintstaged, * So you don't have to configure each action by yourself. * * @param builder - Config.Builder * @returns same builder with default configuration * * @remarks * * Notes: This function will append default config groups, not replace it. * * @internal */ const defineDefaultConfig = (builder, custom) => { return builder .set("jsts", { regexs: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"], actionFn: files => [ (custom === null || custom === void 0 ? void 0 : custom.eslint) === false ? undefined : (0, actions_1.eslint)(Object.assign({ files, fix: true, maxWarnings: 0 }, custom === null || custom === void 0 ? void 0 : custom.eslint)), (custom === null || custom === void 0 ? void 0 : custom.jstsPrettier) === false ? undefined : (0, actions_1.prettier)(Object.assign({ fix: true, files }, custom === null || custom === void 0 ? void 0 : custom.jstsPrettier)), ].filter(v => v !== undefined), }) .set("json", { regexs: ["**/*.json"], actionFn: files => (custom === null || custom === void 0 ? void 0 : custom.jsonPrettier) === false ? [] : (0, actions_1.prettier)(Object.assign({ fix: true, files }, custom === null || custom === void 0 ? void 0 : custom.jsonPrettier)), }) .set("sh", { regexs: ["**/*.sh", "**/*.bash", "**/*.zsh"], actionFn: files => (custom === null || custom === void 0 ? void 0 : custom.shellcheck) === false ? [] : (0, actions_1.shellcheck)(Object.assign({ files }, custom === null || custom === void 0 ? void 0 : custom.shellcheck)), }) .set("yaml", { regexs: ["**/*.yaml", "**/*.yml"], actionFn: files => (custom === null || custom === void 0 ? void 0 : custom.yamllint) === false ? [] : (0, actions_1.yamllint)(Object.assign({ files }, custom === null || custom === void 0 ? void 0 : custom.yamllint)), }); }; exports.defineDefaultConfig = defineDefaultConfig; //# sourceMappingURL=default.js.map