tslint-to-eslint-config
Version:
Converts your TSLint configuration to the closest reasonable ESLint equivalent.
41 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertTripleEquals = void 0;
const smartOptionNotice = 'Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.';
const convertTripleEquals = (tslintRule) => {
const getRuleOptions = () => {
if (tslintRule.ruleArguments.length !== 0 &&
tslintRule.ruleArguments[0] === "allow-null-check") {
return {
notices: [smartOptionNotice],
ruleArguments: ["smart"],
};
}
if (tslintRule.ruleArguments.length !== 0 &&
tslintRule.ruleArguments[0] === "allow-undefined-check") {
return {
notices: [
'Option "allow-undefined-check" is not supported by ESLint. Option "smart" is the closest.',
smartOptionNotice,
],
ruleArguments: ["smart"],
};
}
return {
ruleArguments: ["always"],
notices: [],
};
};
const options = getRuleOptions();
return {
rules: [
{
notices: options.notices,
ruleArguments: options.ruleArguments,
ruleName: "eqeqeq",
},
],
};
};
exports.convertTripleEquals = convertTripleEquals;
//# sourceMappingURL=triple-equals.js.map