tslint-to-eslint-config
Version:
Converts your TSLint configuration to the closest reasonable ESLint equivalent.
43 lines (42 loc) • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertMaxLineLength = void 0;
const convertMaxLineLength = (tslintRule) => {
return {
rules: [
{
...collectArguments(tslintRule.ruleArguments),
ruleName: "max-len",
},
],
};
};
exports.convertMaxLineLength = convertMaxLineLength;
const collectArguments = (ruleArguments) => {
if (ruleArguments.length === 0) {
return undefined;
}
const argument = ruleArguments[0];
if (typeof argument === "number") {
return {
ruleArguments: [
{
code: argument,
},
],
};
}
return {
ruleArguments: [
{
...("check-regex" in argument && {
ignoreRegExpLiterals: !argument["check-regex"],
}),
...("check-strings" in argument && { ignoreStrings: !argument["check-strings"] }),
...("ignore-pattern" in argument && { ignorePattern: argument["ignore-pattern"] }),
...("limit" in argument && { code: argument.limit }),
},
],
};
};
//# sourceMappingURL=max-line-length.js.map