-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: ast-specIssues related to @typescript-eslint/ast-specIssues related to @typescript-eslint/ast-spec
Description
Before You File a Documentation Request Please Confirm You Have Done The Following...
- I have looked for existing open or closed documentation requests that match my proposal.
- I have read the FAQ and my problem is not listed.
Suggested Changes
Coming over from @sosukesuzuki's https://discord.com/channels/1026804805894672454/1088474511759917106/1189257356899520512:
- When does the generator field become true? (
)typescript-eslint/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts
Line 11 in 7246e56
generator: boolean; - Why does the id field that is always null exist? (
Response from @Josh-Cena:
- Never: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-estree/src/convert.ts#L1553
So, your two questions are actually one: why do we have useless fields on ArrowFunctionExpression?
I believe the only reason is because rules often use ArrowFunctionExpression,FunctionDeclaration,FunctionExpression as a selector, and you don't want to prevent people from querying if (func.generator)
But maybe others who are more familiar with the AST spec can say more
That's my understanding too.
Separately from #2726, let's add JSDoc comments in code? +1 that it's unclear.
Affected URL(s)
n/a (code comments)
Metadata
Metadata
Assignees
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: ast-specIssues related to @typescript-eslint/ast-specIssues related to @typescript-eslint/ast-spec