Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb347c04

Browse files
authored
feat: addoptions property toImportExpression node (typescript-eslint#10255)
1 parent3f34490 commitb347c04

File tree

5 files changed

+50
-26
lines changed

5 files changed

+50
-26
lines changed

‎packages/ast-spec/src/expression/ImportExpression/spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ import type { Expression } from '../../unions/Expression';
44

55
exportinterfaceImportExpressionextendsBaseNode{
66
type:AST_NODE_TYPES.ImportExpression;
7+
/**
8+
* The attributes declared for the dynamic import.
9+
*@example
10+
* ```ts
11+
* import('mod', \{ assert: \{ type: 'json' \} \});
12+
* ```
13+
*@deprecated Replaced with {@link `options`}.
14+
*/
715
attributes:Expression|null;
16+
/**
17+
* The options bag declared for the dynamic import.
18+
*@example
19+
* ```ts
20+
* import('mod', \{ assert: \{ type: 'json' \} \});
21+
* ```
22+
*/
23+
options:Expression|null;
824
source:Expression;
925
}

‎packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎packages/typescript-estree/src/convert.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,13 +2435,21 @@ export class Converter {
24352435
'Dynamic import requires exactly one or two arguments.',
24362436
);
24372437
}
2438-
returnthis.createNode<TSESTree.ImportExpression>(node,{
2439-
type:AST_NODE_TYPES.ImportExpression,
2440-
attributes:node.arguments[1]
2441-
?this.convertChild(node.arguments[1])
2442-
:null,
2443-
source:this.convertChild(node.arguments[0]),
2444-
});
2438+
returnthis.createNode<TSESTree.ImportExpression>(
2439+
node,
2440+
this.#withDeprecatedAliasGetter(
2441+
{
2442+
type:AST_NODE_TYPES.ImportExpression,
2443+
options:node.arguments[1]
2444+
?this.convertChild(node.arguments[1])
2445+
:null,
2446+
source:this.convertChild(node.arguments[0]),
2447+
},
2448+
'attributes',
2449+
'options',
2450+
true,
2451+
),
2452+
);
24452453
}
24462454

24472455
constcallee=this.convertChild(node.expression);

‎packages/visitor-keys/src/visitor-keys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const additionalKeys: AdditionalKeys = {
175175
Identifier:['decorators','typeAnnotation'],
176176
ImportAttribute:['key','value'],
177177
ImportDeclaration:['specifiers','source','assertions'],
178-
ImportExpression:['source','attributes'],
178+
ImportExpression:['source','options'],
179179
JSXClosingFragment:[],
180180
JSXOpeningElement:['name','typeArguments','attributes'],
181181
JSXOpeningFragment:[],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp