-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is currently one issue with `no-undef` rule (see: gajus/eslint-plugin-flowtype#502) but I think we can proceed with this and continue with the ecosystem fixing. See: https://flow.org/en/docs/enums/ adeira-source-id: 1898e8ac4f97e8c49ef2710a1639ddd0fda86bfc
- Loading branch information
1 parent
3b2e77c
commit c4d02cf
Showing
6 changed files
with
89 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
__tests__/__fixtures__/valid-eslint-examples/flow/enums.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// @flow strict | ||
|
||
/* eslint-disable no-undef -- https://github.com/gajus/eslint-plugin-flowtype/issues/502 */ | ||
|
||
enum StatusDefault1 { | ||
Active, | ||
Paused, | ||
Off, | ||
} | ||
|
||
enum StatusDefault2 of string { | ||
Active, | ||
Paused, | ||
Off, | ||
} | ||
|
||
enum StatusString1 { | ||
Active = 'active', | ||
Paused = 'paused', | ||
Off = 'off', | ||
} | ||
|
||
enum StatusString2 of string { | ||
Active = 'active', | ||
Paused = 'paused', | ||
Off = 'off', | ||
} | ||
|
||
enum StatusNumber1 { | ||
Active = 1, | ||
Paused = 2, | ||
Off = 3, | ||
} | ||
|
||
enum StatusNumber2 of number { | ||
Active = 1, | ||
Paused = 2, | ||
Off = 3, | ||
} | ||
|
||
enum StatusBoolean1 { | ||
Active = true, | ||
Off = false, | ||
} | ||
|
||
enum StatusBoolean2 of boolean { | ||
Active = true, | ||
Off = false, | ||
} | ||
|
||
enum StatusSymbol of symbol { | ||
Active, | ||
Paused, | ||
Off, | ||
} | ||
|
||
enum StatusUnknownMembers { | ||
Active, | ||
Paused, | ||
Off, | ||
... | ||
} | ||
|
||
export const a: StatusDefault1 = StatusDefault1.Active; | ||
export const b: StatusString1 = StatusString1.Active; | ||
export const c: StatusNumber1 = StatusNumber1.Active; | ||
export const d: StatusBoolean2 = StatusBoolean2.Active; | ||
export const e: StatusSymbol = StatusSymbol.Active; | ||
export const f: StatusUnknownMembers = StatusUnknownMembers.Active; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters