Skip to content

Commit a888caa

Browse files
committed
Minor tweak
1 parent 49f94a7 commit a888caa

File tree

5 files changed

+12
-46
lines changed

5 files changed

+12
-46
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import globals from 'globals';
66
import tseslint from 'typescript-eslint';
77

88
export default tseslint.config(
9-
{ ignores: ['coverage/', 'lib/', '**/.yarn/**', '**/.pnp.*'] },
9+
{ ignores: ['coverage/', 'lib/', '**/.yarn/**', '**/.pnp.*', 'dist*/'] },
1010
eslintPluginJs.configs.recommended,
1111
...tseslint.configs.recommended,
1212
eslintConfigPrettier,

prettier.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
export default {
66
singleQuote: true,
77
trailingComma: 'all',
8-
objectWrap: 'collapse',
98
};

src/angular-parser.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ function extractComments(text: string, shouldExtractComment: boolean) {
3838
}),
3939
};
4040

41-
return {
42-
text: text.slice(0, commentStart),
43-
comments: [comment],
44-
};
41+
return { text: text.slice(0, commentStart), comments: [comment] };
4542
}
4643

4744
function createAngularParseFunction<

src/transform-node.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,12 @@ class Transformer extends Source {
204204
) + 1;
205205
const tKey = quoted
206206
? createNode<babel.StringLiteral>(
207-
{
208-
type: 'StringLiteral',
209-
value: key,
210-
},
207+
{ type: 'StringLiteral', value: key },
211208
[keyStart, keyEnd],
212209
[],
213210
)
214211
: createNode<babel.Identifier>(
215-
{
216-
type: 'Identifier',
217-
name: key,
218-
},
212+
{ type: 'Identifier', name: key },
219213
[keyStart, keyEnd],
220214
[],
221215
);

src/transform-template-binding.ts

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,7 @@ class TemplateBindingTransformer extends NodeTransformer {
152152
templateBinding.value.source === lastTemplateBinding.key.source
153153
) {
154154
const alias = this.#create<NGMicrosyntaxKey>(
155-
{
156-
type: 'NGMicrosyntaxKey',
157-
name: templateBinding.key.source,
158-
},
155+
{ type: 'NGMicrosyntaxKey', name: templateBinding.key.source },
159156
templateBinding.key.span,
160157
);
161158
const updateSpanEnd = <T extends NGNode>(node: T, end: number): T => ({
@@ -164,10 +161,7 @@ class TemplateBindingTransformer extends NodeTransformer {
164161
});
165162
const updateExpressionAlias = (
166163
expression: NGMicrosyntaxExpression,
167-
) => ({
168-
...updateSpanEnd(expression, alias.end),
169-
alias,
170-
});
164+
) => ({ ...updateSpanEnd(expression, alias.end), alias });
171165

172166
const lastNode = body.pop()!;
173167

@@ -188,10 +182,7 @@ class TemplateBindingTransformer extends NodeTransformer {
188182
}
189183

190184
return this.#create<NGMicrosyntax>(
191-
{
192-
type: 'NGMicrosyntax',
193-
body,
194-
},
185+
{ type: 'NGMicrosyntax', body },
195186
body.length === 0
196187
? rawTemplateBindings[0].sourceSpan
197188
: { start: body[0].start, end: body.at(-1)!.end },
@@ -206,10 +197,7 @@ class TemplateBindingTransformer extends NodeTransformer {
206197
const { key, value } = templateBinding;
207198
if (!value) {
208199
return this.#create<NGMicrosyntaxKey>(
209-
{
210-
type: 'NGMicrosyntaxKey',
211-
name: this.#removePrefix(key.source),
212-
},
200+
{ type: 'NGMicrosyntaxKey', name: this.#removePrefix(key.source) },
213201
key.span,
214202
);
215203
} else if (index === 0) {
@@ -255,19 +243,13 @@ class TemplateBindingTransformer extends NodeTransformer {
255243
{
256244
type: 'NGMicrosyntaxLet',
257245
key: this.#create<NGMicrosyntaxKey>(
258-
{
259-
type: 'NGMicrosyntaxKey',
260-
name: key.source,
261-
},
246+
{ type: 'NGMicrosyntaxKey', name: key.source },
262247
key.span,
263248
),
264249
value: !value
265250
? null
266251
: this.#create<NGMicrosyntaxKey>(
267-
{
268-
type: 'NGMicrosyntaxKey',
269-
name: value.source,
270-
},
252+
{ type: 'NGMicrosyntaxKey', name: value.source },
271253
value.span,
272254
),
273255
},
@@ -279,17 +261,11 @@ class TemplateBindingTransformer extends NodeTransformer {
279261
{
280262
type: 'NGMicrosyntaxAs',
281263
key: this.#create<NGMicrosyntaxKey>(
282-
{
283-
type: 'NGMicrosyntaxKey',
284-
name: value!.source,
285-
},
264+
{ type: 'NGMicrosyntaxKey', name: value!.source },
286265
value!.span,
287266
),
288267
alias: this.#create<NGMicrosyntaxKey>(
289-
{
290-
type: 'NGMicrosyntaxKey',
291-
name: key.source,
292-
},
268+
{ type: 'NGMicrosyntaxKey', name: key.source },
293269
key.span,
294270
),
295271
},

0 commit comments

Comments
 (0)