-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(typescript-estree): forbid invalid keys in EnumMember
#11232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
42b8978
3e058d1
45cdc32
ce32bd9
f28579f
c02c756
1d81919
edcae2b
e45b631
2d56333
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
enum Foo { | ||
1n = 2 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
enum Foo { | ||
1 = 2 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,15 @@ | ||
import type { AST_NODE_TYPES } from '../../ast-node-types'; | ||
import type { BaseNode } from '../../base/BaseNode'; | ||
import type { Identifier } from '../../expression/Identifier/spec'; | ||
import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; | ||
import type { Expression } from '../../unions/Expression'; | ||
import type { | ||
PropertyNameComputed, | ||
PropertyNameNonComputed, | ||
} from '../../unions/PropertyName'; | ||
|
||
interface TSEnumMemberBase extends BaseNode { | ||
export interface TSEnumMember extends BaseNode { | ||
type: AST_NODE_TYPES.TSEnumMember; | ||
computed: boolean; | ||
id: | ||
| PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) | ||
| PropertyNameNonComputed; | ||
id: Identifier | StringLiteral; | ||
initializer: Expression | undefined; | ||
/** | ||
* @deprecated the enum member is always non-computed. | ||
*/ | ||
computed: boolean; | ||
} | ||
|
||
/** | ||
* this should only really happen in semantically invalid code (errors 1164 and 2452) | ||
* | ||
* @example | ||
* ```ts | ||
* // VALID: | ||
* enum Foo { ['a'] } | ||
* | ||
* // INVALID: | ||
* const x = 'a'; | ||
* enum Foo { [x] } | ||
* enum Bar { ['a' + 'b'] } | ||
* ``` | ||
*/ | ||
export interface TSEnumMemberComputedName extends TSEnumMemberBase { | ||
computed: true; | ||
id: PropertyNameComputed; | ||
} | ||
|
||
export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { | ||
computed: false; | ||
id: PropertyNameNonComputed; | ||
} | ||
|
||
export type TSEnumMember = | ||
| TSEnumMemberComputedName | ||
| TSEnumMemberNonComputedName; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the build script is using the published package instead of local one. I tried to use
workspace:^
, but still can't build.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be due to nx not seeing the changes to
ast-spec
?