tslint-to-eslint-config
Version:
Converts your TSLint configuration to the closest reasonable ESLint equivalent.
38 lines (37 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertNoMagicNumbers = void 0;
const convertNoMagicNumbers = (tslintRule) => {
return {
rules: [
{
...collectArgumentsAndNotices(tslintRule.ruleArguments),
ruleName: "no-magic-numbers",
},
],
};
};
exports.convertNoMagicNumbers = convertNoMagicNumbers;
const collectArgumentsAndNotices = (ruleArguments) => {
if (ruleArguments.length === 0) {
return undefined;
}
if (ruleArguments.length !== 1 || typeof ruleArguments[0] === "number") {
return {
ruleArguments: [
{
ignore: ruleArguments,
},
],
};
}
return {
...("ignore-jsx" in ruleArguments[0] && {
notices: ["JSX syntax will no longer be ignored."],
}),
...("allowed-numbers" in ruleArguments[0] && {
ruleArguments: [{ ignore: ruleArguments[0]["allowed-numbers"] }],
}),
};
};
//# sourceMappingURL=no-magic-numbers.js.map