tslint-to-eslint-config
Version:
Converts your TSLint configuration to the closest reasonable ESLint equivalent.
21 lines (20 loc) • 971 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertEditorConfig = void 0;
/**
* @see /docs/Editors.md for documentation.
*/
const convertEditorConfig = async (dependencies, converter, requestedPath, settings) => {
// 3a. The requested path's contents are read from disk.
const originalFileContents = await dependencies.fileSystem.readFile(requestedPath);
if (originalFileContents instanceof Error) {
return originalFileContents;
}
// 3b. That converter function is run on the file path.
const conversion = converter(originalFileContents, settings);
// 3c. If no error occurred, the description of changed settings is reported.
const error = await dependencies.fileSystem.writeFile(requestedPath, conversion.contents);
return error !== null && error !== void 0 ? error : conversion;
};
exports.convertEditorConfig = convertEditorConfig;
//# sourceMappingURL=convertEditorConfig.js.map