Skip to content

Commit

Permalink
feat: ignore TSEnumMember
Browse files Browse the repository at this point in the history
  • Loading branch information
edvardchen committed Sep 17, 2020
1 parent f6d3b30 commit 63ea9e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/rules/no-literal-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ module.exports = {
indicatorStack.push(true);
},
'TSLiteralType:exit': endIndicator,
TSEnumMember(node) {
// allow enum E { "a b" = 1 }
indicatorStack.push(true);
},
'TSEnumMember:exit': endIndicator,
// ─────────────────────────────────────────────────────────────────

ClassProperty(node) {
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/no-literal-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ tsTester.run('no-literal-string', rule, {
{ code: `var a: 'abc' = 'abc'` },
{ code: `var a: 'abc' | 'name' | undefined= 'abc'` },
{ code: "type T = {name: 'b'} ; var a: T = {name: 'b'}" },
{ code: "enum T {howard=1} ; var a = T['howard']" },
{ code: "enum T {howard=1, 'a b'=2} ; var a = T['howard']" },
{ code: "function Button({ t= 'name' }: {t: 'name'}){} " },
{ code: "type T ={t?:'name'|'abc'};function Button({t='name'}:T){}" },
],
Expand Down

0 comments on commit 63ea9e4

Please sign in to comment.