Skip to content

Commit

Permalink
fix no-underscore-dangle (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya authored and Josh Goldberg committed Dec 21, 2019
1 parent 82646aa commit b7c0868
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/rules/converters/tests/variable-name.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ describe(convertVariableName, () => {
},
{
notices: [IgnoreLeadingTrailingIdentifierMsg],
ruleArguments: ["off"],
ruleName: "no-underscore-dangle",
ruleSeverity: "off",
},
{
ruleName: "id-blacklist",
Expand All @@ -224,8 +224,8 @@ describe(convertVariableName, () => {
},
{
notices: [IgnoreLeadingTrailingIdentifierMsg],
ruleArguments: ["off"],
ruleName: "no-underscore-dangle",
ruleSeverity: "off",
},
{
ruleName: "id-blacklist",
Expand Down Expand Up @@ -254,8 +254,8 @@ describe(convertVariableName, () => {
},
{
notices: [IgnoreLeadingTrailingIdentifierMsg],
ruleArguments: ["off"],
ruleName: "no-underscore-dangle",
ruleSeverity: "off",
},
{
ruleName: "id-blacklist",
Expand Down Expand Up @@ -288,8 +288,8 @@ describe(convertVariableName, () => {
},
{
ruleName: "no-underscore-dangle",
ruleArguments: ["off"],
notices: [IgnoreLeadingTrailingIdentifierMsg],
ruleSeverity: "off",
},
{
ruleName: "id-blacklist",
Expand Down
8 changes: 4 additions & 4 deletions src/rules/converters/variable-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ export const convertVariableName: RuleConverter = tslintRule => {
};

const getUnderscoreDangleRuleOptions = () => {
const underscoreDangleOptionArguments: string[] = [];
let underscoreDangleOptionSeverity: string | null = null;
const underscoreDangleOptionNotice: string[] = [];

if (hasCheckFormat && (allowedLeadingUnderscore || allowedTrailingUnderscore)) {
underscoreDangleOptionArguments.push("off");
underscoreDangleOptionSeverity = "off";
underscoreDangleOptionNotice.push(IgnoreLeadingTrailingIdentifierMsg);
} else {
underscoreDangleOptionNotice.push(ForbiddenLeadingTrailingIdentifierMsg);
}

return {
notices: underscoreDangleOptionNotice,
...(underscoreDangleOptionArguments.length !== 0 && {
ruleArguments: underscoreDangleOptionArguments,
...(underscoreDangleOptionSeverity !== null && {
ruleSeverity: underscoreDangleOptionSeverity,
}),
ruleName: "no-underscore-dangle",
};
Expand Down

0 comments on commit b7c0868

Please sign in to comment.