loose-ts-check
Version:
Run TS type-check and ignore certain errors in some files
25 lines (24 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readConfig = void 0;
const chalk_1 = require("chalk");
const readConfig = ({ readJSONArray, log, cliOptions, }) => {
const ignoredErrorCodesArray = readJSONArray(cliOptions['ignored-error-codes'], cliOptions.init);
const looselyTypeCheckedFilePathsArray = readJSONArray(cliOptions['loosely-type-checked-files'], cliOptions.init);
if (!Array.isArray(ignoredErrorCodesArray) ||
!Array.isArray(looselyTypeCheckedFilePathsArray)) {
if (ignoredErrorCodesArray instanceof Error) {
log(ignoredErrorCodesArray.message);
}
if (looselyTypeCheckedFilePathsArray instanceof Error) {
log(looselyTypeCheckedFilePathsArray.message);
}
log((0, chalk_1.yellow)('Either fix the files or pass the --init option'));
return;
}
return {
ignoredErrorCodesArray,
looselyTypeCheckedFilePathsArray,
};
};
exports.readConfig = readConfig;