@taiga-ui/eslint-plugin-experience-next 0.506.0 → 0.508.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/index.d.ts +7 -1
- package/index.esm.js +781 -584
- package/package.json +1 -1
- package/rules/recommended/decorator-key-sort.d.ts +2 -2
- package/rules/recommended/no-empty-style-metadata.d.ts +5 -0
- package/rules/recommended/prefer-conditional-return.d.ts +5 -0
- package/rules/utils/angular/get-decorator-metadata.d.ts +8 -2
- package/rules/utils/angular/is-imports-array-property.d.ts +1 -1
- package/rules/utils/sorting/get-sorted-names.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -1201,6 +1201,7 @@ var recommended = defineConfig([
|
|
|
1201
1201
|
},
|
|
1202
1202
|
],
|
|
1203
1203
|
'@taiga-ui/experience-next/no-deep-imports-to-indexed-packages': 'error',
|
|
1204
|
+
'@taiga-ui/experience-next/no-empty-style-metadata': 'error',
|
|
1204
1205
|
'@taiga-ui/experience-next/no-fully-untracked-effect': 'error',
|
|
1205
1206
|
'@taiga-ui/experience-next/no-implicit-public': 'error',
|
|
1206
1207
|
'@taiga-ui/experience-next/no-import-assertions': 'error',
|
|
@@ -1213,6 +1214,7 @@ var recommended = defineConfig([
|
|
|
1213
1214
|
'@taiga-ui/experience-next/no-useless-untracked': 'error',
|
|
1214
1215
|
'@taiga-ui/experience-next/object-single-line': ['error', { printWidth: 90 }],
|
|
1215
1216
|
'@taiga-ui/experience-next/prefer-combined-if-control-flow': 'error',
|
|
1217
|
+
'@taiga-ui/experience-next/prefer-conditional-return': 'error',
|
|
1216
1218
|
'@taiga-ui/experience-next/prefer-loose-null-check': 'error',
|
|
1217
1219
|
'@taiga-ui/experience-next/prefer-multi-arg-push': 'error',
|
|
1218
1220
|
'@taiga-ui/experience-next/prefer-namespace-keyword': 'error',
|
|
@@ -33201,10 +33203,7 @@ var VERSION = new Version("20.3.12");
|
|
|
33201
33203
|
publishFacade(_global);
|
|
33202
33204
|
|
|
33203
33205
|
function getAttributeValueSpan(attr) {
|
|
33204
|
-
|
|
33205
|
-
return attr.handlerSpan;
|
|
33206
|
-
}
|
|
33207
|
-
return attr.valueSpan;
|
|
33206
|
+
return attr instanceof dist$4.TmplAstBoundEvent ? attr.handlerSpan : attr.valueSpan;
|
|
33208
33207
|
}
|
|
33209
33208
|
function getElementAttributeLikes(element) {
|
|
33210
33209
|
const seen = new Set();
|
|
@@ -46224,7 +46223,7 @@ function buildMultilineStartTag(node, sourceText) {
|
|
|
46224
46223
|
closing,
|
|
46225
46224
|
].join('\n');
|
|
46226
46225
|
}
|
|
46227
|
-
const rule$
|
|
46226
|
+
const rule$S = createRule({
|
|
46228
46227
|
name: 'attrs-newline',
|
|
46229
46228
|
rule: {
|
|
46230
46229
|
create(context) {
|
|
@@ -46310,54 +46309,151 @@ const rule$Q = createRule({
|
|
|
46310
46309
|
},
|
|
46311
46310
|
});
|
|
46312
46311
|
|
|
46312
|
+
function isObject(node) {
|
|
46313
|
+
return node?.type === dist$2.AST_NODE_TYPES.ObjectExpression;
|
|
46314
|
+
}
|
|
46315
|
+
|
|
46316
|
+
/**
|
|
46317
|
+
* Extracts the metadata object from a class decorator such as
|
|
46318
|
+
* `@Component()`, `@Directive()`, `@NgModule()`, or `@Pipe()`.
|
|
46319
|
+
*
|
|
46320
|
+
* Returns the first argument of the decorator call *if and only if*
|
|
46321
|
+
* it is an `ObjectExpression`.
|
|
46322
|
+
*
|
|
46323
|
+
* @example
|
|
46324
|
+
* // Given:
|
|
46325
|
+
* @Component({
|
|
46326
|
+
* selector: 'x',
|
|
46327
|
+
* imports: [A, B],
|
|
46328
|
+
* })
|
|
46329
|
+
* class MyCmp {}
|
|
46330
|
+
*
|
|
46331
|
+
* // In the AST for @Component(...)
|
|
46332
|
+
* getDecoratorMetadata(decorator, allowed) returns
|
|
46333
|
+
* ObjectExpression({ selector: ..., imports: ... })
|
|
46334
|
+
*
|
|
46335
|
+
* @param decorator - The decorator node attached to a class declaration.
|
|
46336
|
+
* @param allowedNames - A set of decorator names to consider
|
|
46337
|
+
* (e.g., Component, Directive, NgModule, Pipe).
|
|
46338
|
+
*
|
|
46339
|
+
* @returns The metadata `ObjectExpression` if present and valid,
|
|
46340
|
+
* otherwise `null`.
|
|
46341
|
+
*/
|
|
46342
|
+
function getDecoratorMetadata(decorator, allowedNames) {
|
|
46343
|
+
return getDecoratorMetadataWithName(decorator, allowedNames)?.metadata ?? null;
|
|
46344
|
+
}
|
|
46345
|
+
function getDecoratorMetadataWithName(decorator, allowedNames) {
|
|
46346
|
+
const expr = decorator.expression;
|
|
46347
|
+
if (expr.type !== dist$2.AST_NODE_TYPES.CallExpression) {
|
|
46348
|
+
return null;
|
|
46349
|
+
}
|
|
46350
|
+
const callee = expr.callee;
|
|
46351
|
+
if (callee.type !== dist$2.AST_NODE_TYPES.Identifier || !allowedNames.has(callee.name)) {
|
|
46352
|
+
return null;
|
|
46353
|
+
}
|
|
46354
|
+
const arg = expr.arguments[0];
|
|
46355
|
+
return isObject(arg) ? { expression: expr, metadata: arg, name: callee.name } : null;
|
|
46356
|
+
}
|
|
46357
|
+
|
|
46358
|
+
function isStringLiteral(node) {
|
|
46359
|
+
return node?.type === dist$3.AST_NODE_TYPES.Literal && typeof node.value === 'string';
|
|
46360
|
+
}
|
|
46361
|
+
function isStaticTemplateLiteral(node) {
|
|
46362
|
+
return (node?.type === dist$3.AST_NODE_TYPES.TemplateLiteral &&
|
|
46363
|
+
node.expressions.length === 0 &&
|
|
46364
|
+
node.quasis.length === 1);
|
|
46365
|
+
}
|
|
46366
|
+
function getStaticStringValue(node) {
|
|
46367
|
+
if (isStringLiteral(node)) {
|
|
46368
|
+
return node.value;
|
|
46369
|
+
}
|
|
46370
|
+
return isStaticTemplateLiteral(node)
|
|
46371
|
+
? (node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw ?? '')
|
|
46372
|
+
: null;
|
|
46373
|
+
}
|
|
46374
|
+
function isEmptyStaticString(node) {
|
|
46375
|
+
return getStaticStringValue(node) === '';
|
|
46376
|
+
}
|
|
46377
|
+
|
|
46378
|
+
function getStaticPropertyName(key) {
|
|
46379
|
+
if (key.type === dist$3.AST_NODE_TYPES.Identifier) {
|
|
46380
|
+
return key.name;
|
|
46381
|
+
}
|
|
46382
|
+
return key.type === dist$3.AST_NODE_TYPES.Literal &&
|
|
46383
|
+
(typeof key.value === 'string' || typeof key.value === 'number')
|
|
46384
|
+
? String(key.value)
|
|
46385
|
+
: getStaticStringValue(key);
|
|
46386
|
+
}
|
|
46387
|
+
function getObjectPropertyName(node) {
|
|
46388
|
+
return node.computed ? null : getStaticPropertyName(node.key);
|
|
46389
|
+
}
|
|
46390
|
+
function getMemberExpressionPropertyName(node) {
|
|
46391
|
+
if (!node.computed && node.property.type === dist$3.AST_NODE_TYPES.Identifier) {
|
|
46392
|
+
return node.property.name;
|
|
46393
|
+
}
|
|
46394
|
+
return node.computed ? getStaticStringValue(node.property) : null;
|
|
46395
|
+
}
|
|
46396
|
+
function getClassMemberName(member) {
|
|
46397
|
+
return member.key.type === dist$3.AST_NODE_TYPES.PrivateIdentifier
|
|
46398
|
+
? null
|
|
46399
|
+
: getStaticPropertyName(member.key);
|
|
46400
|
+
}
|
|
46401
|
+
|
|
46313
46402
|
function sameOrder(a, b) {
|
|
46314
46403
|
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
46315
46404
|
}
|
|
46316
46405
|
|
|
46317
|
-
const
|
|
46318
|
-
create(context) {
|
|
46319
|
-
const
|
|
46406
|
+
const rule$R = createRule({
|
|
46407
|
+
create(context, [order]) {
|
|
46408
|
+
const decorators = new Set(Object.keys(order));
|
|
46320
46409
|
return {
|
|
46321
46410
|
ClassDeclaration(node) {
|
|
46322
|
-
const
|
|
46323
|
-
|
|
46324
|
-
|
|
46325
|
-
|
|
46326
|
-
|
|
46327
|
-
|
|
46328
|
-
|
|
46329
|
-
|
|
46330
|
-
|
|
46331
|
-
const current = properties
|
|
46332
|
-
.map((prop) => prop.key?.name)
|
|
46333
|
-
.filter(Boolean);
|
|
46334
|
-
const correct = getCorrectOrderRelative(orderList, current);
|
|
46335
|
-
if (!sameOrder(correct, current.filter((item) => correct.includes(item)))) {
|
|
46336
|
-
context.report({
|
|
46337
|
-
fix: (fixer) => {
|
|
46338
|
-
const fileContent = context.sourceCode.text;
|
|
46339
|
-
const forgottenProps = current.filter((key) => !orderList.includes(key));
|
|
46340
|
-
const sortedDecoratorProperties = [
|
|
46341
|
-
...correct,
|
|
46342
|
-
...forgottenProps,
|
|
46343
|
-
].map((key) => properties.find((prop) => prop.key.name === key));
|
|
46344
|
-
const newDecoratorArgument = `{${sortedDecoratorProperties
|
|
46345
|
-
.map(({ range }) => fileContent.slice(...range))
|
|
46346
|
-
.toString()}}`;
|
|
46347
|
-
return fixer.replaceTextRange(argument.range, newDecoratorArgument);
|
|
46348
|
-
},
|
|
46349
|
-
message: `Incorrect order keys in @${decoratorName} decorator, please sort by [${correct.join(' -> ')}]`,
|
|
46350
|
-
node: expression,
|
|
46351
|
-
});
|
|
46352
|
-
}
|
|
46353
|
-
}
|
|
46411
|
+
for (const decorator of node?.decorators ?? []) {
|
|
46412
|
+
const metadata = getDecoratorMetadataWithName(decorator, decorators);
|
|
46413
|
+
if (!metadata) {
|
|
46414
|
+
continue;
|
|
46415
|
+
}
|
|
46416
|
+
const orderList = order[metadata.name] ?? [];
|
|
46417
|
+
const properties = getDecoratorProperties(metadata.metadata);
|
|
46418
|
+
if (!properties) {
|
|
46419
|
+
continue;
|
|
46354
46420
|
}
|
|
46421
|
+
const current = properties.map(({ name }) => name);
|
|
46422
|
+
const correct = getCorrectOrderRelative(orderList, current);
|
|
46423
|
+
const sortableCurrent = current.filter((item) => correct.includes(item));
|
|
46424
|
+
if (sameOrder(correct, sortableCurrent)) {
|
|
46425
|
+
continue;
|
|
46426
|
+
}
|
|
46427
|
+
context.report({
|
|
46428
|
+
data: {
|
|
46429
|
+
decorator: metadata.name,
|
|
46430
|
+
order: correct.join(' -> '),
|
|
46431
|
+
},
|
|
46432
|
+
fix: (fixer) => {
|
|
46433
|
+
const forgottenProps = properties.filter(({ name }) => !orderList.includes(name));
|
|
46434
|
+
const sortedDecoratorProperties = [
|
|
46435
|
+
...correct.flatMap((key) => properties.filter(({ name }) => name === key)),
|
|
46436
|
+
...forgottenProps,
|
|
46437
|
+
];
|
|
46438
|
+
const newDecoratorArgument = `{${sortedDecoratorProperties
|
|
46439
|
+
.map(({ node }) => context.sourceCode.text.slice(...node.range))
|
|
46440
|
+
.join(',')}}`;
|
|
46441
|
+
return fixer.replaceTextRange(metadata.metadata.range, newDecoratorArgument);
|
|
46442
|
+
},
|
|
46443
|
+
messageId: 'incorrectOrder',
|
|
46444
|
+
node: metadata.expression,
|
|
46445
|
+
});
|
|
46355
46446
|
}
|
|
46356
46447
|
},
|
|
46357
46448
|
};
|
|
46358
46449
|
},
|
|
46359
46450
|
meta: {
|
|
46451
|
+
defaultOptions: [{}],
|
|
46452
|
+
docs: { description: 'Sorts keys of Angular decorator metadata.' },
|
|
46360
46453
|
fixable: 'code',
|
|
46454
|
+
messages: {
|
|
46455
|
+
incorrectOrder: 'Incorrect order keys in @{{decorator}} decorator, please sort by [{{order}}]',
|
|
46456
|
+
},
|
|
46361
46457
|
schema: [
|
|
46362
46458
|
{
|
|
46363
46459
|
additionalProperties: true,
|
|
@@ -46367,14 +46463,25 @@ const config$5 = {
|
|
|
46367
46463
|
],
|
|
46368
46464
|
type: 'problem',
|
|
46369
46465
|
},
|
|
46370
|
-
|
|
46466
|
+
name: 'decorator-key-sort',
|
|
46467
|
+
});
|
|
46371
46468
|
function getCorrectOrderRelative(correct, current) {
|
|
46372
46469
|
return correct.filter((item) => current.includes(item));
|
|
46373
46470
|
}
|
|
46374
|
-
|
|
46375
|
-
|
|
46376
|
-
|
|
46377
|
-
|
|
46471
|
+
function getDecoratorProperties(metadata) {
|
|
46472
|
+
const properties = [];
|
|
46473
|
+
for (const property of metadata.properties) {
|
|
46474
|
+
if (property.type !== dist$3.AST_NODE_TYPES.Property) {
|
|
46475
|
+
return null;
|
|
46476
|
+
}
|
|
46477
|
+
const name = getObjectPropertyName(property);
|
|
46478
|
+
if (!name) {
|
|
46479
|
+
return null;
|
|
46480
|
+
}
|
|
46481
|
+
properties.push({ name, node: property });
|
|
46482
|
+
}
|
|
46483
|
+
return properties;
|
|
46484
|
+
}
|
|
46378
46485
|
|
|
46379
46486
|
const INLINE_HTML_ELEMENTS = new Set([
|
|
46380
46487
|
'a',
|
|
@@ -46430,12 +46537,9 @@ function getNodeLabel(node) {
|
|
|
46430
46537
|
if (node instanceof dist$4.TmplAstElement) {
|
|
46431
46538
|
return `<${node.name}>`;
|
|
46432
46539
|
}
|
|
46433
|
-
|
|
46434
|
-
return 'binding';
|
|
46435
|
-
}
|
|
46436
|
-
return 'text';
|
|
46540
|
+
return node instanceof dist$4.TmplAstBoundText ? 'binding' : 'text';
|
|
46437
46541
|
}
|
|
46438
|
-
const rule$
|
|
46542
|
+
const rule$Q = createRule({
|
|
46439
46543
|
name: 'element-newline',
|
|
46440
46544
|
rule: {
|
|
46441
46545
|
create(context) {
|
|
@@ -46509,98 +46613,6 @@ const rule$O = createRule({
|
|
|
46509
46613
|
},
|
|
46510
46614
|
});
|
|
46511
46615
|
|
|
46512
|
-
function isObject(node) {
|
|
46513
|
-
return node?.type === dist$2.AST_NODE_TYPES.ObjectExpression;
|
|
46514
|
-
}
|
|
46515
|
-
|
|
46516
|
-
/**
|
|
46517
|
-
* Extracts the metadata object from a class decorator such as
|
|
46518
|
-
* `@Component()`, `@Directive()`, `@NgModule()`, or `@Pipe()`.
|
|
46519
|
-
*
|
|
46520
|
-
* Returns the first argument of the decorator call *if and only if*
|
|
46521
|
-
* it is an `ObjectExpression`.
|
|
46522
|
-
*
|
|
46523
|
-
* @example
|
|
46524
|
-
* // Given:
|
|
46525
|
-
* @Component({
|
|
46526
|
-
* selector: 'x',
|
|
46527
|
-
* imports: [A, B],
|
|
46528
|
-
* })
|
|
46529
|
-
* class MyCmp {}
|
|
46530
|
-
*
|
|
46531
|
-
* // In the AST for @Component(...)
|
|
46532
|
-
* getDecoratorMetadata(decorator, allowed) →
|
|
46533
|
-
* ObjectExpression({ selector: ..., imports: ... })
|
|
46534
|
-
*
|
|
46535
|
-
* @param decorator - The decorator node attached to a class declaration.
|
|
46536
|
-
* @param allowedNames - A set of decorator names to consider
|
|
46537
|
-
* (e.g., Component, Directive, NgModule, Pipe).
|
|
46538
|
-
*
|
|
46539
|
-
* @returns The metadata `ObjectExpression` if present and valid,
|
|
46540
|
-
* otherwise `null`.
|
|
46541
|
-
*/
|
|
46542
|
-
function getDecoratorMetadata(decorator, allowedNames) {
|
|
46543
|
-
const expr = decorator.expression;
|
|
46544
|
-
if (expr.type !== dist$2.AST_NODE_TYPES.CallExpression) {
|
|
46545
|
-
return null;
|
|
46546
|
-
}
|
|
46547
|
-
const callee = expr.callee;
|
|
46548
|
-
if (callee.type !== dist$2.AST_NODE_TYPES.Identifier || !allowedNames.has(callee.name)) {
|
|
46549
|
-
return null;
|
|
46550
|
-
}
|
|
46551
|
-
const arg = expr.arguments[0];
|
|
46552
|
-
return isObject(arg) ? arg : null;
|
|
46553
|
-
}
|
|
46554
|
-
|
|
46555
|
-
function isStringLiteral(node) {
|
|
46556
|
-
return node?.type === dist$3.AST_NODE_TYPES.Literal && typeof node.value === 'string';
|
|
46557
|
-
}
|
|
46558
|
-
function isStaticTemplateLiteral(node) {
|
|
46559
|
-
return (node?.type === dist$3.AST_NODE_TYPES.TemplateLiteral &&
|
|
46560
|
-
node.expressions.length === 0 &&
|
|
46561
|
-
node.quasis.length === 1);
|
|
46562
|
-
}
|
|
46563
|
-
function getStaticStringValue(node) {
|
|
46564
|
-
if (isStringLiteral(node)) {
|
|
46565
|
-
return node.value;
|
|
46566
|
-
}
|
|
46567
|
-
if (!isStaticTemplateLiteral(node)) {
|
|
46568
|
-
return null;
|
|
46569
|
-
}
|
|
46570
|
-
return node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw ?? '';
|
|
46571
|
-
}
|
|
46572
|
-
function isEmptyStaticString(node) {
|
|
46573
|
-
return getStaticStringValue(node) === '';
|
|
46574
|
-
}
|
|
46575
|
-
|
|
46576
|
-
function getStaticPropertyName(key) {
|
|
46577
|
-
if (key.type === dist$3.AST_NODE_TYPES.Identifier) {
|
|
46578
|
-
return key.name;
|
|
46579
|
-
}
|
|
46580
|
-
if (key.type === dist$3.AST_NODE_TYPES.Literal &&
|
|
46581
|
-
(typeof key.value === 'string' || typeof key.value === 'number')) {
|
|
46582
|
-
return String(key.value);
|
|
46583
|
-
}
|
|
46584
|
-
return getStaticStringValue(key);
|
|
46585
|
-
}
|
|
46586
|
-
function getObjectPropertyName(node) {
|
|
46587
|
-
if (node.computed) {
|
|
46588
|
-
return null;
|
|
46589
|
-
}
|
|
46590
|
-
return getStaticPropertyName(node.key);
|
|
46591
|
-
}
|
|
46592
|
-
function getMemberExpressionPropertyName(node) {
|
|
46593
|
-
if (!node.computed && node.property.type === dist$3.AST_NODE_TYPES.Identifier) {
|
|
46594
|
-
return node.property.name;
|
|
46595
|
-
}
|
|
46596
|
-
return node.computed ? getStaticStringValue(node.property) : null;
|
|
46597
|
-
}
|
|
46598
|
-
function getClassMemberName(member) {
|
|
46599
|
-
return member.key.type === dist$3.AST_NODE_TYPES.PrivateIdentifier
|
|
46600
|
-
? null
|
|
46601
|
-
: getStaticPropertyName(member.key);
|
|
46602
|
-
}
|
|
46603
|
-
|
|
46604
46616
|
const DEFAULT_GROUP = '$DEFAULT';
|
|
46605
46617
|
const DEFAULT_ATTRIBUTE_GROUPS = [
|
|
46606
46618
|
'$ANGULAR_STRUCTURAL_DIRECTIVE',
|
|
@@ -46666,7 +46678,7 @@ const PRESETS = {
|
|
|
46666
46678
|
$VUE: ['$CLASS', '$ID', '$VUE_ATTRIBUTE'],
|
|
46667
46679
|
$VUE_ATTRIBUTE: /^v-/,
|
|
46668
46680
|
};
|
|
46669
|
-
const rule$
|
|
46681
|
+
const rule$P = createRule({
|
|
46670
46682
|
create(context, [options]) {
|
|
46671
46683
|
const sourceCode = context.sourceCode;
|
|
46672
46684
|
const settings = {
|
|
@@ -46821,10 +46833,9 @@ function getGroup(query, ignoreCase) {
|
|
|
46821
46833
|
},
|
|
46822
46834
|
];
|
|
46823
46835
|
}
|
|
46824
|
-
|
|
46825
|
-
|
|
46826
|
-
|
|
46827
|
-
return [{ query, regexp: preset, values: [] }];
|
|
46836
|
+
return Array.isArray(preset)
|
|
46837
|
+
? preset.flatMap((item) => getGroup(item, ignoreCase))
|
|
46838
|
+
: [{ query, regexp: preset, values: [] }];
|
|
46828
46839
|
}
|
|
46829
46840
|
function ensureDefaultGroup(groups) {
|
|
46830
46841
|
const existing = groups.find(({ unknown }) => unknown);
|
|
@@ -46850,10 +46861,9 @@ function getFixText(hostObject, properties, sortedProperties, sourceCode) {
|
|
|
46850
46861
|
.join(', ')}}`;
|
|
46851
46862
|
}
|
|
46852
46863
|
const attachedComments = getAttachedComments(hostObject, properties, sourceCode, comments);
|
|
46853
|
-
|
|
46854
|
-
|
|
46855
|
-
|
|
46856
|
-
return renderFixWithComments(hostObject, sortedProperties, sourceCode, attachedComments);
|
|
46864
|
+
return attachedComments
|
|
46865
|
+
? renderFixWithComments(hostObject, sortedProperties, sourceCode, attachedComments)
|
|
46866
|
+
: null;
|
|
46857
46867
|
}
|
|
46858
46868
|
function getAttachedComments(hostObject, properties, sourceCode, comments) {
|
|
46859
46869
|
const attached = new Map();
|
|
@@ -46999,7 +47009,7 @@ const config$4 = {
|
|
|
46999
47009
|
type: 'suggestion',
|
|
47000
47010
|
},
|
|
47001
47011
|
};
|
|
47002
|
-
const rule$
|
|
47012
|
+
const rule$O = createRule({
|
|
47003
47013
|
name: 'html-logical-properties',
|
|
47004
47014
|
rule: config$4,
|
|
47005
47015
|
});
|
|
@@ -247715,12 +247725,11 @@ function getProgramResolutionCache(program) {
|
|
|
247715
247725
|
return null;
|
|
247716
247726
|
}
|
|
247717
247727
|
const cache = getCache.call(program);
|
|
247718
|
-
|
|
247728
|
+
return cache === null ||
|
|
247719
247729
|
typeof cache !== 'object' ||
|
|
247720
|
-
!('getOrCreateCacheForDirectory' in cache)
|
|
247721
|
-
|
|
247722
|
-
|
|
247723
|
-
return cache;
|
|
247730
|
+
!('getOrCreateCacheForDirectory' in cache)
|
|
247731
|
+
? null
|
|
247732
|
+
: cache;
|
|
247724
247733
|
}
|
|
247725
247734
|
function getFallbackResolution(program) {
|
|
247726
247735
|
const cached = fallbackResolutionByProgram.get(program);
|
|
@@ -247751,10 +247760,9 @@ function resolveModule(program, containingFile, moduleSpecifier) {
|
|
|
247751
247760
|
}
|
|
247752
247761
|
function resolveModuleFileName(program, containingFile, moduleSpecifier) {
|
|
247753
247762
|
const resolved = resolveModule(program, containingFile, moduleSpecifier);
|
|
247754
|
-
|
|
247755
|
-
|
|
247756
|
-
|
|
247757
|
-
return resolved.resolvedFileName;
|
|
247763
|
+
return !resolved || resolved.isExternalLibraryImport
|
|
247764
|
+
? null
|
|
247765
|
+
: resolved.resolvedFileName;
|
|
247758
247766
|
}
|
|
247759
247767
|
function splitModuleSpecifierQuery(moduleSpecifier) {
|
|
247760
247768
|
const queryIndex = moduleSpecifier.indexOf('?');
|
|
@@ -247849,22 +247857,20 @@ function importDeclarationHasRuntimeEdge(node) {
|
|
|
247849
247857
|
if (!namedBindings) {
|
|
247850
247858
|
return false;
|
|
247851
247859
|
}
|
|
247852
|
-
|
|
247853
|
-
|
|
247854
|
-
|
|
247855
|
-
|
|
247856
|
-
namedBindings.elements.some((specifier) => !specifier.isTypeOnly));
|
|
247860
|
+
return ts.isNamespaceImport(namedBindings)
|
|
247861
|
+
? true
|
|
247862
|
+
: namedBindings.elements.length === 0 ||
|
|
247863
|
+
namedBindings.elements.some((specifier) => !specifier.isTypeOnly);
|
|
247857
247864
|
}
|
|
247858
247865
|
function exportDeclarationHasRuntimeEdge(node) {
|
|
247859
247866
|
if (node.isTypeOnly) {
|
|
247860
247867
|
return false;
|
|
247861
247868
|
}
|
|
247862
247869
|
const exportClause = node.exportClause;
|
|
247863
|
-
|
|
247864
|
-
|
|
247865
|
-
|
|
247866
|
-
|
|
247867
|
-
exportClause.elements.some((specifier) => !specifier.isTypeOnly));
|
|
247870
|
+
return !exportClause || ts.isNamespaceExport(exportClause)
|
|
247871
|
+
? true
|
|
247872
|
+
: exportClause.elements.length === 0 ||
|
|
247873
|
+
exportClause.elements.some((specifier) => !specifier.isTypeOnly);
|
|
247868
247874
|
}
|
|
247869
247875
|
function getRuntimeModuleSpecifier(statement) {
|
|
247870
247876
|
if (ts.isImportDeclaration(statement)) {
|
|
@@ -247927,10 +247933,9 @@ function hasRuntimeDefaultModifier(statement) {
|
|
|
247927
247933
|
!ts.isTypeAliasDeclaration(statement));
|
|
247928
247934
|
}
|
|
247929
247935
|
function exportsDefaultSpecifier(node) {
|
|
247930
|
-
|
|
247931
|
-
|
|
247932
|
-
|
|
247933
|
-
return node.exportClause.elements.some((specifier) => !specifier.isTypeOnly && specifier.name.text === 'default');
|
|
247936
|
+
return node.isTypeOnly || !node.exportClause || !ts.isNamedExports(node.exportClause)
|
|
247937
|
+
? false
|
|
247938
|
+
: node.exportClause.elements.some((specifier) => !specifier.isTypeOnly && specifier.name.text === 'default');
|
|
247934
247939
|
}
|
|
247935
247940
|
function sourceFileHasDefaultExport(sourceFile) {
|
|
247936
247941
|
return sourceFile.statements.some((statement) => (ts.isExportAssignment(statement) && !statement.isExportEquals) ||
|
|
@@ -247958,25 +247963,20 @@ function hasRuntimeEstreeImport(node) {
|
|
|
247958
247963
|
if (node.importKind === 'type') {
|
|
247959
247964
|
return false;
|
|
247960
247965
|
}
|
|
247961
|
-
|
|
247962
|
-
|
|
247963
|
-
|
|
247964
|
-
|
|
247965
|
-
|
|
247966
|
-
return true;
|
|
247967
|
-
}
|
|
247968
|
-
return specifier.importKind !== 'type';
|
|
247969
|
-
});
|
|
247966
|
+
return node.specifiers.length === 0
|
|
247967
|
+
? true
|
|
247968
|
+
: node.specifiers.some((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportSpecifier
|
|
247969
|
+
? specifier.importKind !== 'type'
|
|
247970
|
+
: true);
|
|
247970
247971
|
}
|
|
247971
247972
|
function hasRuntimeEstreeReExport(node) {
|
|
247972
247973
|
if (node.exportKind === 'type') {
|
|
247973
247974
|
return false;
|
|
247974
247975
|
}
|
|
247975
|
-
|
|
247976
|
-
|
|
247977
|
-
|
|
247978
|
-
|
|
247979
|
-
node.specifiers.some((specifier) => specifier.exportKind !== 'type'));
|
|
247976
|
+
return node.type === dist$3.AST_NODE_TYPES.ExportAllDeclaration
|
|
247977
|
+
? true
|
|
247978
|
+
: node.specifiers.length === 0 ||
|
|
247979
|
+
node.specifiers.some((specifier) => specifier.exportKind !== 'type');
|
|
247980
247980
|
}
|
|
247981
247981
|
function getImportOrReExportModuleSpecifier(node) {
|
|
247982
247982
|
if (node.type === dist$3.AST_NODE_TYPES.ImportDeclaration) {
|
|
@@ -248199,13 +248199,10 @@ function isInAngularSafeContext(identifier) {
|
|
|
248199
248199
|
return false;
|
|
248200
248200
|
}
|
|
248201
248201
|
function isImportUsedOnlyAsAngularDiFirstArg(node, sourceCode) {
|
|
248202
|
-
const valueSpecifiers = node.specifiers.filter((specifier) =>
|
|
248203
|
-
|
|
248204
|
-
|
|
248205
|
-
|
|
248206
|
-
}
|
|
248207
|
-
return specifier.importKind !== 'type';
|
|
248208
|
-
});
|
|
248202
|
+
const valueSpecifiers = node.specifiers.filter((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportDefaultSpecifier ||
|
|
248203
|
+
specifier.type === dist$3.AST_NODE_TYPES.ImportNamespaceSpecifier
|
|
248204
|
+
? true
|
|
248205
|
+
: specifier.importKind !== 'type');
|
|
248209
248206
|
if (valueSpecifiers.length === 0) {
|
|
248210
248207
|
return false;
|
|
248211
248208
|
}
|
|
@@ -248251,7 +248248,7 @@ function isImportUsedOnlyAsAngularDiFirstArg(node, sourceCode) {
|
|
|
248251
248248
|
}
|
|
248252
248249
|
return hasSafeRuntimeUsage;
|
|
248253
248250
|
}
|
|
248254
|
-
const rule$
|
|
248251
|
+
const rule$N = createRule({
|
|
248255
248252
|
create(context) {
|
|
248256
248253
|
const { checker, esTreeNodeToTSNodeMap, sourceCode, tsProgram } = getTypeAwareRuleContext(context);
|
|
248257
248254
|
const checkCycles = context.options[0]?.checkCycles ?? true;
|
|
@@ -248426,11 +248423,10 @@ const rule$L = createRule({
|
|
|
248426
248423
|
const importSegments = moduleSpecifierPath.replace(/^\.\//, '').split('/');
|
|
248427
248424
|
const importParentCount = countRelativeParents(importSegments);
|
|
248428
248425
|
const expectedParentCount = countRelativeParents(expectedPath.split('/'));
|
|
248429
|
-
|
|
248430
|
-
expectedPath === moduleSpecifierPath
|
|
248431
|
-
|
|
248432
|
-
|
|
248433
|
-
return expectedPath;
|
|
248426
|
+
return importParentCount <= expectedParentCount ||
|
|
248427
|
+
expectedPath === moduleSpecifierPath
|
|
248428
|
+
? null
|
|
248429
|
+
: expectedPath;
|
|
248434
248430
|
}
|
|
248435
248431
|
function getUselessPathSegmentsReplacement(moduleSpecifierPath) {
|
|
248436
248432
|
const resolved = resolveModule(tsProgram, context.filename, moduleSpecifierPath);
|
|
@@ -248921,10 +248917,7 @@ function isStringLike(node) {
|
|
|
248921
248917
|
return isStringLiteral(node) || node.type === dist$2.AST_NODE_TYPES.TemplateLiteral;
|
|
248922
248918
|
}
|
|
248923
248919
|
function getStringValue(node) {
|
|
248924
|
-
|
|
248925
|
-
return node.value;
|
|
248926
|
-
}
|
|
248927
|
-
return node.quasis[0]?.value.raw || '';
|
|
248920
|
+
return isStringLiteral(node) ? node.value : node.quasis[0]?.value.raw || '';
|
|
248928
248921
|
}
|
|
248929
248922
|
function isEmptyString(node) {
|
|
248930
248923
|
return (isEmptyStaticString(node) &&
|
|
@@ -248942,10 +248935,7 @@ function getDescriptionValue(node) {
|
|
|
248942
248935
|
if (isStringLike(node)) {
|
|
248943
248936
|
return getStringValue(node);
|
|
248944
248937
|
}
|
|
248945
|
-
|
|
248946
|
-
return getStringValue(node.consequent);
|
|
248947
|
-
}
|
|
248948
|
-
return undefined;
|
|
248938
|
+
return isNgDevModeConditional(node) ? getStringValue(node.consequent) : undefined;
|
|
248949
248939
|
}
|
|
248950
248940
|
function getDescriptionNode(node) {
|
|
248951
248941
|
if (isStringLike(node)) {
|
|
@@ -248972,12 +248962,11 @@ function getNgDevModeDeclarationFix(program, fixer) {
|
|
|
248972
248962
|
return fixer.insertTextAfter(lastImport, '\n\ndeclare const ngDevMode: boolean;');
|
|
248973
248963
|
}
|
|
248974
248964
|
const [firstStatement] = program.body;
|
|
248975
|
-
|
|
248976
|
-
|
|
248977
|
-
|
|
248978
|
-
return fixer.insertTextBeforeRange([0, 0], 'declare const ngDevMode: boolean;\n');
|
|
248965
|
+
return firstStatement
|
|
248966
|
+
? fixer.insertTextBefore(firstStatement, 'declare const ngDevMode: boolean;\n\n')
|
|
248967
|
+
: fixer.insertTextBeforeRange([0, 0], 'declare const ngDevMode: boolean;\n');
|
|
248979
248968
|
}
|
|
248980
|
-
const rule$
|
|
248969
|
+
const rule$M = createRule({
|
|
248981
248970
|
create(context) {
|
|
248982
248971
|
const { sourceCode } = context;
|
|
248983
248972
|
const program = sourceCode.ast;
|
|
@@ -249026,7 +249015,7 @@ const rule$K = createRule({
|
|
|
249026
249015
|
name: 'injection-token-description',
|
|
249027
249016
|
});
|
|
249028
249017
|
|
|
249029
|
-
const rule$
|
|
249018
|
+
const rule$L = createRule({
|
|
249030
249019
|
create(context) {
|
|
249031
249020
|
const { sourceCode } = context;
|
|
249032
249021
|
const namespaceImports = new Map();
|
|
@@ -249121,7 +249110,7 @@ const DEFAULT_OPTIONS = {
|
|
|
249121
249110
|
importDeclaration: '^@taiga-ui*',
|
|
249122
249111
|
projectName: String.raw `(?<=^@taiga-ui/)([-\w]+)`,
|
|
249123
249112
|
};
|
|
249124
|
-
const rule$
|
|
249113
|
+
const rule$K = createRule({
|
|
249125
249114
|
create(context) {
|
|
249126
249115
|
const { currentProject, deepImport, ignoreImports, importDeclaration, projectName, } = { ...DEFAULT_OPTIONS, ...context.options[0] };
|
|
249127
249116
|
const hasNonCodeExtension = (source) => {
|
|
@@ -249213,7 +249202,7 @@ const nearestFileUpCache = new Map();
|
|
|
249213
249202
|
const markerCache = new Map();
|
|
249214
249203
|
const indexFileCache = new Map();
|
|
249215
249204
|
const indexExportsCache = new Map();
|
|
249216
|
-
const rule$
|
|
249205
|
+
const rule$J = createRule({
|
|
249217
249206
|
create(context) {
|
|
249218
249207
|
const parserServices = dist$3.ESLintUtils.getParserServices(context);
|
|
249219
249208
|
const program = parserServices.program;
|
|
@@ -249374,10 +249363,9 @@ const rule$H = createRule({
|
|
|
249374
249363
|
name: 'no-deep-imports-to-indexed-packages',
|
|
249375
249364
|
});
|
|
249376
249365
|
function isExternalModuleSpecifier(moduleSpecifier) {
|
|
249377
|
-
|
|
249378
|
-
|
|
249379
|
-
|
|
249380
|
-
return !path.isAbsolute(moduleSpecifier);
|
|
249366
|
+
return !moduleSpecifier || moduleSpecifier.startsWith('.')
|
|
249367
|
+
? false
|
|
249368
|
+
: !path.isAbsolute(moduleSpecifier);
|
|
249381
249369
|
}
|
|
249382
249370
|
function isScopedPackage(importSpecifier) {
|
|
249383
249371
|
return importSpecifier.startsWith('@');
|
|
@@ -249385,19 +249373,17 @@ function isScopedPackage(importSpecifier) {
|
|
|
249385
249373
|
function getPackageRootSpecifier(importSpecifier) {
|
|
249386
249374
|
const pathParts = importSpecifier.split('/');
|
|
249387
249375
|
if (isScopedPackage(importSpecifier)) {
|
|
249388
|
-
|
|
249389
|
-
|
|
249390
|
-
|
|
249391
|
-
return importSpecifier;
|
|
249376
|
+
return pathParts.length >= 2
|
|
249377
|
+
? `${pathParts[0]}/${pathParts[1]}`
|
|
249378
|
+
: importSpecifier;
|
|
249392
249379
|
}
|
|
249393
249380
|
return pathParts[0] ?? importSpecifier;
|
|
249394
249381
|
}
|
|
249395
249382
|
function getSubpath(importSpecifier, packageRootSpecifier) {
|
|
249396
|
-
|
|
249397
|
-
!importSpecifier.startsWith(`${packageRootSpecifier}/`)
|
|
249398
|
-
|
|
249399
|
-
|
|
249400
|
-
return importSpecifier.slice(packageRootSpecifier.length + 1);
|
|
249383
|
+
return importSpecifier === packageRootSpecifier ||
|
|
249384
|
+
!importSpecifier.startsWith(`${packageRootSpecifier}/`)
|
|
249385
|
+
? null
|
|
249386
|
+
: importSpecifier.slice(packageRootSpecifier.length + 1);
|
|
249401
249387
|
}
|
|
249402
249388
|
function normalizeModuleSpecifier(moduleSpecifier) {
|
|
249403
249389
|
return moduleSpecifier.replaceAll('\\', '/');
|
|
@@ -249410,13 +249396,13 @@ const noDuplicateAttributesRule = angular.templatePlugin.rules?.['no-duplicate-a
|
|
|
249410
249396
|
if (!noDuplicateAttributesRule) {
|
|
249411
249397
|
throw new Error('angular-eslint template rule "no-duplicate-attributes" is not available');
|
|
249412
249398
|
}
|
|
249413
|
-
const rule$
|
|
249399
|
+
const rule$I = createRule({
|
|
249414
249400
|
name: 'no-duplicate-attrs',
|
|
249415
249401
|
rule: noDuplicateAttributesRule,
|
|
249416
249402
|
});
|
|
249417
249403
|
|
|
249418
249404
|
const MESSAGE_ID$c = 'duplicateId';
|
|
249419
|
-
const rule$
|
|
249405
|
+
const rule$H = createRule({
|
|
249420
249406
|
name: 'no-duplicate-id',
|
|
249421
249407
|
rule: {
|
|
249422
249408
|
create(context) {
|
|
@@ -249471,14 +249457,13 @@ function getTrackingKey(node) {
|
|
|
249471
249457
|
return 'meta[name=viewport]';
|
|
249472
249458
|
}
|
|
249473
249459
|
}
|
|
249474
|
-
|
|
249460
|
+
return node.name === 'link' &&
|
|
249475
249461
|
findAttr(node, 'rel')?.value === 'canonical' &&
|
|
249476
|
-
findAttr(node, 'href')
|
|
249477
|
-
|
|
249478
|
-
|
|
249479
|
-
return null;
|
|
249462
|
+
findAttr(node, 'href')
|
|
249463
|
+
? 'link[rel=canonical]'
|
|
249464
|
+
: null;
|
|
249480
249465
|
}
|
|
249481
|
-
const rule$
|
|
249466
|
+
const rule$G = createRule({
|
|
249482
249467
|
name: 'no-duplicate-in-head',
|
|
249483
249468
|
rule: {
|
|
249484
249469
|
create(context) {
|
|
@@ -249533,6 +249518,133 @@ const rule$E = createRule({
|
|
|
249533
249518
|
},
|
|
249534
249519
|
});
|
|
249535
249520
|
|
|
249521
|
+
const COMPONENT_DECORATORS = new Set(['Component']);
|
|
249522
|
+
const rule$F = createRule({
|
|
249523
|
+
create(context) {
|
|
249524
|
+
const { sourceCode } = context;
|
|
249525
|
+
return {
|
|
249526
|
+
ClassDeclaration(node) {
|
|
249527
|
+
for (const decorator of node?.decorators ?? []) {
|
|
249528
|
+
const metadata = getDecoratorMetadata(decorator, COMPONENT_DECORATORS);
|
|
249529
|
+
if (!metadata) {
|
|
249530
|
+
continue;
|
|
249531
|
+
}
|
|
249532
|
+
const emptyProperties = metadata.properties.filter((property) => property.type === dist$3.AST_NODE_TYPES.Property &&
|
|
249533
|
+
isEmptyStyleMetadata(getObjectPropertyName(property), property, sourceCode));
|
|
249534
|
+
if (emptyProperties.length === 0) {
|
|
249535
|
+
continue;
|
|
249536
|
+
}
|
|
249537
|
+
const [firstEmptyProperty] = emptyProperties;
|
|
249538
|
+
if (!firstEmptyProperty) {
|
|
249539
|
+
continue;
|
|
249540
|
+
}
|
|
249541
|
+
context.report({
|
|
249542
|
+
fix: (fixer) => {
|
|
249543
|
+
const ranges = emptyProperties.map((property) => getPropertyRemovalRange(sourceCode, property));
|
|
249544
|
+
return ranges.some((range) => hasCommentsInRange(sourceCode, range))
|
|
249545
|
+
? null
|
|
249546
|
+
: fixer.replaceTextRange(metadata.range, removeRanges(sourceCode.text.slice(...metadata.range), ranges.map(([start, end]) => [
|
|
249547
|
+
start - metadata.range[0],
|
|
249548
|
+
end - metadata.range[0],
|
|
249549
|
+
])));
|
|
249550
|
+
},
|
|
249551
|
+
messageId: 'noEmptyStyleMetadata',
|
|
249552
|
+
node: firstEmptyProperty,
|
|
249553
|
+
});
|
|
249554
|
+
}
|
|
249555
|
+
},
|
|
249556
|
+
};
|
|
249557
|
+
},
|
|
249558
|
+
meta: {
|
|
249559
|
+
docs: {
|
|
249560
|
+
description: 'Disallow empty `styles`, `styleUrl`, and `styleUrls` metadata in Angular components.',
|
|
249561
|
+
},
|
|
249562
|
+
fixable: 'code',
|
|
249563
|
+
messages: {
|
|
249564
|
+
noEmptyStyleMetadata: 'Empty style metadata should be removed from @Component decorator.',
|
|
249565
|
+
},
|
|
249566
|
+
schema: [],
|
|
249567
|
+
type: 'problem',
|
|
249568
|
+
},
|
|
249569
|
+
name: 'no-empty-style-metadata',
|
|
249570
|
+
});
|
|
249571
|
+
function isEmptyStyleMetadata(name, property, sourceCode) {
|
|
249572
|
+
return (((name === 'styles' || name === 'styleUrl') &&
|
|
249573
|
+
isEmptyStringExpression(property.value)) ||
|
|
249574
|
+
(name === 'styleUrls' &&
|
|
249575
|
+
property.value.type === dist$3.AST_NODE_TYPES.ArrayExpression &&
|
|
249576
|
+
property.value.elements.length === 0 &&
|
|
249577
|
+
sourceCode.getText(property.value).replaceAll(/\s/g, '') === '[]'));
|
|
249578
|
+
}
|
|
249579
|
+
function isEmptyStringExpression(node) {
|
|
249580
|
+
if (node.type === dist$3.AST_NODE_TYPES.Literal) {
|
|
249581
|
+
return node.value === '';
|
|
249582
|
+
}
|
|
249583
|
+
if (node.type !== dist$3.AST_NODE_TYPES.TemplateLiteral || node.expressions.length > 0) {
|
|
249584
|
+
return false;
|
|
249585
|
+
}
|
|
249586
|
+
const [quasi] = node.quasis;
|
|
249587
|
+
return quasi?.value.raw === '';
|
|
249588
|
+
}
|
|
249589
|
+
function getPropertyRemovalRange(sourceCode, property) {
|
|
249590
|
+
const nextToken = sourceCode.getTokenAfter(property);
|
|
249591
|
+
if (nextToken?.value === ',') {
|
|
249592
|
+
return getRangeWithFollowingComma(sourceCode.text, property, nextToken.range);
|
|
249593
|
+
}
|
|
249594
|
+
const previousToken = sourceCode.getTokenBefore(property);
|
|
249595
|
+
return previousToken?.value === ','
|
|
249596
|
+
? [previousToken.range[0], property.range[1]]
|
|
249597
|
+
: getSinglePropertyRange(sourceCode.text, property);
|
|
249598
|
+
}
|
|
249599
|
+
function getRangeWithFollowingComma(text, property, commaRange) {
|
|
249600
|
+
const lineStart = getLineStart(text, property.range[0]);
|
|
249601
|
+
const nextLineStart = getNextLineStart(text, commaRange[1]);
|
|
249602
|
+
return text.slice(lineStart, property.range[0]).trim() === '' &&
|
|
249603
|
+
text.slice(commaRange[1], nextLineStart).trim() === '' &&
|
|
249604
|
+
nextLineStart > commaRange[1]
|
|
249605
|
+
? [lineStart, nextLineStart]
|
|
249606
|
+
: [property.range[0], commaRange[1]];
|
|
249607
|
+
}
|
|
249608
|
+
function getSinglePropertyRange(text, property) {
|
|
249609
|
+
const lineStart = getLineStart(text, property.range[0]);
|
|
249610
|
+
const nextLineStart = getNextLineStart(text, property.range[1]);
|
|
249611
|
+
return text.slice(lineStart, property.range[0]).trim() === '' &&
|
|
249612
|
+
text.slice(property.range[1], nextLineStart).trim() === '' &&
|
|
249613
|
+
nextLineStart > property.range[1]
|
|
249614
|
+
? [lineStart, nextLineStart]
|
|
249615
|
+
: [property.range[0], property.range[1]];
|
|
249616
|
+
}
|
|
249617
|
+
function getLineStart(text, index) {
|
|
249618
|
+
return text.lastIndexOf('\n', index - 1) + 1;
|
|
249619
|
+
}
|
|
249620
|
+
function getNextLineStart(text, index) {
|
|
249621
|
+
const lineEnd = text.indexOf('\n', index);
|
|
249622
|
+
return lineEnd === -1 ? index : lineEnd + 1;
|
|
249623
|
+
}
|
|
249624
|
+
function hasCommentsInRange(sourceCode, [start, end]) {
|
|
249625
|
+
return sourceCode
|
|
249626
|
+
.getAllComments()
|
|
249627
|
+
.some((comment) => comment.range[0] >= start && comment.range[1] <= end);
|
|
249628
|
+
}
|
|
249629
|
+
function removeRanges(text, ranges) {
|
|
249630
|
+
return mergeRanges(ranges)
|
|
249631
|
+
.sort((left, right) => right[0] - left[0])
|
|
249632
|
+
.reduce((result, [start, end]) => `${result.slice(0, start)}${result.slice(end)}`, text);
|
|
249633
|
+
}
|
|
249634
|
+
function mergeRanges(ranges) {
|
|
249635
|
+
const sorted = [...ranges].sort((left, right) => left[0] - right[0]);
|
|
249636
|
+
const merged = [];
|
|
249637
|
+
for (const range of sorted) {
|
|
249638
|
+
const last = merged[merged.length - 1];
|
|
249639
|
+
if (!last || range[0] > last[1]) {
|
|
249640
|
+
merged.push([...range]);
|
|
249641
|
+
continue;
|
|
249642
|
+
}
|
|
249643
|
+
last[1] = Math.max(last[1], range[1]);
|
|
249644
|
+
}
|
|
249645
|
+
return merged;
|
|
249646
|
+
}
|
|
249647
|
+
|
|
249536
249648
|
function isFunctionLike(node) {
|
|
249537
249649
|
return (node.type === dist$3.AST_NODE_TYPES.ArrowFunctionExpression ||
|
|
249538
249650
|
node.type === dist$3.AST_NODE_TYPES.FunctionDeclaration ||
|
|
@@ -249777,12 +249889,11 @@ function getPropertyName(property) {
|
|
|
249777
249889
|
}
|
|
249778
249890
|
function isAngularCoreCall(node, program, exportedName) {
|
|
249779
249891
|
const localName = getLocalNameForImport(program, ANGULAR_CORE, exportedName);
|
|
249780
|
-
|
|
249781
|
-
|
|
249782
|
-
|
|
249783
|
-
|
|
249784
|
-
|
|
249785
|
-
node.arguments.length >= 1);
|
|
249892
|
+
return localName
|
|
249893
|
+
? node.callee.type === dist$3.AST_NODE_TYPES.Identifier &&
|
|
249894
|
+
node.callee.name === localName &&
|
|
249895
|
+
node.arguments.length >= 1
|
|
249896
|
+
: false;
|
|
249786
249897
|
}
|
|
249787
249898
|
function appendFirstArgReactiveScope(scopes, call, kind) {
|
|
249788
249899
|
const callback = getReactiveCallbackArgument(call);
|
|
@@ -249921,13 +250032,12 @@ function isSignalType(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
249921
250032
|
}
|
|
249922
250033
|
const typeSymbol = type.getSymbol();
|
|
249923
250034
|
const aliasSymbol = type.aliasSymbol;
|
|
249924
|
-
|
|
249925
|
-
aliasSymbol?.getName().includes('Signal')
|
|
249926
|
-
|
|
249927
|
-
|
|
249928
|
-
|
|
249929
|
-
|
|
249930
|
-
.some((p) => p.name.startsWith('ɵ') || p.name === '__SIGNAL');
|
|
250035
|
+
return typeSymbol?.getName().includes('Signal') ||
|
|
250036
|
+
aliasSymbol?.getName().includes('Signal')
|
|
250037
|
+
? true
|
|
250038
|
+
: type
|
|
250039
|
+
.getProperties()
|
|
250040
|
+
.some((p) => p.name.startsWith('ɵ') || p.name === '__SIGNAL');
|
|
249931
250041
|
}
|
|
249932
250042
|
catch {
|
|
249933
250043
|
return false;
|
|
@@ -249935,22 +250045,20 @@ function isSignalType(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
249935
250045
|
}
|
|
249936
250046
|
function isSignalReadCall(node, checker, esTreeNodeToTSNodeMap) {
|
|
249937
250047
|
const { callee } = node;
|
|
249938
|
-
|
|
249939
|
-
callee.type !== dist$3.AST_NODE_TYPES.MemberExpression
|
|
249940
|
-
|
|
249941
|
-
|
|
249942
|
-
return isSignalType(callee, checker, esTreeNodeToTSNodeMap);
|
|
250048
|
+
return callee.type !== dist$3.AST_NODE_TYPES.Identifier &&
|
|
250049
|
+
callee.type !== dist$3.AST_NODE_TYPES.MemberExpression
|
|
250050
|
+
? false
|
|
250051
|
+
: isSignalType(callee, checker, esTreeNodeToTSNodeMap);
|
|
249943
250052
|
}
|
|
249944
250053
|
function isWritableSignalWrite(node, checker, esTreeNodeToTSNodeMap) {
|
|
249945
250054
|
if (node.callee.type !== dist$3.AST_NODE_TYPES.MemberExpression) {
|
|
249946
250055
|
return false;
|
|
249947
250056
|
}
|
|
249948
250057
|
const { object, property } = node.callee;
|
|
249949
|
-
|
|
249950
|
-
!SIGNAL_WRITE_METHODS.has(property.name)
|
|
249951
|
-
|
|
249952
|
-
|
|
249953
|
-
return isSignalType(object, checker, esTreeNodeToTSNodeMap);
|
|
250058
|
+
return property.type !== dist$3.AST_NODE_TYPES.Identifier ||
|
|
250059
|
+
!SIGNAL_WRITE_METHODS.has(property.name)
|
|
250060
|
+
? false
|
|
250061
|
+
: isSignalType(object, checker, esTreeNodeToTSNodeMap);
|
|
249954
250062
|
}
|
|
249955
250063
|
/**
|
|
249956
250064
|
* Returns true when `node` is a member expression `foo.bar` where `bar` is a
|
|
@@ -249964,10 +250072,7 @@ function isGetterMemberAccess(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
249964
250072
|
return false;
|
|
249965
250073
|
}
|
|
249966
250074
|
const symbol = checker.getSymbolAtLocation(tsNode);
|
|
249967
|
-
|
|
249968
|
-
return false;
|
|
249969
|
-
}
|
|
249970
|
-
return !!(symbol.flags & ts.SymbolFlags.GetAccessor);
|
|
250075
|
+
return symbol ? !!(symbol.flags & ts.SymbolFlags.GetAccessor) : false;
|
|
249971
250076
|
}
|
|
249972
250077
|
catch {
|
|
249973
250078
|
return false;
|
|
@@ -250051,19 +250156,18 @@ function getReturnedReactiveOwnerCall(node, program) {
|
|
|
250051
250156
|
isReactiveOwnerCall(statement.argument, program)) {
|
|
250052
250157
|
return statement.argument;
|
|
250053
250158
|
}
|
|
250054
|
-
|
|
250159
|
+
return node.parent.type === dist$3.AST_NODE_TYPES.ExpressionStatement &&
|
|
250055
250160
|
statement?.type === dist$3.AST_NODE_TYPES.ExpressionStatement &&
|
|
250056
|
-
isReactiveOwnerCall(statement.expression, program)
|
|
250057
|
-
|
|
250058
|
-
|
|
250059
|
-
return null;
|
|
250161
|
+
isReactiveOwnerCall(statement.expression, program)
|
|
250162
|
+
? statement.expression
|
|
250163
|
+
: null;
|
|
250060
250164
|
}
|
|
250061
250165
|
|
|
250062
250166
|
const ANGULAR_SIGNALS_UNTRACKED_GUIDE_URL = 'https://angular.dev/guide/signals#reading-without-tracking-dependencies';
|
|
250063
250167
|
const ANGULAR_SIGNALS_ASYNC_GUIDE_URL = 'https://angular.dev/guide/signals#reactive-context-and-async-operations';
|
|
250064
250168
|
const createUntrackedRule = createRule;
|
|
250065
250169
|
|
|
250066
|
-
const rule$
|
|
250170
|
+
const rule$E = createUntrackedRule({
|
|
250067
250171
|
create(context) {
|
|
250068
250172
|
const { checker, esTreeNodeToTSNodeMap, program } = getTypeAwareRuleContext(context);
|
|
250069
250173
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -250136,7 +250240,7 @@ const config$3 = {
|
|
|
250136
250240
|
type: 'problem',
|
|
250137
250241
|
},
|
|
250138
250242
|
};
|
|
250139
|
-
const rule$
|
|
250243
|
+
const rule$D = createRule({
|
|
250140
250244
|
name: 'no-href-with-router-link',
|
|
250141
250245
|
rule: config$3,
|
|
250142
250246
|
});
|
|
@@ -250197,7 +250301,7 @@ function getScopeRoot(node) {
|
|
|
250197
250301
|
return (findAncestor(node, (ancestor) => ancestor.type === dist$3.AST_NODE_TYPES.Program || isFunctionLike(ancestor)) ?? node);
|
|
250198
250302
|
}
|
|
250199
250303
|
|
|
250200
|
-
const rule$
|
|
250304
|
+
const rule$C = createRule({
|
|
250201
250305
|
create(context) {
|
|
250202
250306
|
const checkImplicitPublic = (node) => {
|
|
250203
250307
|
const classRef = getEnclosingClass(node);
|
|
@@ -250259,7 +250363,7 @@ const rule$B = createRule({
|
|
|
250259
250363
|
name: 'no-implicit-public',
|
|
250260
250364
|
});
|
|
250261
250365
|
|
|
250262
|
-
const rule$
|
|
250366
|
+
const rule$B = createRule({
|
|
250263
250367
|
create(context) {
|
|
250264
250368
|
const { sourceCode } = context;
|
|
250265
250369
|
return {
|
|
@@ -250292,10 +250396,9 @@ const rule$A = createRule({
|
|
|
250292
250396
|
|
|
250293
250397
|
function getParenthesizedInner(node) {
|
|
250294
250398
|
const maybeNode = node;
|
|
250295
|
-
|
|
250296
|
-
|
|
250297
|
-
|
|
250298
|
-
return null;
|
|
250399
|
+
return maybeNode.type === 'ParenthesizedExpression'
|
|
250400
|
+
? (maybeNode.expression ?? null)
|
|
250401
|
+
: null;
|
|
250299
250402
|
}
|
|
250300
250403
|
function unwrapParenthesized(node) {
|
|
250301
250404
|
let current = node;
|
|
@@ -250309,15 +250412,14 @@ function unwrapParenthesized(node) {
|
|
|
250309
250412
|
|
|
250310
250413
|
function isInfiniteLoopLiteral(node) {
|
|
250311
250414
|
const unwrapped = unwrapParenthesized(node);
|
|
250312
|
-
|
|
250313
|
-
|
|
250314
|
-
|
|
250315
|
-
return unwrapped.value === true || unwrapped.value === 1;
|
|
250415
|
+
return unwrapped.type === dist$3.AST_NODE_TYPES.Literal
|
|
250416
|
+
? unwrapped.value === true || unwrapped.value === 1
|
|
250417
|
+
: false;
|
|
250316
250418
|
}
|
|
250317
250419
|
function isInfiniteLoopTest(test) {
|
|
250318
250420
|
return test == null || isInfiniteLoopLiteral(test);
|
|
250319
250421
|
}
|
|
250320
|
-
const rule$
|
|
250422
|
+
const rule$A = createRule({
|
|
250321
250423
|
create(context) {
|
|
250322
250424
|
return {
|
|
250323
250425
|
DoWhileStatement(node) {
|
|
@@ -250362,7 +250464,7 @@ const rule$z = createRule({
|
|
|
250362
250464
|
});
|
|
250363
250465
|
|
|
250364
250466
|
const LEGACY_PEER_DEPS_PATTERN = /^legacy-peer-deps\s*=\s*true$/i;
|
|
250365
|
-
const rule$
|
|
250467
|
+
const rule$z = createRule({
|
|
250366
250468
|
create(context) {
|
|
250367
250469
|
return {
|
|
250368
250470
|
Program(node) {
|
|
@@ -250822,7 +250924,7 @@ const OBSOLETE_HTML_ATTRS = {
|
|
|
250822
250924
|
};
|
|
250823
250925
|
|
|
250824
250926
|
const MESSAGE_ID$9 = 'obsolete';
|
|
250825
|
-
const rule$
|
|
250927
|
+
const rule$y = createRule({
|
|
250826
250928
|
name: 'no-obsolete-attrs',
|
|
250827
250929
|
rule: {
|
|
250828
250930
|
create(context) {
|
|
@@ -250900,7 +251002,7 @@ const OBSOLETE_HTML_TAGS = new Set([
|
|
|
250900
251002
|
]);
|
|
250901
251003
|
|
|
250902
251004
|
const MESSAGE_ID$8 = 'unexpected';
|
|
250903
|
-
const rule$
|
|
251005
|
+
const rule$x = createRule({
|
|
250904
251006
|
name: 'no-obsolete-tags',
|
|
250905
251007
|
rule: {
|
|
250906
251008
|
create(context) {
|
|
@@ -250927,7 +251029,7 @@ const rule$w = createRule({
|
|
|
250927
251029
|
},
|
|
250928
251030
|
});
|
|
250929
251031
|
|
|
250930
|
-
const rule$
|
|
251032
|
+
const rule$w = createRule({
|
|
250931
251033
|
create(context) {
|
|
250932
251034
|
const { checker, esTreeNodeToTSNodeMap, sourceCode } = getTypeAwareRuleContext(context);
|
|
250933
251035
|
return {
|
|
@@ -251071,7 +251173,7 @@ const config$2 = {
|
|
|
251071
251173
|
type: 'problem',
|
|
251072
251174
|
},
|
|
251073
251175
|
};
|
|
251074
|
-
const rule$
|
|
251176
|
+
const rule$v = createRule({
|
|
251075
251177
|
name: 'no-project-as-in-ng-template',
|
|
251076
251178
|
rule: config$2,
|
|
251077
251179
|
});
|
|
@@ -251108,7 +251210,7 @@ function collectArrayExpressions(node) {
|
|
|
251108
251210
|
}
|
|
251109
251211
|
return result;
|
|
251110
251212
|
}
|
|
251111
|
-
const rule$
|
|
251213
|
+
const rule$u = createRule({
|
|
251112
251214
|
create(context) {
|
|
251113
251215
|
const { checker: typeChecker, esTreeNodeToTSNodeMap } = getTypeAwareRuleContext(context);
|
|
251114
251216
|
const ignoreTupleContextualTyping = context.options[0]?.ignoreTupleContextualTyping ?? true;
|
|
@@ -251210,10 +251312,9 @@ function isNullableCallType(call, checker, nodeMap) {
|
|
|
251210
251312
|
return false;
|
|
251211
251313
|
}
|
|
251212
251314
|
const type = checker.getTypeAtLocation(tsNode);
|
|
251213
|
-
|
|
251214
|
-
|
|
251215
|
-
|
|
251216
|
-
return type.types.some((t) => !!(t.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)));
|
|
251315
|
+
return type.flags & ts.TypeFlags.Union
|
|
251316
|
+
? type.types.some((t) => !!(t.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)))
|
|
251317
|
+
: false;
|
|
251217
251318
|
}
|
|
251218
251319
|
catch {
|
|
251219
251320
|
return false;
|
|
@@ -251224,13 +251325,12 @@ function getTargetNode(call) {
|
|
|
251224
251325
|
if (parent.type === dist$3.AST_NODE_TYPES.TSAsExpression) {
|
|
251225
251326
|
return parent;
|
|
251226
251327
|
}
|
|
251227
|
-
|
|
251328
|
+
return parent.type === dist$3.AST_NODE_TYPES.UnaryExpression &&
|
|
251228
251329
|
parent.operator === '!' &&
|
|
251229
251330
|
parent.parent.type === dist$3.AST_NODE_TYPES.UnaryExpression &&
|
|
251230
|
-
parent.parent.operator === '!'
|
|
251231
|
-
|
|
251232
|
-
|
|
251233
|
-
return call;
|
|
251331
|
+
parent.parent.operator === '!'
|
|
251332
|
+
? parent.parent
|
|
251333
|
+
: call;
|
|
251234
251334
|
}
|
|
251235
251335
|
function getCalleeName(node) {
|
|
251236
251336
|
const { callee } = node;
|
|
@@ -251240,10 +251340,7 @@ function getCalleeName(node) {
|
|
|
251240
251340
|
return callee.property.name;
|
|
251241
251341
|
}
|
|
251242
251342
|
// Append 'Val' to avoid shadowing the signal variable itself (e.g. const xVal = x())
|
|
251243
|
-
|
|
251244
|
-
return `${callee.name}Val`;
|
|
251245
|
-
}
|
|
251246
|
-
return 'value';
|
|
251343
|
+
return callee.type === dist$3.AST_NODE_TYPES.Identifier ? `${callee.name}Val` : 'value';
|
|
251247
251344
|
}
|
|
251248
251345
|
function findParentStatement(node) {
|
|
251249
251346
|
for (let current = node; current.parent; current = current.parent) {
|
|
@@ -251277,13 +251374,13 @@ function getArrowBodyIndent(arrowFn, sourceText) {
|
|
|
251277
251374
|
const outerIndent = /^(\s*)/.exec(textBeforeArrow)?.[1] ?? '';
|
|
251278
251375
|
return { innerIndent: `${outerIndent} `, outerIndent };
|
|
251279
251376
|
}
|
|
251280
|
-
function getStatementIndent(statement, sourceText) {
|
|
251377
|
+
function getStatementIndent$1(statement, sourceText) {
|
|
251281
251378
|
const start = statement.range[0];
|
|
251282
251379
|
const lineStart = sourceText.lastIndexOf('\n', start - 1) + 1;
|
|
251283
251380
|
const before = sourceText.slice(lineStart, start);
|
|
251284
251381
|
return /^\s*$/.test(before) ? before : '';
|
|
251285
251382
|
}
|
|
251286
|
-
const rule$
|
|
251383
|
+
const rule$t = createRule({
|
|
251287
251384
|
create(context) {
|
|
251288
251385
|
const { checker, esTreeNodeToTSNodeMap, sourceCode } = getTypeAwareRuleContext(context);
|
|
251289
251386
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -251322,7 +251419,7 @@ const rule$s = createRule({
|
|
|
251322
251419
|
const varName = getCalleeName(firstCall);
|
|
251323
251420
|
const parentStatement = findParentStatement(node);
|
|
251324
251421
|
if (parentStatement) {
|
|
251325
|
-
const indent = getStatementIndent(parentStatement, sourceCode.text);
|
|
251422
|
+
const indent = getStatementIndent$1(parentStatement, sourceCode.text);
|
|
251326
251423
|
const fixes = [
|
|
251327
251424
|
fixer.insertTextBefore(parentStatement, `const ${varName} = ${callText};\n\n${indent}`),
|
|
251328
251425
|
];
|
|
@@ -251437,12 +251534,9 @@ function collectMutationTargets(node) {
|
|
|
251437
251534
|
case dist$3.AST_NODE_TYPES.MemberExpression:
|
|
251438
251535
|
return [current];
|
|
251439
251536
|
case dist$3.AST_NODE_TYPES.ObjectPattern:
|
|
251440
|
-
return current.properties.flatMap((property) =>
|
|
251441
|
-
|
|
251442
|
-
|
|
251443
|
-
}
|
|
251444
|
-
return collectMutationTargets(property.value);
|
|
251445
|
-
});
|
|
251537
|
+
return current.properties.flatMap((property) => property.type === dist$3.AST_NODE_TYPES.RestElement
|
|
251538
|
+
? collectMutationTargets(property.argument)
|
|
251539
|
+
: collectMutationTargets(property.value));
|
|
251446
251540
|
case dist$3.AST_NODE_TYPES.RestElement:
|
|
251447
251541
|
return collectMutationTargets(current.argument);
|
|
251448
251542
|
default:
|
|
@@ -251452,10 +251546,7 @@ function collectMutationTargets(node) {
|
|
|
251452
251546
|
|
|
251453
251547
|
function getSymbolAtNode(node, checker, esTreeNodeToTSNodeMap) {
|
|
251454
251548
|
const tsNode = esTreeNodeToTSNodeMap.get(node);
|
|
251455
|
-
|
|
251456
|
-
return null;
|
|
251457
|
-
}
|
|
251458
|
-
return checker.getSymbolAtLocation(tsNode) ?? null;
|
|
251549
|
+
return tsNode ? (checker.getSymbolAtLocation(tsNode) ?? null) : null;
|
|
251459
251550
|
}
|
|
251460
251551
|
|
|
251461
251552
|
function isFunctionLikeScope(node) {
|
|
@@ -251463,14 +251554,13 @@ function isFunctionLikeScope(node) {
|
|
|
251463
251554
|
}
|
|
251464
251555
|
function isLocalIdentifier(node, context, localScopes) {
|
|
251465
251556
|
const symbol = getSymbolAtNode(node, context.checker, context.esTreeNodeToTSNodeMap);
|
|
251466
|
-
|
|
251467
|
-
|
|
251468
|
-
|
|
251469
|
-
|
|
251470
|
-
|
|
251471
|
-
|
|
251472
|
-
|
|
251473
|
-
});
|
|
251557
|
+
return symbol
|
|
251558
|
+
? (symbol.declarations ?? []).some((declaration) => {
|
|
251559
|
+
const estreeDeclaration = context.tsNodeToESTreeNodeMap.get(declaration);
|
|
251560
|
+
return (!!estreeDeclaration &&
|
|
251561
|
+
isDeclaredInsideLocalScope(estreeDeclaration, localScopes));
|
|
251562
|
+
})
|
|
251563
|
+
: false;
|
|
251474
251564
|
}
|
|
251475
251565
|
function isDeclaredInsideLocalScope(node, localScopes) {
|
|
251476
251566
|
return localScopes.some((scope) => isNodeInsideFunctionScope(node, scope));
|
|
@@ -251502,12 +251592,9 @@ function isLocallyCreatedExpression(node, context, localScopes) {
|
|
|
251502
251592
|
}
|
|
251503
251593
|
}
|
|
251504
251594
|
function hasObservableMutationTarget(node, context, localScopes) {
|
|
251505
|
-
return collectMutationTargets(node).some((target) =>
|
|
251506
|
-
|
|
251507
|
-
|
|
251508
|
-
}
|
|
251509
|
-
return !isLocallyCreatedExpression(target.object, context, localScopes);
|
|
251510
|
-
});
|
|
251595
|
+
return collectMutationTargets(node).some((target) => target.type === dist$3.AST_NODE_TYPES.Identifier
|
|
251596
|
+
? !isLocalIdentifier(target, context, localScopes)
|
|
251597
|
+
: !isLocallyCreatedExpression(target.object, context, localScopes));
|
|
251511
251598
|
}
|
|
251512
251599
|
function reportSideEffect(node, context, report) {
|
|
251513
251600
|
const key = String(node.range);
|
|
@@ -251575,10 +251662,9 @@ function resolveFunctionLikeFromIdentifier(node, context, seenSymbols = new Set(
|
|
|
251575
251662
|
seenSymbols.add(symbolId);
|
|
251576
251663
|
return (symbol.declarations ?? []).flatMap((declaration) => {
|
|
251577
251664
|
const estreeDeclaration = context.tsNodeToESTreeNodeMap.get(declaration);
|
|
251578
|
-
|
|
251579
|
-
|
|
251580
|
-
|
|
251581
|
-
return resolveFunctionLikeFromContainer(estreeDeclaration, context, seenSymbols);
|
|
251665
|
+
return !estreeDeclaration || !isInspectableFunctionContainer(estreeDeclaration)
|
|
251666
|
+
? []
|
|
251667
|
+
: resolveFunctionLikeFromContainer(estreeDeclaration, context, seenSymbols);
|
|
251582
251668
|
});
|
|
251583
251669
|
}
|
|
251584
251670
|
function resolveCalledFunctions(node, context) {
|
|
@@ -251714,7 +251800,7 @@ function inspectComputedBody(root, context, localScopes, visitedFunctions, repor
|
|
|
251714
251800
|
return;
|
|
251715
251801
|
});
|
|
251716
251802
|
}
|
|
251717
|
-
const rule$
|
|
251803
|
+
const rule$s = createRule({
|
|
251718
251804
|
create(context) {
|
|
251719
251805
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode, tsNodeToESTreeNodeMap, } = getTypeAwareRuleContext(context);
|
|
251720
251806
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -251757,7 +251843,7 @@ const rule$r = createRule({
|
|
|
251757
251843
|
name: 'no-side-effects-in-computed',
|
|
251758
251844
|
});
|
|
251759
251845
|
|
|
251760
|
-
const rule$
|
|
251846
|
+
const rule$r = createUntrackedRule({
|
|
251761
251847
|
create(context) {
|
|
251762
251848
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode } = getTypeAwareRuleContext(context);
|
|
251763
251849
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -251804,20 +251890,18 @@ const rule$q = createUntrackedRule({
|
|
|
251804
251890
|
});
|
|
251805
251891
|
|
|
251806
251892
|
function collectParts(node) {
|
|
251807
|
-
|
|
251808
|
-
|
|
251809
|
-
|
|
251810
|
-
return [node];
|
|
251893
|
+
return node.type === dist$3.AST_NODE_TYPES.BinaryExpression && node.operator === '+'
|
|
251894
|
+
? [...collectParts(node.left), ...collectParts(node.right)]
|
|
251895
|
+
: [node];
|
|
251811
251896
|
}
|
|
251812
251897
|
function isRootConcat(node) {
|
|
251813
251898
|
const { parent } = node;
|
|
251814
251899
|
return parent.type !== dist$3.AST_NODE_TYPES.BinaryExpression || parent.operator !== '+';
|
|
251815
251900
|
}
|
|
251816
251901
|
function isStringType(type, checker) {
|
|
251817
|
-
|
|
251818
|
-
|
|
251819
|
-
|
|
251820
|
-
return type.isStringLiteral() || checker.typeToString(type) === 'string';
|
|
251902
|
+
return type.isUnion()
|
|
251903
|
+
? type.types.every((t) => isStringType(t, checker))
|
|
251904
|
+
: type.isStringLiteral() || checker.typeToString(type) === 'string';
|
|
251821
251905
|
}
|
|
251822
251906
|
function buildMergedString(parts) {
|
|
251823
251907
|
const combined = parts.map((p) => p.value).join('');
|
|
@@ -251851,7 +251935,7 @@ function templateContent(template, renderExpr) {
|
|
|
251851
251935
|
: ''}`)
|
|
251852
251936
|
.join('');
|
|
251853
251937
|
}
|
|
251854
|
-
const rule$
|
|
251938
|
+
const rule$q = createRule({
|
|
251855
251939
|
create(context) {
|
|
251856
251940
|
const { sourceCode } = context;
|
|
251857
251941
|
let parserServices = null;
|
|
@@ -251963,28 +252047,25 @@ function buildUntrackedImportFixes(program, fixer) {
|
|
|
251963
252047
|
const coreImport = findRuntimeAngularCoreImport(program);
|
|
251964
252048
|
if (!coreImport) {
|
|
251965
252049
|
const firstStatement = program.body[0];
|
|
251966
|
-
|
|
251967
|
-
|
|
251968
|
-
|
|
251969
|
-
|
|
251970
|
-
|
|
251971
|
-
];
|
|
252050
|
+
return firstStatement
|
|
252051
|
+
? [
|
|
252052
|
+
fixer.insertTextBefore(firstStatement, "import { untracked } from '@angular/core';\n"),
|
|
252053
|
+
]
|
|
252054
|
+
: [];
|
|
251972
252055
|
}
|
|
251973
252056
|
const namedSpecifiers = coreImport.specifiers.filter((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportSpecifier);
|
|
251974
252057
|
if (namedSpecifiers.length > 0) {
|
|
251975
252058
|
const lastNamedSpecifier = namedSpecifiers[namedSpecifiers.length - 1];
|
|
251976
|
-
|
|
251977
|
-
|
|
251978
|
-
|
|
251979
|
-
return [fixer.insertTextAfter(lastNamedSpecifier, ', untracked')];
|
|
252059
|
+
return lastNamedSpecifier
|
|
252060
|
+
? [fixer.insertTextAfter(lastNamedSpecifier, ', untracked')]
|
|
252061
|
+
: [];
|
|
251980
252062
|
}
|
|
251981
252063
|
const defaultImport = coreImport.specifiers.find((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
251982
|
-
|
|
251983
|
-
|
|
251984
|
-
|
|
251985
|
-
|
|
251986
|
-
|
|
251987
|
-
];
|
|
252064
|
+
return defaultImport
|
|
252065
|
+
? [fixer.insertTextAfter(defaultImport, ', { untracked }')]
|
|
252066
|
+
: [
|
|
252067
|
+
fixer.insertTextAfter(coreImport, "\nimport { untracked } from '@angular/core';"),
|
|
252068
|
+
];
|
|
251988
252069
|
}
|
|
251989
252070
|
/**
|
|
251990
252071
|
* Removes the `untracked` import specifier from `@angular/core`.
|
|
@@ -251996,7 +252077,6 @@ function buildImportRemovalFixes(program, fixer, sourceCode) {
|
|
|
251996
252077
|
return [];
|
|
251997
252078
|
}
|
|
251998
252079
|
const { importDecl, specifier: untrackedSpec } = match;
|
|
251999
|
-
const namedSpecifiers = importDecl.specifiers.filter((s) => s.type === dist$3.AST_NODE_TYPES.ImportSpecifier);
|
|
252000
252080
|
if (importDecl.specifiers.length === 1) {
|
|
252001
252081
|
return [fixer.remove(importDecl)];
|
|
252002
252082
|
}
|
|
@@ -252014,24 +252094,19 @@ function buildImportRemovalFixes(program, fixer, sourceCode) {
|
|
|
252014
252094
|
// Try to remove a leading comma (last specifier)
|
|
252015
252095
|
const textBefore = importText.slice(0, specStart - importStart);
|
|
252016
252096
|
const leadingCommaIdx = textBefore.lastIndexOf(',');
|
|
252017
|
-
|
|
252018
|
-
|
|
252019
|
-
|
|
252020
|
-
if (namedSpecifiers.length === 1) {
|
|
252021
|
-
return [fixer.remove(untrackedSpec)];
|
|
252022
|
-
}
|
|
252023
|
-
return [fixer.remove(untrackedSpec)];
|
|
252097
|
+
return leadingCommaIdx === -1
|
|
252098
|
+
? [fixer.remove(untrackedSpec)]
|
|
252099
|
+
: [fixer.removeRange([importStart + leadingCommaIdx, specEnd])];
|
|
252024
252100
|
}
|
|
252025
252101
|
|
|
252026
252102
|
function hasNamedDecorator(node, name) {
|
|
252027
252103
|
return node.decorators.some((decorator) => {
|
|
252028
252104
|
const expression = decorator.expression;
|
|
252029
|
-
|
|
252030
|
-
|
|
252031
|
-
|
|
252032
|
-
|
|
252033
|
-
|
|
252034
|
-
expression.callee.name === name);
|
|
252105
|
+
return expression.type === dist$3.AST_NODE_TYPES.Identifier
|
|
252106
|
+
? expression.name === name
|
|
252107
|
+
: expression.type === dist$3.AST_NODE_TYPES.CallExpression &&
|
|
252108
|
+
expression.callee.type === dist$3.AST_NODE_TYPES.Identifier &&
|
|
252109
|
+
expression.callee.name === name;
|
|
252035
252110
|
});
|
|
252036
252111
|
}
|
|
252037
252112
|
|
|
@@ -252087,13 +252162,12 @@ function dedent(text, extraSpaces) {
|
|
|
252087
252162
|
|
|
252088
252163
|
function isDirectCallOrNewArgument(node) {
|
|
252089
252164
|
const parent = node.parent;
|
|
252090
|
-
|
|
252091
|
-
node.type !== dist$3.AST_NODE_TYPES.FunctionExpression
|
|
252092
|
-
|
|
252093
|
-
|
|
252094
|
-
|
|
252095
|
-
|
|
252096
|
-
parent.arguments.includes(node));
|
|
252165
|
+
return node.type !== dist$3.AST_NODE_TYPES.ArrowFunctionExpression &&
|
|
252166
|
+
node.type !== dist$3.AST_NODE_TYPES.FunctionExpression
|
|
252167
|
+
? false
|
|
252168
|
+
: (parent.type === dist$3.AST_NODE_TYPES.CallExpression ||
|
|
252169
|
+
parent.type === dist$3.AST_NODE_TYPES.NewExpression) &&
|
|
252170
|
+
parent.arguments.includes(node);
|
|
252097
252171
|
}
|
|
252098
252172
|
function isStoredFunctionUsedAsCallOrNewArgument(fn, checker, esTreeNodeToTSNodeMap) {
|
|
252099
252173
|
const parent = fn.parent;
|
|
@@ -252164,29 +252238,26 @@ function isAllowedDeferredCallbackContext(node, checker, esTreeNodeToTSNodeMap)
|
|
|
252164
252238
|
return false;
|
|
252165
252239
|
}
|
|
252166
252240
|
const fn = getEnclosingFunction(node);
|
|
252167
|
-
|
|
252168
|
-
|
|
252169
|
-
|
|
252170
|
-
|
|
252171
|
-
isStoredFunctionUsedAsCallOrNewArgument(fn, checker, esTreeNodeToTSNodeMap));
|
|
252241
|
+
return fn
|
|
252242
|
+
? isDirectCallOrNewArgument(fn) ||
|
|
252243
|
+
isStoredFunctionUsedAsCallOrNewArgument(fn, checker, esTreeNodeToTSNodeMap)
|
|
252244
|
+
: false;
|
|
252172
252245
|
}
|
|
252173
252246
|
function isAllowedLazyAngularFactoryContext(node, program) {
|
|
252174
252247
|
const fn = getEnclosingFunction(node);
|
|
252175
|
-
|
|
252176
|
-
|
|
252177
|
-
|
|
252178
|
-
|
|
252179
|
-
isAngularUseFactoryFunction(fn));
|
|
252248
|
+
return !fn || !getReturnedReactiveOwnerCall(node, program)
|
|
252249
|
+
? false
|
|
252250
|
+
: isAngularInjectionTokenFactoryFunction(fn, program) ||
|
|
252251
|
+
isAngularUseFactoryFunction(fn);
|
|
252180
252252
|
}
|
|
252181
252253
|
function buildReactiveCallReplacement(outerUntrackedCall, reactiveCall, sourceCode) {
|
|
252182
252254
|
const text = sourceCode.getText(reactiveCall);
|
|
252183
|
-
|
|
252184
|
-
outerUntrackedCall.parent.type !== dist$3.AST_NODE_TYPES.ExpressionStatement
|
|
252185
|
-
|
|
252186
|
-
|
|
252187
|
-
return dedent(text, reactiveCall.loc.start.column - outerUntrackedCall.parent.loc.start.column);
|
|
252255
|
+
return reactiveCall.parent.type !== dist$3.AST_NODE_TYPES.ExpressionStatement ||
|
|
252256
|
+
outerUntrackedCall.parent.type !== dist$3.AST_NODE_TYPES.ExpressionStatement
|
|
252257
|
+
? text
|
|
252258
|
+
: dedent(text, reactiveCall.loc.start.column - outerUntrackedCall.parent.loc.start.column);
|
|
252188
252259
|
}
|
|
252189
|
-
const rule$
|
|
252260
|
+
const rule$p = createUntrackedRule({
|
|
252190
252261
|
create(context) {
|
|
252191
252262
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode } = getTypeAwareRuleContext(context);
|
|
252192
252263
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -252315,7 +252386,7 @@ function hasOpaqueSynchronousCalls(root, checker, esTreeNodeToTSNodeMap, program
|
|
|
252315
252386
|
});
|
|
252316
252387
|
return found;
|
|
252317
252388
|
}
|
|
252318
|
-
const rule$
|
|
252389
|
+
const rule$o = createUntrackedRule({
|
|
252319
252390
|
create(context) {
|
|
252320
252391
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode } = getTypeAwareRuleContext(context);
|
|
252321
252392
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -252397,17 +252468,16 @@ const rule$n = createUntrackedRule({
|
|
|
252397
252468
|
name: 'no-useless-untracked',
|
|
252398
252469
|
});
|
|
252399
252470
|
|
|
252400
|
-
const rule$
|
|
252471
|
+
const rule$n = createRule({
|
|
252401
252472
|
create(context, [{ printWidth }]) {
|
|
252402
252473
|
const sourceCode = context.sourceCode;
|
|
252403
252474
|
const getLineEndIndex = (lineStartIndex) => {
|
|
252404
252475
|
const text = sourceCode.text;
|
|
252405
252476
|
const newLineIndex = text.indexOf('\n', lineStartIndex);
|
|
252406
252477
|
const rawEndIndex = newLineIndex === -1 ? text.length : newLineIndex;
|
|
252407
|
-
|
|
252408
|
-
|
|
252409
|
-
|
|
252410
|
-
return rawEndIndex;
|
|
252478
|
+
return rawEndIndex > lineStartIndex && text[rawEndIndex - 1] === '\r'
|
|
252479
|
+
? rawEndIndex - 1
|
|
252480
|
+
: rawEndIndex;
|
|
252411
252481
|
};
|
|
252412
252482
|
const hasAnyCommentsInside = (node) => sourceCode.getCommentsInside(node).length > 0;
|
|
252413
252483
|
const isTemplateLikeExpression = (expression) => expression.type === dist$2.AST_NODE_TYPES.TemplateLiteral ||
|
|
@@ -252479,34 +252549,28 @@ const rule$m = createRule({
|
|
|
252479
252549
|
const valueExpression = property.value;
|
|
252480
252550
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
252481
252551
|
const valueText = renderExpressionOneLine(valueExpression);
|
|
252482
|
-
|
|
252483
|
-
|
|
252484
|
-
|
|
252485
|
-
return `${keyText}: ${valueText}`;
|
|
252552
|
+
return property.computed
|
|
252553
|
+
? `[${keyText}]: ${valueText}`
|
|
252554
|
+
: `${keyText}: ${valueText}`;
|
|
252486
252555
|
};
|
|
252487
252556
|
const renderObjectExpressionOneLine = (node) => {
|
|
252488
252557
|
const [onlyProperty] = node.properties;
|
|
252489
|
-
|
|
252490
|
-
return '{}';
|
|
252491
|
-
}
|
|
252492
|
-
return `{${renderPropertyOneLine(onlyProperty)}}`;
|
|
252558
|
+
return onlyProperty ? `{${renderPropertyOneLine(onlyProperty)}}` : '{}';
|
|
252493
252559
|
};
|
|
252494
252560
|
const renderExpressionOneLine = (expression) => {
|
|
252495
252561
|
const innerParen = getParenthesizedInner(expression);
|
|
252496
252562
|
if (innerParen) {
|
|
252497
252563
|
const inner = unwrapExpression(innerParen);
|
|
252498
|
-
|
|
252499
|
-
canInlineObjectExpression(inner)
|
|
252500
|
-
|
|
252501
|
-
|
|
252502
|
-
return sourceCode.getText(expression);
|
|
252564
|
+
return inner.type === dist$2.AST_NODE_TYPES.ObjectExpression &&
|
|
252565
|
+
canInlineObjectExpression(inner)
|
|
252566
|
+
? `(${renderObjectExpressionOneLine(inner)})`
|
|
252567
|
+
: sourceCode.getText(expression);
|
|
252503
252568
|
}
|
|
252504
252569
|
const unwrapped = unwrapExpression(expression);
|
|
252505
|
-
|
|
252506
|
-
canInlineObjectExpression(unwrapped)
|
|
252507
|
-
|
|
252508
|
-
|
|
252509
|
-
return sourceCode.getText(expression);
|
|
252570
|
+
return unwrapped.type === dist$2.AST_NODE_TYPES.ObjectExpression &&
|
|
252571
|
+
canInlineObjectExpression(unwrapped)
|
|
252572
|
+
? renderObjectExpressionOneLine(unwrapped)
|
|
252573
|
+
: sourceCode.getText(expression);
|
|
252510
252574
|
};
|
|
252511
252575
|
const hasPendingInnerInlineCandidate = (node) => {
|
|
252512
252576
|
if (node.properties.length !== 1) {
|
|
@@ -252718,7 +252782,7 @@ function renderTest(node, sourceCode) {
|
|
|
252718
252782
|
const text = sourceCode.getText(node);
|
|
252719
252783
|
return needsParenthesesInOrChain(node) ? `(${text})` : text;
|
|
252720
252784
|
}
|
|
252721
|
-
const rule$
|
|
252785
|
+
const rule$m = createRule({
|
|
252722
252786
|
create(context) {
|
|
252723
252787
|
const { sourceCode } = context;
|
|
252724
252788
|
function checkBody(statements) {
|
|
@@ -252807,6 +252871,169 @@ const rule$l = createRule({
|
|
|
252807
252871
|
name: 'prefer-combined-if-control-flow',
|
|
252808
252872
|
});
|
|
252809
252873
|
|
|
252874
|
+
const MAX_INLINE_CONDITIONAL_RETURN_LENGTH = 90;
|
|
252875
|
+
function getReturnStatement(statement) {
|
|
252876
|
+
if (statement.type === dist$3.AST_NODE_TYPES.ReturnStatement) {
|
|
252877
|
+
return statement;
|
|
252878
|
+
}
|
|
252879
|
+
if (statement.type !== dist$3.AST_NODE_TYPES.BlockStatement || statement.body.length !== 1) {
|
|
252880
|
+
return null;
|
|
252881
|
+
}
|
|
252882
|
+
const [onlyStatement] = statement.body;
|
|
252883
|
+
return onlyStatement?.type === dist$3.AST_NODE_TYPES.ReturnStatement ? onlyStatement : null;
|
|
252884
|
+
}
|
|
252885
|
+
function hasOnlyWhitespaceBetween(sourceCode, left, right) {
|
|
252886
|
+
return sourceCode.text.slice(left.range[1], right.range[0]).trim() === '';
|
|
252887
|
+
}
|
|
252888
|
+
function unwrapTypeAndParentheses(node) {
|
|
252889
|
+
let current = node;
|
|
252890
|
+
let didUnwrap = true;
|
|
252891
|
+
while (didUnwrap) {
|
|
252892
|
+
didUnwrap = false;
|
|
252893
|
+
const parenthesized = unwrapParenthesized(current);
|
|
252894
|
+
if (parenthesized !== current) {
|
|
252895
|
+
current = parenthesized;
|
|
252896
|
+
didUnwrap = true;
|
|
252897
|
+
continue;
|
|
252898
|
+
}
|
|
252899
|
+
switch (current.type) {
|
|
252900
|
+
case dist$3.AST_NODE_TYPES.TSAsExpression:
|
|
252901
|
+
case dist$3.AST_NODE_TYPES.TSNonNullExpression:
|
|
252902
|
+
case dist$3.AST_NODE_TYPES.TSSatisfiesExpression:
|
|
252903
|
+
case dist$3.AST_NODE_TYPES.TSTypeAssertion:
|
|
252904
|
+
current = current.expression;
|
|
252905
|
+
didUnwrap = true;
|
|
252906
|
+
break;
|
|
252907
|
+
}
|
|
252908
|
+
}
|
|
252909
|
+
return current;
|
|
252910
|
+
}
|
|
252911
|
+
function isConditionalExpression(node) {
|
|
252912
|
+
return (node !== null &&
|
|
252913
|
+
unwrapTypeAndParentheses(node).type === dist$3.AST_NODE_TYPES.ConditionalExpression);
|
|
252914
|
+
}
|
|
252915
|
+
function needsParenthesesInConditionalTest(node) {
|
|
252916
|
+
if (getParenthesizedInner(node)) {
|
|
252917
|
+
return false;
|
|
252918
|
+
}
|
|
252919
|
+
switch (node.type) {
|
|
252920
|
+
case dist$3.AST_NODE_TYPES.ArrowFunctionExpression:
|
|
252921
|
+
case dist$3.AST_NODE_TYPES.AssignmentExpression:
|
|
252922
|
+
case dist$3.AST_NODE_TYPES.ConditionalExpression:
|
|
252923
|
+
case dist$3.AST_NODE_TYPES.ObjectExpression:
|
|
252924
|
+
case dist$3.AST_NODE_TYPES.SequenceExpression:
|
|
252925
|
+
case dist$3.AST_NODE_TYPES.TSAsExpression:
|
|
252926
|
+
case dist$3.AST_NODE_TYPES.TSSatisfiesExpression:
|
|
252927
|
+
case dist$3.AST_NODE_TYPES.TSTypeAssertion:
|
|
252928
|
+
case dist$3.AST_NODE_TYPES.YieldExpression:
|
|
252929
|
+
return true;
|
|
252930
|
+
default:
|
|
252931
|
+
return false;
|
|
252932
|
+
}
|
|
252933
|
+
}
|
|
252934
|
+
function needsParenthesesInConditionalBranch(node) {
|
|
252935
|
+
if (getParenthesizedInner(node)) {
|
|
252936
|
+
return false;
|
|
252937
|
+
}
|
|
252938
|
+
switch (node.type) {
|
|
252939
|
+
case dist$3.AST_NODE_TYPES.ArrowFunctionExpression:
|
|
252940
|
+
case dist$3.AST_NODE_TYPES.AssignmentExpression:
|
|
252941
|
+
case dist$3.AST_NODE_TYPES.ConditionalExpression:
|
|
252942
|
+
case dist$3.AST_NODE_TYPES.SequenceExpression:
|
|
252943
|
+
case dist$3.AST_NODE_TYPES.TSAsExpression:
|
|
252944
|
+
case dist$3.AST_NODE_TYPES.TSSatisfiesExpression:
|
|
252945
|
+
case dist$3.AST_NODE_TYPES.TSTypeAssertion:
|
|
252946
|
+
case dist$3.AST_NODE_TYPES.YieldExpression:
|
|
252947
|
+
return true;
|
|
252948
|
+
default:
|
|
252949
|
+
return false;
|
|
252950
|
+
}
|
|
252951
|
+
}
|
|
252952
|
+
function renderExpression(node, sourceCode, needsParentheses) {
|
|
252953
|
+
const text = sourceCode.getText(node);
|
|
252954
|
+
return needsParentheses(node) ? `(${text})` : text;
|
|
252955
|
+
}
|
|
252956
|
+
function getStatementIndent(node, sourceCode) {
|
|
252957
|
+
const lineStart = sourceCode.getIndexFromLoc({
|
|
252958
|
+
column: 0,
|
|
252959
|
+
line: node.loc.start.line,
|
|
252960
|
+
});
|
|
252961
|
+
return sourceCode.text.slice(lineStart, node.range[0]);
|
|
252962
|
+
}
|
|
252963
|
+
function renderConditionalReturn(ifStatement, consequentExpression, alternateExpression, sourceCode) {
|
|
252964
|
+
const test = renderExpression(ifStatement.test, sourceCode, needsParenthesesInConditionalTest);
|
|
252965
|
+
const consequent = renderExpression(consequentExpression, sourceCode, needsParenthesesInConditionalBranch);
|
|
252966
|
+
const alternate = renderExpression(alternateExpression, sourceCode, needsParenthesesInConditionalBranch);
|
|
252967
|
+
const inlineReturn = `return ${test} ? ${consequent} : ${alternate};`;
|
|
252968
|
+
const indent = getStatementIndent(ifStatement, sourceCode);
|
|
252969
|
+
if (indent.length + inlineReturn.length <= MAX_INLINE_CONDITIONAL_RETURN_LENGTH) {
|
|
252970
|
+
return inlineReturn;
|
|
252971
|
+
}
|
|
252972
|
+
const branchIndent = `${indent} `;
|
|
252973
|
+
return `return ${test}\n${branchIndent}? ${consequent}\n${branchIndent}: ${alternate};`;
|
|
252974
|
+
}
|
|
252975
|
+
const rule$l = createRule({
|
|
252976
|
+
create(context) {
|
|
252977
|
+
const { sourceCode } = context;
|
|
252978
|
+
function checkBody(statements) {
|
|
252979
|
+
for (const [index, statement] of statements.entries()) {
|
|
252980
|
+
if (statement.type !== dist$3.AST_NODE_TYPES.IfStatement) {
|
|
252981
|
+
continue;
|
|
252982
|
+
}
|
|
252983
|
+
const nextStatement = statements[index + 1];
|
|
252984
|
+
if (nextStatement?.type !== dist$3.AST_NODE_TYPES.ReturnStatement) {
|
|
252985
|
+
continue;
|
|
252986
|
+
}
|
|
252987
|
+
const consequentReturn = getReturnStatement(statement.consequent);
|
|
252988
|
+
const finalReturn = nextStatement;
|
|
252989
|
+
const consequentArgument = consequentReturn?.argument ?? null;
|
|
252990
|
+
const finalArgument = finalReturn.argument;
|
|
252991
|
+
if (statement.alternate ||
|
|
252992
|
+
!consequentArgument ||
|
|
252993
|
+
!finalArgument ||
|
|
252994
|
+
isConditionalExpression(consequentArgument) ||
|
|
252995
|
+
isConditionalExpression(finalArgument) ||
|
|
252996
|
+
!hasOnlyWhitespaceBetween(sourceCode, statement, finalReturn) ||
|
|
252997
|
+
sourceCode.getCommentsInside(statement).length > 0 ||
|
|
252998
|
+
sourceCode.getCommentsInside(finalReturn).length > 0) {
|
|
252999
|
+
continue;
|
|
253000
|
+
}
|
|
253001
|
+
context.report({
|
|
253002
|
+
fix(fixer) {
|
|
253003
|
+
const replacement = renderConditionalReturn(statement, consequentArgument, finalArgument, sourceCode);
|
|
253004
|
+
return fixer.replaceTextRange([statement.range[0], finalReturn.range[1]], replacement);
|
|
253005
|
+
},
|
|
253006
|
+
messageId: 'preferConditionalReturn',
|
|
253007
|
+
node: statement,
|
|
253008
|
+
});
|
|
253009
|
+
}
|
|
253010
|
+
}
|
|
253011
|
+
return {
|
|
253012
|
+
BlockStatement(node) {
|
|
253013
|
+
checkBody(node.body);
|
|
253014
|
+
},
|
|
253015
|
+
Program(node) {
|
|
253016
|
+
checkBody(node.body);
|
|
253017
|
+
},
|
|
253018
|
+
SwitchCase(node) {
|
|
253019
|
+
checkBody(node.consequent);
|
|
253020
|
+
},
|
|
253021
|
+
};
|
|
253022
|
+
},
|
|
253023
|
+
meta: {
|
|
253024
|
+
docs: {
|
|
253025
|
+
description: 'Prefer a single conditional return over an if statement followed by another return statement.',
|
|
253026
|
+
},
|
|
253027
|
+
fixable: 'code',
|
|
253028
|
+
messages: {
|
|
253029
|
+
preferConditionalReturn: 'Replace this if/return pair with a single conditional return.',
|
|
253030
|
+
},
|
|
253031
|
+
schema: [],
|
|
253032
|
+
type: 'suggestion',
|
|
253033
|
+
},
|
|
253034
|
+
name: 'prefer-conditional-return',
|
|
253035
|
+
});
|
|
253036
|
+
|
|
252810
253037
|
function parseStrictNullCheck(node, getText) {
|
|
252811
253038
|
if (node.type !== dist$3.AST_NODE_TYPES.BinaryExpression) {
|
|
252812
253039
|
return null;
|
|
@@ -252824,29 +253051,26 @@ function parseStrictNullCheck(node, getText) {
|
|
|
252824
253051
|
if (left.type === dist$3.AST_NODE_TYPES.Literal && left.value === null) {
|
|
252825
253052
|
return { comparedWith: 'null', operand: getText(right), strictOp: operator };
|
|
252826
253053
|
}
|
|
252827
|
-
|
|
252828
|
-
|
|
252829
|
-
|
|
252830
|
-
return null;
|
|
253054
|
+
return left.type === dist$3.AST_NODE_TYPES.Identifier && left.name === 'undefined'
|
|
253055
|
+
? { comparedWith: 'undefined', operand: getText(right), strictOp: operator }
|
|
253056
|
+
: null;
|
|
252831
253057
|
}
|
|
252832
253058
|
function isParsedNullCheck(value) {
|
|
252833
253059
|
return value !== null;
|
|
252834
253060
|
}
|
|
252835
253061
|
function getLooseNullCheck(left, right) {
|
|
252836
|
-
|
|
253062
|
+
return !isParsedNullCheck(left) ||
|
|
252837
253063
|
!isParsedNullCheck(right) ||
|
|
252838
253064
|
left.strictOp !== right.strictOp ||
|
|
252839
253065
|
left.operand !== right.operand ||
|
|
252840
|
-
left.comparedWith === right.comparedWith
|
|
252841
|
-
|
|
252842
|
-
|
|
252843
|
-
return `${left.operand} ${left.strictOp === '!==' ? '!=' : '=='} null`;
|
|
253066
|
+
left.comparedWith === right.comparedWith
|
|
253067
|
+
? null
|
|
253068
|
+
: `${left.operand} ${left.strictOp === '!==' ? '!=' : '=='} null`;
|
|
252844
253069
|
}
|
|
252845
253070
|
function collectAndLeaves(node) {
|
|
252846
|
-
|
|
252847
|
-
|
|
252848
|
-
|
|
252849
|
-
return [node];
|
|
253071
|
+
return node.type === dist$3.AST_NODE_TYPES.LogicalExpression && node.operator === '&&'
|
|
253072
|
+
? [...collectAndLeaves(node.left), ...collectAndLeaves(node.right)]
|
|
253073
|
+
: [node];
|
|
252850
253074
|
}
|
|
252851
253075
|
function isAndChainRoot(node) {
|
|
252852
253076
|
return (node.parent.type !== dist$3.AST_NODE_TYPES.LogicalExpression ||
|
|
@@ -252920,10 +253144,9 @@ function getPushCall(node) {
|
|
|
252920
253144
|
return null;
|
|
252921
253145
|
}
|
|
252922
253146
|
const { property } = call.callee;
|
|
252923
|
-
|
|
252924
|
-
|
|
252925
|
-
|
|
252926
|
-
return call;
|
|
253147
|
+
return property.type !== dist$3.AST_NODE_TYPES.Identifier || property.name !== 'push'
|
|
253148
|
+
? null
|
|
253149
|
+
: call;
|
|
252927
253150
|
}
|
|
252928
253151
|
const rule$j = createRule({
|
|
252929
253152
|
create(context) {
|
|
@@ -252971,10 +253194,12 @@ const rule$j = createRule({
|
|
|
252971
253194
|
.map((arg) => sourceCode.getText(arg))
|
|
252972
253195
|
.join(', ');
|
|
252973
253196
|
const lastStmt = group[group.length - 1];
|
|
252974
|
-
|
|
252975
|
-
|
|
252976
|
-
|
|
252977
|
-
|
|
253197
|
+
return lastStmt
|
|
253198
|
+
? fixer.replaceTextRange([
|
|
253199
|
+
groupStmt.range[0],
|
|
253200
|
+
lastStmt.range[1],
|
|
253201
|
+
], `${arrayText}.push(${allArgs});`)
|
|
253202
|
+
: null;
|
|
252978
253203
|
},
|
|
252979
253204
|
}
|
|
252980
253205
|
: {}),
|
|
@@ -253014,10 +253239,9 @@ function getModuleKeywordToken(sourceCode, node) {
|
|
|
253014
253239
|
if (!firstToken) {
|
|
253015
253240
|
return null;
|
|
253016
253241
|
}
|
|
253017
|
-
|
|
253018
|
-
|
|
253019
|
-
|
|
253020
|
-
return firstToken;
|
|
253242
|
+
return firstToken.value === 'declare'
|
|
253243
|
+
? (sourceCode.getTokenAfter(firstToken) ?? null)
|
|
253244
|
+
: firstToken;
|
|
253021
253245
|
}
|
|
253022
253246
|
const rule$i = createRule({
|
|
253023
253247
|
create(context) {
|
|
@@ -253114,20 +253338,18 @@ function unwrapUsageExpression(node) {
|
|
|
253114
253338
|
}
|
|
253115
253339
|
function isStatementPositionCall(node) {
|
|
253116
253340
|
const usage = unwrapUsageExpression(node);
|
|
253117
|
-
|
|
253118
|
-
|
|
253119
|
-
|
|
253120
|
-
|
|
253121
|
-
usage.parent.parent.type === dist$3.AST_NODE_TYPES.ExpressionStatement);
|
|
253341
|
+
return usage.parent?.type === dist$3.AST_NODE_TYPES.ExpressionStatement
|
|
253342
|
+
? true
|
|
253343
|
+
: usage.parent?.type === dist$3.AST_NODE_TYPES.AwaitExpression &&
|
|
253344
|
+
usage.parent.parent.type === dist$3.AST_NODE_TYPES.ExpressionStatement;
|
|
253122
253345
|
}
|
|
253123
253346
|
function isConsoleMethodCall(node) {
|
|
253124
|
-
|
|
253347
|
+
return node.callee.type !== dist$3.AST_NODE_TYPES.MemberExpression ||
|
|
253125
253348
|
node.callee.object.type !== dist$3.AST_NODE_TYPES.Identifier ||
|
|
253126
253349
|
node.callee.object.name !== 'console' ||
|
|
253127
|
-
node.callee.property.type !== dist$3.AST_NODE_TYPES.Identifier
|
|
253128
|
-
|
|
253129
|
-
|
|
253130
|
-
return CONSOLE_METHODS.has(node.callee.property.name);
|
|
253350
|
+
node.callee.property.type !== dist$3.AST_NODE_TYPES.Identifier
|
|
253351
|
+
? false
|
|
253352
|
+
: CONSOLE_METHODS.has(node.callee.property.name);
|
|
253131
253353
|
}
|
|
253132
253354
|
function isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap) {
|
|
253133
253355
|
if (node.callee.type === dist$3.AST_NODE_TYPES.MemberExpression &&
|
|
@@ -253149,14 +253371,13 @@ function isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
253149
253371
|
return returnType === 'void' || returnType === 'Promise<void>';
|
|
253150
253372
|
}
|
|
253151
253373
|
function isSuspiciousDomCallArgumentConsumer(node, checker, esTreeNodeToTSNodeMap, program) {
|
|
253152
|
-
|
|
253374
|
+
return isAngularUntrackedCall(node, program) ||
|
|
253153
253375
|
isSignalReadCall(node, checker, esTreeNodeToTSNodeMap) ||
|
|
253154
253376
|
isWritableSignalWrite(node, checker, esTreeNodeToTSNodeMap) ||
|
|
253155
253377
|
!isStatementPositionCall(node) ||
|
|
253156
|
-
isConsoleMethodCall(node)
|
|
253157
|
-
|
|
253158
|
-
|
|
253159
|
-
return isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap);
|
|
253378
|
+
isConsoleMethodCall(node)
|
|
253379
|
+
? false
|
|
253380
|
+
: isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap);
|
|
253160
253381
|
}
|
|
253161
253382
|
function isAliasDeclarationIdentifier(node) {
|
|
253162
253383
|
return (node.type === dist$3.AST_NODE_TYPES.Identifier &&
|
|
@@ -253298,13 +253519,12 @@ const rule$h = createUntrackedRule({
|
|
|
253298
253519
|
const untrackedAlias = findUntrackedAlias(program);
|
|
253299
253520
|
const alreadyHasUntracked = untrackedAlias != null;
|
|
253300
253521
|
const wrapped = buildUntrackedWrap(read, sourceCode, untrackedAlias ?? 'untracked');
|
|
253301
|
-
|
|
253302
|
-
|
|
253303
|
-
|
|
253304
|
-
|
|
253305
|
-
|
|
253306
|
-
|
|
253307
|
-
];
|
|
253522
|
+
return alreadyHasUntracked
|
|
253523
|
+
? (fixer) => [fixer.replaceText(read, wrapped)]
|
|
253524
|
+
: (fixer) => [
|
|
253525
|
+
fixer.replaceText(read, wrapped),
|
|
253526
|
+
...buildUntrackedImportFixes(program, fixer),
|
|
253527
|
+
];
|
|
253308
253528
|
}
|
|
253309
253529
|
return {
|
|
253310
253530
|
CallExpression(node) {
|
|
@@ -253353,10 +253573,9 @@ function getReturnedExpression(node) {
|
|
|
253353
253573
|
return null;
|
|
253354
253574
|
}
|
|
253355
253575
|
const statement = node.body.body[0];
|
|
253356
|
-
|
|
253357
|
-
|
|
253358
|
-
|
|
253359
|
-
return statement.argument;
|
|
253576
|
+
return statement?.type !== dist$3.AST_NODE_TYPES.ReturnStatement || !statement.argument
|
|
253577
|
+
? null
|
|
253578
|
+
: statement.argument;
|
|
253360
253579
|
}
|
|
253361
253580
|
|
|
253362
253581
|
function getWrappedSignalGetter(node, checker, esTreeNodeToTSNodeMap) {
|
|
@@ -253749,17 +253968,23 @@ function isArray(node) {
|
|
|
253749
253968
|
}
|
|
253750
253969
|
|
|
253751
253970
|
function isImportsArrayProperty(property) {
|
|
253752
|
-
|
|
253753
|
-
|
|
253971
|
+
if (property?.type !== dist$3.AST_NODE_TYPES.Property) {
|
|
253972
|
+
return false;
|
|
253973
|
+
}
|
|
253974
|
+
const hasIdentifierKey = property.key.type === dist$3.AST_NODE_TYPES.Identifier &&
|
|
253754
253975
|
property.key.name === 'imports';
|
|
253755
|
-
return
|
|
253976
|
+
return hasIdentifierKey && isArray(property.value);
|
|
253977
|
+
}
|
|
253978
|
+
|
|
253979
|
+
function getImportsArray(meta) {
|
|
253980
|
+
const property = meta.properties.find(isImportsArrayProperty);
|
|
253981
|
+
return property?.value ?? null;
|
|
253756
253982
|
}
|
|
253757
253983
|
|
|
253758
253984
|
function getImportedName$1(spec) {
|
|
253759
|
-
|
|
253760
|
-
|
|
253761
|
-
|
|
253762
|
-
return spec.imported.value;
|
|
253985
|
+
return spec.imported.type === dist$3.AST_NODE_TYPES.Identifier
|
|
253986
|
+
? spec.imported.name
|
|
253987
|
+
: spec.imported.value;
|
|
253763
253988
|
}
|
|
253764
253989
|
|
|
253765
253990
|
const MESSAGE_ID$3 = 'replaceTuiImport';
|
|
@@ -253774,28 +253999,19 @@ const DEFAULT_EXCEPTIONS = [
|
|
|
253774
253999
|
const rule$9 = createRule({
|
|
253775
254000
|
create(context, [{ decorators = DEFAULT_DECORATORS, exceptions = DEFAULT_EXCEPTIONS }]) {
|
|
253776
254001
|
const sourceCode = context.getSourceCode();
|
|
254002
|
+
const allowedDecorators = new Set(decorators);
|
|
253777
254003
|
const importedFromTaiga = {};
|
|
253778
|
-
const decoratorSelector = `Decorator[expression.callee.name=/^(${decorators.join('|')})$/]`;
|
|
253779
254004
|
return {
|
|
253780
|
-
|
|
253781
|
-
const
|
|
253782
|
-
|
|
253783
|
-
expression.arguments.length === 0;
|
|
253784
|
-
if (isInvalidExpression) {
|
|
253785
|
-
return;
|
|
253786
|
-
}
|
|
253787
|
-
const [arg] = expression.arguments;
|
|
253788
|
-
const isNotObject = arg?.type !== dist$3.AST_NODE_TYPES.ObjectExpression;
|
|
253789
|
-
if (isNotObject) {
|
|
254005
|
+
Decorator(decorator) {
|
|
254006
|
+
const metadata = getDecoratorMetadata(decorator, allowedDecorators);
|
|
254007
|
+
if (!metadata) {
|
|
253790
254008
|
return;
|
|
253791
254009
|
}
|
|
253792
|
-
const
|
|
253793
|
-
|
|
253794
|
-
.find((literal) => isImportsArrayProperty(literal));
|
|
253795
|
-
if (!importsProperty) {
|
|
254010
|
+
const importsArray = getImportsArray(metadata);
|
|
254011
|
+
if (!importsArray) {
|
|
253796
254012
|
return;
|
|
253797
254013
|
}
|
|
253798
|
-
const imports =
|
|
254014
|
+
const imports = importsArray.elements.filter((el) => {
|
|
253799
254015
|
const isIdentifier = el?.type === dist$3.AST_NODE_TYPES.Identifier;
|
|
253800
254016
|
return Boolean(el && isIdentifier);
|
|
253801
254017
|
});
|
|
@@ -253956,10 +254172,7 @@ function getLineBreak(text) {
|
|
|
253956
254172
|
if (text.includes('\r\n')) {
|
|
253957
254173
|
return '\r\n';
|
|
253958
254174
|
}
|
|
253959
|
-
|
|
253960
|
-
return '\r';
|
|
253961
|
-
}
|
|
253962
|
-
return '\n';
|
|
254175
|
+
return text.includes('\r') ? '\r' : '\n';
|
|
253963
254176
|
}
|
|
253964
254177
|
function getLeadingIndentation(text) {
|
|
253965
254178
|
let index = 0;
|
|
@@ -254073,11 +254286,10 @@ function getVariableSpacingStatement(node) {
|
|
|
254073
254286
|
if (node.type === dist$3.AST_NODE_TYPES.VariableDeclaration) {
|
|
254074
254287
|
return { declaration: node, exported: false, node };
|
|
254075
254288
|
}
|
|
254076
|
-
|
|
254077
|
-
node.declaration?.type !== dist$3.AST_NODE_TYPES.VariableDeclaration
|
|
254078
|
-
|
|
254079
|
-
|
|
254080
|
-
return { declaration: node.declaration, exported: true, node };
|
|
254289
|
+
return node.type !== dist$3.AST_NODE_TYPES.ExportNamedDeclaration ||
|
|
254290
|
+
node.declaration?.type !== dist$3.AST_NODE_TYPES.VariableDeclaration
|
|
254291
|
+
? null
|
|
254292
|
+
: { declaration: node.declaration, exported: true, node };
|
|
254081
254293
|
}
|
|
254082
254294
|
function isRequireCall(node) {
|
|
254083
254295
|
return (node.type === dist$3.AST_NODE_TYPES.CallExpression &&
|
|
@@ -254099,10 +254311,9 @@ function isImportLikeInitializer(node) {
|
|
|
254099
254311
|
if (initializer.type === dist$3.AST_NODE_TYPES.MemberExpression) {
|
|
254100
254312
|
return isImportLikeInitializer(initializer.object);
|
|
254101
254313
|
}
|
|
254102
|
-
|
|
254103
|
-
|
|
254104
|
-
|
|
254105
|
-
return false;
|
|
254314
|
+
return initializer.type === dist$3.AST_NODE_TYPES.CallExpression
|
|
254315
|
+
? isImportLikeInitializer(initializer.callee)
|
|
254316
|
+
: false;
|
|
254106
254317
|
}
|
|
254107
254318
|
function isImportLikeVariableDeclaration(declaration) {
|
|
254108
254319
|
if (declaration.declarations.length !== 1) {
|
|
@@ -254110,10 +254321,7 @@ function isImportLikeVariableDeclaration(declaration) {
|
|
|
254110
254321
|
}
|
|
254111
254322
|
const [declarator] = declaration.declarations;
|
|
254112
254323
|
const init = declarator.init;
|
|
254113
|
-
|
|
254114
|
-
return false;
|
|
254115
|
-
}
|
|
254116
|
-
return isImportLikeInitializer(init);
|
|
254324
|
+
return init ? isImportLikeInitializer(init) : false;
|
|
254117
254325
|
}
|
|
254118
254326
|
const rule$7 = createRule({
|
|
254119
254327
|
create(context) {
|
|
@@ -254214,14 +254422,6 @@ const rule$7 = createRule({
|
|
|
254214
254422
|
name: 'single-line-variable-spacing',
|
|
254215
254423
|
});
|
|
254216
254424
|
|
|
254217
|
-
function getImportsArray(meta) {
|
|
254218
|
-
const property = meta.properties.find((literal) => literal.type === dist$2.AST_NODE_TYPES.Property &&
|
|
254219
|
-
literal.key.type === dist$2.AST_NODE_TYPES.Identifier &&
|
|
254220
|
-
literal.key.name === 'imports' &&
|
|
254221
|
-
isArray(literal.value));
|
|
254222
|
-
return property ? property.value : null;
|
|
254223
|
-
}
|
|
254224
|
-
|
|
254225
254425
|
function isSpread(node) {
|
|
254226
254426
|
return node.type === dist$2.AST_NODE_TYPES.SpreadElement;
|
|
254227
254427
|
}
|
|
@@ -254261,11 +254461,12 @@ function nameOf(node, source) {
|
|
|
254261
254461
|
return source.getText(node);
|
|
254262
254462
|
}
|
|
254263
254463
|
|
|
254464
|
+
const IMPORT_NAME_COLLATOR = new Intl.Collator('en', { numeric: true });
|
|
254264
254465
|
/**
|
|
254265
|
-
* Sorts Angular standalone import elements into a deterministic,
|
|
254466
|
+
* Sorts Angular standalone import elements into a deterministic, natural order.
|
|
254266
254467
|
*
|
|
254267
254468
|
* The sorting rules:
|
|
254268
|
-
* 1. Regular elements (Identifiers, MemberExpressions, etc.) are sorted
|
|
254469
|
+
* 1. Regular elements (Identifiers, MemberExpressions, etc.) are sorted naturally.
|
|
254269
254470
|
* 2. Spread elements (e.g. `...A`) are sorted separately and placed after regular ones.
|
|
254270
254471
|
* 3. Sorting is based on the string value returned by `nameOf()`.
|
|
254271
254472
|
*
|
|
@@ -254284,10 +254485,13 @@ function nameOf(node, source) {
|
|
|
254284
254485
|
function getSortedNames(elements, source) {
|
|
254285
254486
|
const regular = elements.filter((e) => !isSpread(e));
|
|
254286
254487
|
const spreads = elements.filter((e) => isSpread(e));
|
|
254287
|
-
const sortedRegular = [...regular].sort((a, b) => nameOf(a, source)
|
|
254288
|
-
const sortedSpreads = [...spreads].sort((a, b) => nameOf(a.argument, source)
|
|
254488
|
+
const sortedRegular = [...regular].sort((a, b) => compareImportNames(nameOf(a, source), nameOf(b, source)));
|
|
254489
|
+
const sortedSpreads = [...spreads].sort((a, b) => compareImportNames(nameOf(a.argument, source), nameOf(b.argument, source)));
|
|
254289
254490
|
return [...sortedRegular, ...sortedSpreads].map((n) => nameOf(n, source));
|
|
254290
254491
|
}
|
|
254492
|
+
function compareImportNames(x, y) {
|
|
254493
|
+
return IMPORT_NAME_COLLATOR.compare(x, y);
|
|
254494
|
+
}
|
|
254291
254495
|
|
|
254292
254496
|
const rule$6 = createRule({
|
|
254293
254497
|
create(context, [options]) {
|
|
@@ -254522,12 +254726,11 @@ function getConstArray(node) {
|
|
|
254522
254726
|
|
|
254523
254727
|
function isClassType(type) {
|
|
254524
254728
|
const symbol = type.getSymbol();
|
|
254525
|
-
|
|
254526
|
-
|
|
254527
|
-
|
|
254528
|
-
|
|
254529
|
-
|
|
254530
|
-
?.some((d) => ts.isClassDeclaration(d) || ts.isClassExpression(d)) ?? false);
|
|
254729
|
+
return symbol
|
|
254730
|
+
? (symbol
|
|
254731
|
+
.getDeclarations()
|
|
254732
|
+
?.some((d) => ts.isClassDeclaration(d) || ts.isClassExpression(d)) ?? false)
|
|
254733
|
+
: false;
|
|
254531
254734
|
}
|
|
254532
254735
|
|
|
254533
254736
|
function isExternalPureTuple(typeChecker, type) {
|
|
@@ -254536,10 +254739,7 @@ function isExternalPureTuple(typeChecker, type) {
|
|
|
254536
254739
|
}
|
|
254537
254740
|
const typeRef = type;
|
|
254538
254741
|
const typeArgs = typeChecker.getTypeArguments(typeRef);
|
|
254539
|
-
|
|
254540
|
-
return false;
|
|
254541
|
-
}
|
|
254542
|
-
return typeArgs.every((item) => isClassType(item));
|
|
254742
|
+
return typeArgs.length === 0 ? false : typeArgs.every((item) => isClassType(item));
|
|
254543
254743
|
}
|
|
254544
254744
|
|
|
254545
254745
|
const MESSAGE_ID$2 = 'spreadArrays';
|
|
@@ -254893,10 +255093,7 @@ function normalizeImportFilter(importFilter) {
|
|
|
254893
255093
|
function getRootPackageName(importPath) {
|
|
254894
255094
|
if (importPath.startsWith('@')) {
|
|
254895
255095
|
const segments = importPath.split('/');
|
|
254896
|
-
|
|
254897
|
-
return null;
|
|
254898
|
-
}
|
|
254899
|
-
return `${segments[0]}/${segments[1]}`;
|
|
255096
|
+
return segments.length < 2 ? null : `${segments[0]}/${segments[1]}`;
|
|
254900
255097
|
}
|
|
254901
255098
|
const parts = importPath.split('/');
|
|
254902
255099
|
return parts[0] ?? null;
|
|
@@ -254953,14 +255150,13 @@ function findNestedEntryPointRelativePaths(rootEntryDirectory) {
|
|
|
254953
255150
|
return [...new Set(directories)];
|
|
254954
255151
|
}
|
|
254955
255152
|
function selectCandidateEntryPointsForMode(allNestedRelativePaths, strict) {
|
|
254956
|
-
|
|
254957
|
-
|
|
254958
|
-
|
|
254959
|
-
|
|
254960
|
-
|
|
254961
|
-
|
|
254962
|
-
|
|
254963
|
-
});
|
|
255153
|
+
return strict
|
|
255154
|
+
? [...allNestedRelativePaths].sort((a, b) => {
|
|
255155
|
+
const depthA = a.split('/').filter(Boolean).length;
|
|
255156
|
+
const depthB = b.split('/').filter(Boolean).length;
|
|
255157
|
+
return depthB - depthA;
|
|
255158
|
+
})
|
|
255159
|
+
: allNestedRelativePaths.filter((relativePath) => !relativePath.includes('/'));
|
|
254964
255160
|
}
|
|
254965
255161
|
function mapSymbolsToEntryPointsUsingTypeChecker({ candidateEntryPoints, importedSymbols, rootEntryDirectory, state, }) {
|
|
254966
255162
|
const symbolToEntryPoint = new Map();
|
|
@@ -255111,10 +255307,9 @@ function buildImportStatement({ importKind, importPath, specifiers, state, }) {
|
|
|
255111
255307
|
if (namedSpecifiers.length > 0) {
|
|
255112
255308
|
clauses.push(`{${namedSpecifiers.map((specifier) => state.sourceCode.getText(specifier)).join(', ')}}`);
|
|
255113
255309
|
}
|
|
255114
|
-
|
|
255115
|
-
|
|
255116
|
-
|
|
255117
|
-
return `${importKeyword} ${clauses.join(', ')} from '${importPath}';`;
|
|
255310
|
+
return clauses.length === 0
|
|
255311
|
+
? null
|
|
255312
|
+
: `${importKeyword} ${clauses.join(', ')} from '${importPath}';`;
|
|
255118
255313
|
}
|
|
255119
255314
|
|
|
255120
255315
|
function getTypeName(param) {
|
|
@@ -255225,41 +255420,43 @@ const plugin = {
|
|
|
255225
255420
|
},
|
|
255226
255421
|
rules: {
|
|
255227
255422
|
'array-as-const': rule$5,
|
|
255228
|
-
'attrs-newline': rule$
|
|
255423
|
+
'attrs-newline': rule$S,
|
|
255229
255424
|
'class-property-naming': rule$4,
|
|
255230
|
-
'decorator-key-sort': rule$
|
|
255231
|
-
'element-newline': rule$
|
|
255425
|
+
'decorator-key-sort': rule$R,
|
|
255426
|
+
'element-newline': rule$Q,
|
|
255232
255427
|
'flat-exports': rule$3,
|
|
255233
|
-
'host-attributes-sort': rule$
|
|
255234
|
-
'html-logical-properties': rule$
|
|
255235
|
-
'import-integrity': rule$
|
|
255236
|
-
'injection-token-description': rule$
|
|
255237
|
-
'no-commonjs-import-patterns': rule$
|
|
255238
|
-
'no-deep-imports': rule$
|
|
255239
|
-
'no-deep-imports-to-indexed-packages': rule$
|
|
255240
|
-
'no-duplicate-attrs': rule$
|
|
255241
|
-
'no-duplicate-id': rule$
|
|
255242
|
-
'no-duplicate-in-head': rule$
|
|
255243
|
-
'no-
|
|
255244
|
-
'no-
|
|
255245
|
-
'no-
|
|
255246
|
-
'no-
|
|
255247
|
-
'no-
|
|
255248
|
-
'no-
|
|
255249
|
-
'no-
|
|
255250
|
-
'no-obsolete-
|
|
255251
|
-
'no-
|
|
255252
|
-
'no-
|
|
255253
|
-
'no-
|
|
255254
|
-
'no-
|
|
255428
|
+
'host-attributes-sort': rule$P,
|
|
255429
|
+
'html-logical-properties': rule$O,
|
|
255430
|
+
'import-integrity': rule$N,
|
|
255431
|
+
'injection-token-description': rule$M,
|
|
255432
|
+
'no-commonjs-import-patterns': rule$L,
|
|
255433
|
+
'no-deep-imports': rule$K,
|
|
255434
|
+
'no-deep-imports-to-indexed-packages': rule$J,
|
|
255435
|
+
'no-duplicate-attrs': rule$I,
|
|
255436
|
+
'no-duplicate-id': rule$H,
|
|
255437
|
+
'no-duplicate-in-head': rule$G,
|
|
255438
|
+
'no-empty-style-metadata': rule$F,
|
|
255439
|
+
'no-fully-untracked-effect': rule$E,
|
|
255440
|
+
'no-href-with-router-link': rule$D,
|
|
255441
|
+
'no-implicit-public': rule$C,
|
|
255442
|
+
'no-import-assertions': rule$B,
|
|
255443
|
+
'no-infinite-loop': rule$A,
|
|
255444
|
+
'no-legacy-peer-deps': rule$z,
|
|
255445
|
+
'no-obsolete-attrs': rule$y,
|
|
255446
|
+
'no-obsolete-tags': rule$x,
|
|
255447
|
+
'no-playwright-empty-fill': rule$w,
|
|
255448
|
+
'no-project-as-in-ng-template': rule$v,
|
|
255449
|
+
'no-redundant-type-annotation': rule$u,
|
|
255450
|
+
'no-repeated-signal-in-conditional': rule$t,
|
|
255255
255451
|
'no-restricted-attr-values': rule$2,
|
|
255256
|
-
'no-side-effects-in-computed': rule$
|
|
255257
|
-
'no-signal-reads-after-await-in-reactive-context': rule$
|
|
255258
|
-
'no-string-literal-concat': rule$
|
|
255259
|
-
'no-untracked-outside-reactive-context': rule$
|
|
255260
|
-
'no-useless-untracked': rule$
|
|
255261
|
-
'object-single-line': rule$
|
|
255262
|
-
'prefer-combined-if-control-flow': rule$
|
|
255452
|
+
'no-side-effects-in-computed': rule$s,
|
|
255453
|
+
'no-signal-reads-after-await-in-reactive-context': rule$r,
|
|
255454
|
+
'no-string-literal-concat': rule$q,
|
|
255455
|
+
'no-untracked-outside-reactive-context': rule$p,
|
|
255456
|
+
'no-useless-untracked': rule$o,
|
|
255457
|
+
'object-single-line': rule$n,
|
|
255458
|
+
'prefer-combined-if-control-flow': rule$m,
|
|
255459
|
+
'prefer-conditional-return': rule$l,
|
|
255263
255460
|
'prefer-deep-imports': rule$1,
|
|
255264
255461
|
'prefer-loose-null-check': rule$k,
|
|
255265
255462
|
'prefer-multi-arg-push': rule$j,
|