Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"dprint": "0.45.1",
"editorconfig": "2.0.0",
"esbuild": "0.20.2",
"eslint": "8.57.0",
"eslint": "9.2.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-mdx": "3.1.5",
"eslint-plugin-chai-expect": "3.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/esast.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('unit-d:esast', () => {
| mdast.Nodes
| TestSubject.Comment
| TestSubject.ExpressionStatement
| TestSubject.MethodProperty
| TestSubject.ShorthandProperty
| TestSubject.TemplateLiteral
>
Expand Down
4 changes: 0 additions & 4 deletions src/nodes/__tests__/property-shorthand.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ describe('unit-d:nodes/ShorthandProperty', () => {
expectTypeOf<Subject>().toHaveProperty('assignment').toEqualTypeOf<false>()
})

it('should match [computed: false]', () => {
expectTypeOf<Subject>().toHaveProperty('computed').toEqualTypeOf<false>()
})

it('should match [kind: Extract<PropertyKind, "init">]', () => {
expectTypeOf<Subject>()
.toHaveProperty('kind')
Expand Down
8 changes: 5 additions & 3 deletions src/nodes/definition-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import type {
FunctionExpression,
MethodKind,
ModifierList,
Parent
Parent,
PropertyName
} from '@flex-development/esast'

/**
Expand All @@ -38,6 +39,7 @@ interface MethodDefinition extends Parent {
* @see {@linkcode Expression}
* @see {@linkcode FunctionExpression}
* @see {@linkcode ModifierList}
* @see {@linkcode PropertyName}
*/
children:
| [
Expand All @@ -53,7 +55,7 @@ interface MethodDefinition extends Parent {
...comments: InternalComments,
value: FunctionExpression
]
| [name: Expression, ...comments: Comments, value: FunctionExpression]
| [name: PropertyName, ...comments: Comments, value: FunctionExpression]

/**
* Boolean indicating if method name is computed.
Expand Down Expand Up @@ -85,4 +87,4 @@ interface MethodDefinition extends Parent {
type: 'methodDefinition'
}

export type { MethodDefinitionData, MethodDefinition as default }
export type { MethodDefinition as default, MethodDefinitionData }
18 changes: 4 additions & 14 deletions src/nodes/expression-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import type {
Comment,
Data,
MethodProperty,
Parent,
ShorthandProperty,
SimpleProperty,
Property,
SpreadElement
} from '@flex-development/esast'

Expand All @@ -34,18 +32,10 @@ interface ObjectExpression extends Parent {
* List of children.
*
* @see {@linkcode Comment}
* @see {@linkcode MethodProperty}
* @see {@linkcode ShorthandProperty}
* @see {@linkcode SimpleProperty}
* @see {@linkcode Property}
* @see {@linkcode SpreadElement}
*/
children: (
| Comment
| MethodProperty
| ShorthandProperty
| SimpleProperty
| SpreadElement
)[]
children: (Comment | Property | SpreadElement)[]

/**
* Info from the ecosystem.
Expand All @@ -60,4 +50,4 @@ interface ObjectExpression extends Parent {
type: 'objectExpression'
}

export type { ObjectExpressionData, ObjectExpression as default }
export type { ObjectExpression as default, ObjectExpressionData }
20 changes: 5 additions & 15 deletions src/nodes/pattern-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
*/

import type {
AssignmentProperty,
Comment,
Data,
Parent,
RenamedProperty,
RestElement,
ShorthandProperty
Property,
RestElement
} from '@flex-development/esast'

/**
Expand All @@ -33,19 +31,11 @@ interface ObjectPattern extends Parent {
/**
* List of children.
*
* @see {@linkcode AssignmentProperty}
* @see {@linkcode Comment}
* @see {@linkcode RenamedProperty}
* @see {@linkcode Property}
* @see {@linkcode RestElement}
* @see {@linkcode ShorthandProperty}
*/
children: (
| AssignmentProperty
| Comment
| RenamedProperty
| RestElement
| ShorthandProperty
)[]
children: (Comment | Property | RestElement)[]

/**
* Info from the ecosystem.
Expand All @@ -60,4 +50,4 @@ interface ObjectPattern extends Parent {
type: 'objectPattern'
}

export type { ObjectPatternData, ObjectPattern as default }
export type { ObjectPattern as default, ObjectPatternData }
32 changes: 3 additions & 29 deletions src/nodes/property-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
* @module esast/nodes/MethodProperty
*/

import type { InternalComments } from '#internal'
import type {
Comments,
Expression,
FunctionExpression,
ModifierList,
Property,
PropertyName
} from '@flex-development/esast'
import type { MethodDefinition, Property } from '@flex-development/esast'

/**
* A method property.
Expand All @@ -29,27 +21,9 @@ interface MethodProperty extends Property {
/**
* List of children.
*
* @see {@linkcode Comments}
* @see {@linkcode Expression}
* @see {@linkcode FunctionExpression}
* @see {@linkcode PropertyName}
* @see {@linkcode ModifierList}
* @see {@linkcode MethodDefinition}
*/
children:
| [
...comments: Comments,
key: Expression,
...comments: InternalComments,
value: FunctionExpression
]
| [
modifiers: ModifierList,
...comments: Comments,
key: Expression,
...comments: InternalComments,
value: FunctionExpression
]
| [key: PropertyName, ...comments: Comments, value: FunctionExpression]
children: [MethodDefinition]

/**
* Boolean indicating if property value is a method.
Expand Down
13 changes: 4 additions & 9 deletions src/nodes/property-shorthand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*/

import type {
Identifier,
Property,
PropertyKind
PropertyKind,
PropertyName
} from '@flex-development/esast'

/**
Expand All @@ -25,14 +25,9 @@ interface ShorthandProperty extends Property {
/**
* List of children.
*
* @see {@linkcode Identifier}
* @see {@linkcode PropertyName}
*/
children: [key: Identifier]

/**
* Boolean indicating if property is computed.
*/
computed: false
children: [key: PropertyName]

/**
* Property kind.
Expand Down
9 changes: 2 additions & 7 deletions src/nodes/property-simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { InternalComments } from '#internal'
import type {
Comments,
Expression,
FunctionExpression,
Property,
PropertyKind,
PropertyName
Expand Down Expand Up @@ -38,13 +37,9 @@ interface SimpleProperty extends Property {
...comments: Comments,
key: Expression,
...comments: InternalComments,
value: Exclude<Expression, FunctionExpression>
]
| [
key: PropertyName,
...comments: Comments,
value: Exclude<Expression, FunctionExpression>
value: Expression
]
| [key: PropertyName, ...comments: Comments, value: Expression]

/**
* Property kind.
Expand Down
26 changes: 9 additions & 17 deletions src/nodes/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import type {
Comments,
Data,
Expression,
FunctionExpression,
Identifier,
ModifierList,
MethodDefinition,
ObjectPattern,
Parent,
PropertyKind
PropertyKind,
PropertyName
} from '@flex-development/esast'

/**
Expand Down Expand Up @@ -47,10 +46,9 @@ interface Property extends Parent {
* @see {@linkcode AssignmentPattern}
* @see {@linkcode Comments}
* @see {@linkcode Expression}
* @see {@linkcode FunctionExpression}
* @see {@linkcode Identifier}
* @see {@linkcode ModifierList}
* @see {@linkcode MethodDefinition}
* @see {@linkcode ObjectPattern}
* @see {@linkcode PropertyName}
*/
children:
| [
Expand All @@ -60,19 +58,13 @@ interface Property extends Parent {
value: ArrayPattern | AssignmentPattern | Expression | ObjectPattern
]
| [
key: Expression,
key: PropertyName,
...comments: Comments,
value: ArrayPattern | AssignmentPattern | Expression | ObjectPattern
]
| [
modifiers: ModifierList,
...comments: Comments,
key: Expression,
...comments: InternalComments,
value: FunctionExpression
]
| [assignment: AssignmentPattern]
| [key: Identifier]
| [method: MethodDefinition]
| [shorthand: PropertyName]

/**
* Boolean indicating if property is computed.
Expand Down Expand Up @@ -109,4 +101,4 @@ interface Property extends Parent {
type: 'property'
}

export type { PropertyData, Property as default }
export type { Property as default, PropertyData }
Loading