diff --git a/src/converters/lintConfigs/rules/ruleConverter.ts b/src/converters/lintConfigs/rules/ruleConverter.ts index aab353f53..392e67903 100644 --- a/src/converters/lintConfigs/rules/ruleConverter.ts +++ b/src/converters/lintConfigs/rules/ruleConverter.ts @@ -1,4 +1,4 @@ -import { TSLintRuleOptions } from "./types"; +import { ESLintRuleSeverity, TSLintRuleOptions } from "./types"; import { ConversionError } from "../../../errors/conversionError"; /** @@ -51,4 +51,9 @@ export type ConvertedRuleChanges = { * Equivalent ESLint rule name that should be enabled. */ ruleName: string; + + /** + * Custom severity for the output rule. + */ + ruleSeverity?: ESLintRuleSeverity; }; diff --git a/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts b/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts index 2ceaa5c4c..7981d4926 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts @@ -1,4 +1,5 @@ import { RuleConverter } from "../ruleConverter"; +import { ESLintRuleSeverity } from "../types"; export const ConstRequiredForAllCapsMsg = "typescript-eslint does not enforce uppercase for const only."; @@ -57,7 +58,7 @@ export const convertVariableName: RuleConverter = (tslintRule) => { }; const getUnderscoreDangleRuleOptions = () => { - let underscoreDangleOptionSeverity: string | null = null; + let underscoreDangleOptionSeverity: ESLintRuleSeverity | undefined; const underscoreDangleOptionNotice: string[] = []; if (hasCheckFormat && (allowedLeadingUnderscore || allowedTrailingUnderscore)) { @@ -69,7 +70,7 @@ export const convertVariableName: RuleConverter = (tslintRule) => { return { notices: underscoreDangleOptionNotice, - ...(underscoreDangleOptionSeverity !== null && { + ...(underscoreDangleOptionSeverity !== undefined && { ruleSeverity: underscoreDangleOptionSeverity, }), ruleName: "no-underscore-dangle", @@ -79,16 +80,16 @@ export const convertVariableName: RuleConverter = (tslintRule) => { const getBlackListRuleOptions = () => { const blackListOptionArguments = tslintRule.ruleArguments.includes("ban-keywords") ? [ - "any", - "Number", - "number", - "String", - "string", - "Boolean", - "boolean", - "Undefined", - "undefined", - ] + "any", + "Number", + "number", + "String", + "string", + "Boolean", + "boolean", + "Undefined", + "undefined", + ] : []; return {