tslint-to-eslint-config
Version:
Converts your TSLint configuration to the closest reasonable ESLint equivalent.
25 lines (24 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertFileComments = void 0;
const parseFileComments_1 = require("./parseFileComments");
const replaceFileComments_1 = require("./replaceFileComments");
const convertFileComments = async (dependencies, filePath, ruleCommentsCache, ruleEquivalents) => {
const fileContent = await dependencies.fileSystem.readFile(filePath);
if (fileContent instanceof Error) {
return fileContent;
}
const comments = (0, parseFileComments_1.parseFileComments)(filePath, fileContent);
const newFileContent = (0, replaceFileComments_1.replaceFileComments)(
fileContent,
comments,
dependencies.converters,
ruleCommentsCache,
ruleEquivalents,
);
return fileContent === newFileContent
? undefined
: await dependencies.fileSystem.writeFile(filePath, newFileContent);
};
exports.convertFileComments = convertFileComments;
//# sourceMappingURL=convertFileComments.js.map