tslint-to-eslint-config
Version:
Converts your TSLint configuration to the closest reasonable ESLint equivalent.
31 lines • 956 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findReportedConfiguration = void 0;
const utils_1 = require("../utils");
const findReportedConfiguration = async (exec, command, config) => {
const fullCommand = `${command} "${config}"`;
const stdout = await execAndCatch(exec, fullCommand);
if (stdout instanceof Error) {
return stdout;
}
try {
return JSON.parse(stdout);
}
catch (error) {
return new Error(`Error parsing configuration: ${error}`);
}
};
exports.findReportedConfiguration = findReportedConfiguration;
const execAndCatch = async (exec, fullCommand) => {
try {
const { stderr, stdout } = await exec(fullCommand);
if (stderr) {
return new Error(stderr);
}
return stdout;
}
catch (error) {
return (0, utils_1.asError)(error);
}
};
//# sourceMappingURL=findReportedConfiguration.js.map