Skip to content

Commit

Permalink
fix(eslint-plugin): fix no-base-to-string boolean literal check
Browse files Browse the repository at this point in the history
  • Loading branch information
duduluu committed Apr 4, 2020
1 parent 7c11bd6 commit 35537ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/eslint-plugin/src/rules/no-base-to-string.ts
Expand Up @@ -65,6 +65,10 @@ export default util.createRule({
return Usefulness.Always;
}

if (type.flags & ts.TypeFlags.BooleanLiteral) {
return Usefulness.Always;
}

if (
toString.declarations.every(
({ parent }) =>
Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-plugin/tests/rules/no-base-to-string.test.ts
Expand Up @@ -30,6 +30,10 @@ ruleTester.run('no-base-to-string', rule, {
"'text'.toString();",
'false.toString();',
`
let value = true;
value.toString();
`,
`
let value = 1;
value.toString();
`,
Expand Down

0 comments on commit 35537ad

Please sign in to comment.