@taiga-ui/eslint-plugin-experience-next 0.505.0 → 0.507.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/index.esm.js
CHANGED
|
@@ -1213,6 +1213,8 @@ var recommended = defineConfig([
|
|
|
1213
1213
|
'@taiga-ui/experience-next/no-useless-untracked': 'error',
|
|
1214
1214
|
'@taiga-ui/experience-next/object-single-line': ['error', { printWidth: 90 }],
|
|
1215
1215
|
'@taiga-ui/experience-next/prefer-combined-if-control-flow': 'error',
|
|
1216
|
+
'@taiga-ui/experience-next/prefer-conditional-return': 'error',
|
|
1217
|
+
'@taiga-ui/experience-next/prefer-loose-null-check': 'error',
|
|
1216
1218
|
'@taiga-ui/experience-next/prefer-multi-arg-push': 'error',
|
|
1217
1219
|
'@taiga-ui/experience-next/prefer-namespace-keyword': 'error',
|
|
1218
1220
|
'@taiga-ui/experience-next/prefer-untracked-incidental-signal-reads': 'error',
|
|
@@ -33200,10 +33202,7 @@ var VERSION = new Version("20.3.12");
|
|
|
33200
33202
|
publishFacade(_global);
|
|
33201
33203
|
|
|
33202
33204
|
function getAttributeValueSpan(attr) {
|
|
33203
|
-
|
|
33204
|
-
return attr.handlerSpan;
|
|
33205
|
-
}
|
|
33206
|
-
return attr.valueSpan;
|
|
33205
|
+
return attr instanceof dist$4.TmplAstBoundEvent ? attr.handlerSpan : attr.valueSpan;
|
|
33207
33206
|
}
|
|
33208
33207
|
function getElementAttributeLikes(element) {
|
|
33209
33208
|
const seen = new Set();
|
|
@@ -46223,7 +46222,7 @@ function buildMultilineStartTag(node, sourceText) {
|
|
|
46223
46222
|
closing,
|
|
46224
46223
|
].join('\n');
|
|
46225
46224
|
}
|
|
46226
|
-
const rule$
|
|
46225
|
+
const rule$R = createRule({
|
|
46227
46226
|
name: 'attrs-newline',
|
|
46228
46227
|
rule: {
|
|
46229
46228
|
create(context) {
|
|
@@ -46370,7 +46369,7 @@ const config$5 = {
|
|
|
46370
46369
|
function getCorrectOrderRelative(correct, current) {
|
|
46371
46370
|
return correct.filter((item) => current.includes(item));
|
|
46372
46371
|
}
|
|
46373
|
-
const rule$
|
|
46372
|
+
const rule$Q = createRule({
|
|
46374
46373
|
name: 'decorator-key-sort',
|
|
46375
46374
|
rule: config$5,
|
|
46376
46375
|
});
|
|
@@ -46429,12 +46428,9 @@ function getNodeLabel(node) {
|
|
|
46429
46428
|
if (node instanceof dist$4.TmplAstElement) {
|
|
46430
46429
|
return `<${node.name}>`;
|
|
46431
46430
|
}
|
|
46432
|
-
|
|
46433
|
-
return 'binding';
|
|
46434
|
-
}
|
|
46435
|
-
return 'text';
|
|
46431
|
+
return node instanceof dist$4.TmplAstBoundText ? 'binding' : 'text';
|
|
46436
46432
|
}
|
|
46437
|
-
const rule$
|
|
46433
|
+
const rule$P = createRule({
|
|
46438
46434
|
name: 'element-newline',
|
|
46439
46435
|
rule: {
|
|
46440
46436
|
create(context) {
|
|
@@ -46563,10 +46559,9 @@ function getStaticStringValue(node) {
|
|
|
46563
46559
|
if (isStringLiteral(node)) {
|
|
46564
46560
|
return node.value;
|
|
46565
46561
|
}
|
|
46566
|
-
|
|
46567
|
-
|
|
46568
|
-
|
|
46569
|
-
return node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw ?? '';
|
|
46562
|
+
return isStaticTemplateLiteral(node)
|
|
46563
|
+
? (node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw ?? '')
|
|
46564
|
+
: null;
|
|
46570
46565
|
}
|
|
46571
46566
|
function isEmptyStaticString(node) {
|
|
46572
46567
|
return getStaticStringValue(node) === '';
|
|
@@ -46576,17 +46571,13 @@ function getStaticPropertyName(key) {
|
|
|
46576
46571
|
if (key.type === dist$3.AST_NODE_TYPES.Identifier) {
|
|
46577
46572
|
return key.name;
|
|
46578
46573
|
}
|
|
46579
|
-
|
|
46580
|
-
(typeof key.value === 'string' || typeof key.value === 'number')
|
|
46581
|
-
|
|
46582
|
-
|
|
46583
|
-
return getStaticStringValue(key);
|
|
46574
|
+
return key.type === dist$3.AST_NODE_TYPES.Literal &&
|
|
46575
|
+
(typeof key.value === 'string' || typeof key.value === 'number')
|
|
46576
|
+
? String(key.value)
|
|
46577
|
+
: getStaticStringValue(key);
|
|
46584
46578
|
}
|
|
46585
46579
|
function getObjectPropertyName(node) {
|
|
46586
|
-
|
|
46587
|
-
return null;
|
|
46588
|
-
}
|
|
46589
|
-
return getStaticPropertyName(node.key);
|
|
46580
|
+
return node.computed ? null : getStaticPropertyName(node.key);
|
|
46590
46581
|
}
|
|
46591
46582
|
function getMemberExpressionPropertyName(node) {
|
|
46592
46583
|
if (!node.computed && node.property.type === dist$3.AST_NODE_TYPES.Identifier) {
|
|
@@ -46665,7 +46656,7 @@ const PRESETS = {
|
|
|
46665
46656
|
$VUE: ['$CLASS', '$ID', '$VUE_ATTRIBUTE'],
|
|
46666
46657
|
$VUE_ATTRIBUTE: /^v-/,
|
|
46667
46658
|
};
|
|
46668
|
-
const rule$
|
|
46659
|
+
const rule$O = createRule({
|
|
46669
46660
|
create(context, [options]) {
|
|
46670
46661
|
const sourceCode = context.sourceCode;
|
|
46671
46662
|
const settings = {
|
|
@@ -46779,7 +46770,7 @@ function getHostAttributeProperties(hostObject) {
|
|
|
46779
46770
|
return null;
|
|
46780
46771
|
}
|
|
46781
46772
|
const name = getStaticPropertyName(property.key);
|
|
46782
|
-
if (name
|
|
46773
|
+
if (name == null) {
|
|
46783
46774
|
return null;
|
|
46784
46775
|
}
|
|
46785
46776
|
properties.push({ name, node: property });
|
|
@@ -46820,10 +46811,9 @@ function getGroup(query, ignoreCase) {
|
|
|
46820
46811
|
},
|
|
46821
46812
|
];
|
|
46822
46813
|
}
|
|
46823
|
-
|
|
46824
|
-
|
|
46825
|
-
|
|
46826
|
-
return [{ query, regexp: preset, values: [] }];
|
|
46814
|
+
return Array.isArray(preset)
|
|
46815
|
+
? preset.flatMap((item) => getGroup(item, ignoreCase))
|
|
46816
|
+
: [{ query, regexp: preset, values: [] }];
|
|
46827
46817
|
}
|
|
46828
46818
|
function ensureDefaultGroup(groups) {
|
|
46829
46819
|
const existing = groups.find(({ unknown }) => unknown);
|
|
@@ -46849,10 +46839,9 @@ function getFixText(hostObject, properties, sortedProperties, sourceCode) {
|
|
|
46849
46839
|
.join(', ')}}`;
|
|
46850
46840
|
}
|
|
46851
46841
|
const attachedComments = getAttachedComments(hostObject, properties, sourceCode, comments);
|
|
46852
|
-
|
|
46853
|
-
|
|
46854
|
-
|
|
46855
|
-
return renderFixWithComments(hostObject, sortedProperties, sourceCode, attachedComments);
|
|
46842
|
+
return attachedComments
|
|
46843
|
+
? renderFixWithComments(hostObject, sortedProperties, sourceCode, attachedComments)
|
|
46844
|
+
: null;
|
|
46856
46845
|
}
|
|
46857
46846
|
function getAttachedComments(hostObject, properties, sourceCode, comments) {
|
|
46858
46847
|
const attached = new Map();
|
|
@@ -46998,7 +46987,7 @@ const config$4 = {
|
|
|
46998
46987
|
type: 'suggestion',
|
|
46999
46988
|
},
|
|
47000
46989
|
};
|
|
47001
|
-
const rule$
|
|
46990
|
+
const rule$N = createRule({
|
|
47002
46991
|
name: 'html-logical-properties',
|
|
47003
46992
|
rule: config$4,
|
|
47004
46993
|
});
|
|
@@ -247714,12 +247703,11 @@ function getProgramResolutionCache(program) {
|
|
|
247714
247703
|
return null;
|
|
247715
247704
|
}
|
|
247716
247705
|
const cache = getCache.call(program);
|
|
247717
|
-
|
|
247706
|
+
return cache === null ||
|
|
247718
247707
|
typeof cache !== 'object' ||
|
|
247719
|
-
!('getOrCreateCacheForDirectory' in cache)
|
|
247720
|
-
|
|
247721
|
-
|
|
247722
|
-
return cache;
|
|
247708
|
+
!('getOrCreateCacheForDirectory' in cache)
|
|
247709
|
+
? null
|
|
247710
|
+
: cache;
|
|
247723
247711
|
}
|
|
247724
247712
|
function getFallbackResolution(program) {
|
|
247725
247713
|
const cached = fallbackResolutionByProgram.get(program);
|
|
@@ -247750,10 +247738,9 @@ function resolveModule(program, containingFile, moduleSpecifier) {
|
|
|
247750
247738
|
}
|
|
247751
247739
|
function resolveModuleFileName(program, containingFile, moduleSpecifier) {
|
|
247752
247740
|
const resolved = resolveModule(program, containingFile, moduleSpecifier);
|
|
247753
|
-
|
|
247754
|
-
|
|
247755
|
-
|
|
247756
|
-
return resolved.resolvedFileName;
|
|
247741
|
+
return !resolved || resolved.isExternalLibraryImport
|
|
247742
|
+
? null
|
|
247743
|
+
: resolved.resolvedFileName;
|
|
247757
247744
|
}
|
|
247758
247745
|
function splitModuleSpecifierQuery(moduleSpecifier) {
|
|
247759
247746
|
const queryIndex = moduleSpecifier.indexOf('?');
|
|
@@ -247848,22 +247835,20 @@ function importDeclarationHasRuntimeEdge(node) {
|
|
|
247848
247835
|
if (!namedBindings) {
|
|
247849
247836
|
return false;
|
|
247850
247837
|
}
|
|
247851
|
-
|
|
247852
|
-
|
|
247853
|
-
|
|
247854
|
-
|
|
247855
|
-
namedBindings.elements.some((specifier) => !specifier.isTypeOnly));
|
|
247838
|
+
return ts.isNamespaceImport(namedBindings)
|
|
247839
|
+
? true
|
|
247840
|
+
: namedBindings.elements.length === 0 ||
|
|
247841
|
+
namedBindings.elements.some((specifier) => !specifier.isTypeOnly);
|
|
247856
247842
|
}
|
|
247857
247843
|
function exportDeclarationHasRuntimeEdge(node) {
|
|
247858
247844
|
if (node.isTypeOnly) {
|
|
247859
247845
|
return false;
|
|
247860
247846
|
}
|
|
247861
247847
|
const exportClause = node.exportClause;
|
|
247862
|
-
|
|
247863
|
-
|
|
247864
|
-
|
|
247865
|
-
|
|
247866
|
-
exportClause.elements.some((specifier) => !specifier.isTypeOnly));
|
|
247848
|
+
return !exportClause || ts.isNamespaceExport(exportClause)
|
|
247849
|
+
? true
|
|
247850
|
+
: exportClause.elements.length === 0 ||
|
|
247851
|
+
exportClause.elements.some((specifier) => !specifier.isTypeOnly);
|
|
247867
247852
|
}
|
|
247868
247853
|
function getRuntimeModuleSpecifier(statement) {
|
|
247869
247854
|
if (ts.isImportDeclaration(statement)) {
|
|
@@ -247926,10 +247911,9 @@ function hasRuntimeDefaultModifier(statement) {
|
|
|
247926
247911
|
!ts.isTypeAliasDeclaration(statement));
|
|
247927
247912
|
}
|
|
247928
247913
|
function exportsDefaultSpecifier(node) {
|
|
247929
|
-
|
|
247930
|
-
|
|
247931
|
-
|
|
247932
|
-
return node.exportClause.elements.some((specifier) => !specifier.isTypeOnly && specifier.name.text === 'default');
|
|
247914
|
+
return node.isTypeOnly || !node.exportClause || !ts.isNamedExports(node.exportClause)
|
|
247915
|
+
? false
|
|
247916
|
+
: node.exportClause.elements.some((specifier) => !specifier.isTypeOnly && specifier.name.text === 'default');
|
|
247933
247917
|
}
|
|
247934
247918
|
function sourceFileHasDefaultExport(sourceFile) {
|
|
247935
247919
|
return sourceFile.statements.some((statement) => (ts.isExportAssignment(statement) && !statement.isExportEquals) ||
|
|
@@ -247957,25 +247941,20 @@ function hasRuntimeEstreeImport(node) {
|
|
|
247957
247941
|
if (node.importKind === 'type') {
|
|
247958
247942
|
return false;
|
|
247959
247943
|
}
|
|
247960
|
-
|
|
247961
|
-
|
|
247962
|
-
|
|
247963
|
-
|
|
247964
|
-
|
|
247965
|
-
return true;
|
|
247966
|
-
}
|
|
247967
|
-
return specifier.importKind !== 'type';
|
|
247968
|
-
});
|
|
247944
|
+
return node.specifiers.length === 0
|
|
247945
|
+
? true
|
|
247946
|
+
: node.specifiers.some((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportSpecifier
|
|
247947
|
+
? specifier.importKind !== 'type'
|
|
247948
|
+
: true);
|
|
247969
247949
|
}
|
|
247970
247950
|
function hasRuntimeEstreeReExport(node) {
|
|
247971
247951
|
if (node.exportKind === 'type') {
|
|
247972
247952
|
return false;
|
|
247973
247953
|
}
|
|
247974
|
-
|
|
247975
|
-
|
|
247976
|
-
|
|
247977
|
-
|
|
247978
|
-
node.specifiers.some((specifier) => specifier.exportKind !== 'type'));
|
|
247954
|
+
return node.type === dist$3.AST_NODE_TYPES.ExportAllDeclaration
|
|
247955
|
+
? true
|
|
247956
|
+
: node.specifiers.length === 0 ||
|
|
247957
|
+
node.specifiers.some((specifier) => specifier.exportKind !== 'type');
|
|
247979
247958
|
}
|
|
247980
247959
|
function getImportOrReExportModuleSpecifier(node) {
|
|
247981
247960
|
if (node.type === dist$3.AST_NODE_TYPES.ImportDeclaration) {
|
|
@@ -248198,13 +248177,10 @@ function isInAngularSafeContext(identifier) {
|
|
|
248198
248177
|
return false;
|
|
248199
248178
|
}
|
|
248200
248179
|
function isImportUsedOnlyAsAngularDiFirstArg(node, sourceCode) {
|
|
248201
|
-
const valueSpecifiers = node.specifiers.filter((specifier) =>
|
|
248202
|
-
|
|
248203
|
-
|
|
248204
|
-
|
|
248205
|
-
}
|
|
248206
|
-
return specifier.importKind !== 'type';
|
|
248207
|
-
});
|
|
248180
|
+
const valueSpecifiers = node.specifiers.filter((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportDefaultSpecifier ||
|
|
248181
|
+
specifier.type === dist$3.AST_NODE_TYPES.ImportNamespaceSpecifier
|
|
248182
|
+
? true
|
|
248183
|
+
: specifier.importKind !== 'type');
|
|
248208
248184
|
if (valueSpecifiers.length === 0) {
|
|
248209
248185
|
return false;
|
|
248210
248186
|
}
|
|
@@ -248250,7 +248226,7 @@ function isImportUsedOnlyAsAngularDiFirstArg(node, sourceCode) {
|
|
|
248250
248226
|
}
|
|
248251
248227
|
return hasSafeRuntimeUsage;
|
|
248252
248228
|
}
|
|
248253
|
-
const rule$
|
|
248229
|
+
const rule$M = createRule({
|
|
248254
248230
|
create(context) {
|
|
248255
248231
|
const { checker, esTreeNodeToTSNodeMap, sourceCode, tsProgram } = getTypeAwareRuleContext(context);
|
|
248256
248232
|
const checkCycles = context.options[0]?.checkCycles ?? true;
|
|
@@ -248425,11 +248401,10 @@ const rule$K = createRule({
|
|
|
248425
248401
|
const importSegments = moduleSpecifierPath.replace(/^\.\//, '').split('/');
|
|
248426
248402
|
const importParentCount = countRelativeParents(importSegments);
|
|
248427
248403
|
const expectedParentCount = countRelativeParents(expectedPath.split('/'));
|
|
248428
|
-
|
|
248429
|
-
expectedPath === moduleSpecifierPath
|
|
248430
|
-
|
|
248431
|
-
|
|
248432
|
-
return expectedPath;
|
|
248404
|
+
return importParentCount <= expectedParentCount ||
|
|
248405
|
+
expectedPath === moduleSpecifierPath
|
|
248406
|
+
? null
|
|
248407
|
+
: expectedPath;
|
|
248433
248408
|
}
|
|
248434
248409
|
function getUselessPathSegmentsReplacement(moduleSpecifierPath) {
|
|
248435
248410
|
const resolved = resolveModule(tsProgram, context.filename, moduleSpecifierPath);
|
|
@@ -248920,10 +248895,7 @@ function isStringLike(node) {
|
|
|
248920
248895
|
return isStringLiteral(node) || node.type === dist$2.AST_NODE_TYPES.TemplateLiteral;
|
|
248921
248896
|
}
|
|
248922
248897
|
function getStringValue(node) {
|
|
248923
|
-
|
|
248924
|
-
return node.value;
|
|
248925
|
-
}
|
|
248926
|
-
return node.quasis[0]?.value.raw || '';
|
|
248898
|
+
return isStringLiteral(node) ? node.value : node.quasis[0]?.value.raw || '';
|
|
248927
248899
|
}
|
|
248928
248900
|
function isEmptyString(node) {
|
|
248929
248901
|
return (isEmptyStaticString(node) &&
|
|
@@ -248941,10 +248913,7 @@ function getDescriptionValue(node) {
|
|
|
248941
248913
|
if (isStringLike(node)) {
|
|
248942
248914
|
return getStringValue(node);
|
|
248943
248915
|
}
|
|
248944
|
-
|
|
248945
|
-
return getStringValue(node.consequent);
|
|
248946
|
-
}
|
|
248947
|
-
return undefined;
|
|
248916
|
+
return isNgDevModeConditional(node) ? getStringValue(node.consequent) : undefined;
|
|
248948
248917
|
}
|
|
248949
248918
|
function getDescriptionNode(node) {
|
|
248950
248919
|
if (isStringLike(node)) {
|
|
@@ -248956,7 +248925,7 @@ function prependTokenName(text, name) {
|
|
|
248956
248925
|
return `${text.slice(0, 1)}[${name}]: ${text.slice(1)}`;
|
|
248957
248926
|
}
|
|
248958
248927
|
function isNgDevModeVisible(sourceCode, node) {
|
|
248959
|
-
for (let scope = sourceCode.getScope(node); scope
|
|
248928
|
+
for (let scope = sourceCode.getScope(node); scope != null; scope = scope.upper) {
|
|
248960
248929
|
if (scope.variables.some((variable) => variable.name === NG_DEV_MODE)) {
|
|
248961
248930
|
return true;
|
|
248962
248931
|
}
|
|
@@ -248971,12 +248940,11 @@ function getNgDevModeDeclarationFix(program, fixer) {
|
|
|
248971
248940
|
return fixer.insertTextAfter(lastImport, '\n\ndeclare const ngDevMode: boolean;');
|
|
248972
248941
|
}
|
|
248973
248942
|
const [firstStatement] = program.body;
|
|
248974
|
-
|
|
248975
|
-
|
|
248976
|
-
|
|
248977
|
-
return fixer.insertTextBeforeRange([0, 0], 'declare const ngDevMode: boolean;\n');
|
|
248943
|
+
return firstStatement
|
|
248944
|
+
? fixer.insertTextBefore(firstStatement, 'declare const ngDevMode: boolean;\n\n')
|
|
248945
|
+
: fixer.insertTextBeforeRange([0, 0], 'declare const ngDevMode: boolean;\n');
|
|
248978
248946
|
}
|
|
248979
|
-
const rule$
|
|
248947
|
+
const rule$L = createRule({
|
|
248980
248948
|
create(context) {
|
|
248981
248949
|
const { sourceCode } = context;
|
|
248982
248950
|
const program = sourceCode.ast;
|
|
@@ -249025,7 +248993,7 @@ const rule$J = createRule({
|
|
|
249025
248993
|
name: 'injection-token-description',
|
|
249026
248994
|
});
|
|
249027
248995
|
|
|
249028
|
-
const rule$
|
|
248996
|
+
const rule$K = createRule({
|
|
249029
248997
|
create(context) {
|
|
249030
248998
|
const { sourceCode } = context;
|
|
249031
248999
|
const namespaceImports = new Map();
|
|
@@ -249120,7 +249088,7 @@ const DEFAULT_OPTIONS = {
|
|
|
249120
249088
|
importDeclaration: '^@taiga-ui*',
|
|
249121
249089
|
projectName: String.raw `(?<=^@taiga-ui/)([-\w]+)`,
|
|
249122
249090
|
};
|
|
249123
|
-
const rule$
|
|
249091
|
+
const rule$J = createRule({
|
|
249124
249092
|
create(context) {
|
|
249125
249093
|
const { currentProject, deepImport, ignoreImports, importDeclaration, projectName, } = { ...DEFAULT_OPTIONS, ...context.options[0] };
|
|
249126
249094
|
const hasNonCodeExtension = (source) => {
|
|
@@ -249212,7 +249180,7 @@ const nearestFileUpCache = new Map();
|
|
|
249212
249180
|
const markerCache = new Map();
|
|
249213
249181
|
const indexFileCache = new Map();
|
|
249214
249182
|
const indexExportsCache = new Map();
|
|
249215
|
-
const rule$
|
|
249183
|
+
const rule$I = createRule({
|
|
249216
249184
|
create(context) {
|
|
249217
249185
|
const parserServices = dist$3.ESLintUtils.getParserServices(context);
|
|
249218
249186
|
const program = parserServices.program;
|
|
@@ -249227,7 +249195,7 @@ const rule$G = createRule({
|
|
|
249227
249195
|
}
|
|
249228
249196
|
const key = `${containingDir}\0${moduleSpecifier}`;
|
|
249229
249197
|
const cachedFile = cache.get(key);
|
|
249230
|
-
if (cachedFile
|
|
249198
|
+
if (cachedFile != null) {
|
|
249231
249199
|
return cachedFile;
|
|
249232
249200
|
}
|
|
249233
249201
|
const resolved = ts.resolveModuleName(moduleSpecifier, context.filename, compilerOptions, compilerHost);
|
|
@@ -249238,7 +249206,7 @@ const rule$G = createRule({
|
|
|
249238
249206
|
function findNearestFileUpwardsCached(startDirectory, fileName) {
|
|
249239
249207
|
const key = `${startDirectory}\0${fileName}`;
|
|
249240
249208
|
const cachedPath = nearestFileUpCache.get(key);
|
|
249241
|
-
if (cachedPath
|
|
249209
|
+
if (cachedPath != null) {
|
|
249242
249210
|
return cachedPath;
|
|
249243
249211
|
}
|
|
249244
249212
|
let currentDirectory = startDirectory;
|
|
@@ -249259,7 +249227,7 @@ const rule$G = createRule({
|
|
|
249259
249227
|
}
|
|
249260
249228
|
function pickPackageMarkerFileCached(resolvedRootFilePath) {
|
|
249261
249229
|
const cachedMarker = markerCache.get(resolvedRootFilePath);
|
|
249262
|
-
if (cachedMarker
|
|
249230
|
+
if (cachedMarker != null) {
|
|
249263
249231
|
return cachedMarker;
|
|
249264
249232
|
}
|
|
249265
249233
|
const resolvedRootDirectory = path.dirname(resolvedRootFilePath);
|
|
@@ -249271,7 +249239,7 @@ const rule$G = createRule({
|
|
|
249271
249239
|
}
|
|
249272
249240
|
function pickIndexFileInDirectoryCached(packageDirectory) {
|
|
249273
249241
|
const cachedIndexFile = indexFileCache.get(packageDirectory);
|
|
249274
|
-
if (cachedIndexFile
|
|
249242
|
+
if (cachedIndexFile != null) {
|
|
249275
249243
|
return cachedIndexFile;
|
|
249276
249244
|
}
|
|
249277
249245
|
const indexTypescriptPath = path.join(packageDirectory, 'index.ts');
|
|
@@ -249373,10 +249341,9 @@ const rule$G = createRule({
|
|
|
249373
249341
|
name: 'no-deep-imports-to-indexed-packages',
|
|
249374
249342
|
});
|
|
249375
249343
|
function isExternalModuleSpecifier(moduleSpecifier) {
|
|
249376
|
-
|
|
249377
|
-
|
|
249378
|
-
|
|
249379
|
-
return !path.isAbsolute(moduleSpecifier);
|
|
249344
|
+
return !moduleSpecifier || moduleSpecifier.startsWith('.')
|
|
249345
|
+
? false
|
|
249346
|
+
: !path.isAbsolute(moduleSpecifier);
|
|
249380
249347
|
}
|
|
249381
249348
|
function isScopedPackage(importSpecifier) {
|
|
249382
249349
|
return importSpecifier.startsWith('@');
|
|
@@ -249384,19 +249351,17 @@ function isScopedPackage(importSpecifier) {
|
|
|
249384
249351
|
function getPackageRootSpecifier(importSpecifier) {
|
|
249385
249352
|
const pathParts = importSpecifier.split('/');
|
|
249386
249353
|
if (isScopedPackage(importSpecifier)) {
|
|
249387
|
-
|
|
249388
|
-
|
|
249389
|
-
|
|
249390
|
-
return importSpecifier;
|
|
249354
|
+
return pathParts.length >= 2
|
|
249355
|
+
? `${pathParts[0]}/${pathParts[1]}`
|
|
249356
|
+
: importSpecifier;
|
|
249391
249357
|
}
|
|
249392
249358
|
return pathParts[0] ?? importSpecifier;
|
|
249393
249359
|
}
|
|
249394
249360
|
function getSubpath(importSpecifier, packageRootSpecifier) {
|
|
249395
|
-
|
|
249396
|
-
!importSpecifier.startsWith(`${packageRootSpecifier}/`)
|
|
249397
|
-
|
|
249398
|
-
|
|
249399
|
-
return importSpecifier.slice(packageRootSpecifier.length + 1);
|
|
249361
|
+
return importSpecifier === packageRootSpecifier ||
|
|
249362
|
+
!importSpecifier.startsWith(`${packageRootSpecifier}/`)
|
|
249363
|
+
? null
|
|
249364
|
+
: importSpecifier.slice(packageRootSpecifier.length + 1);
|
|
249400
249365
|
}
|
|
249401
249366
|
function normalizeModuleSpecifier(moduleSpecifier) {
|
|
249402
249367
|
return moduleSpecifier.replaceAll('\\', '/');
|
|
@@ -249409,13 +249374,13 @@ const noDuplicateAttributesRule = angular.templatePlugin.rules?.['no-duplicate-a
|
|
|
249409
249374
|
if (!noDuplicateAttributesRule) {
|
|
249410
249375
|
throw new Error('angular-eslint template rule "no-duplicate-attributes" is not available');
|
|
249411
249376
|
}
|
|
249412
|
-
const rule$
|
|
249377
|
+
const rule$H = createRule({
|
|
249413
249378
|
name: 'no-duplicate-attrs',
|
|
249414
249379
|
rule: noDuplicateAttributesRule,
|
|
249415
249380
|
});
|
|
249416
249381
|
|
|
249417
249382
|
const MESSAGE_ID$c = 'duplicateId';
|
|
249418
|
-
const rule$
|
|
249383
|
+
const rule$G = createRule({
|
|
249419
249384
|
name: 'no-duplicate-id',
|
|
249420
249385
|
rule: {
|
|
249421
249386
|
create(context) {
|
|
@@ -249470,14 +249435,13 @@ function getTrackingKey(node) {
|
|
|
249470
249435
|
return 'meta[name=viewport]';
|
|
249471
249436
|
}
|
|
249472
249437
|
}
|
|
249473
|
-
|
|
249438
|
+
return node.name === 'link' &&
|
|
249474
249439
|
findAttr(node, 'rel')?.value === 'canonical' &&
|
|
249475
|
-
findAttr(node, 'href')
|
|
249476
|
-
|
|
249477
|
-
|
|
249478
|
-
return null;
|
|
249440
|
+
findAttr(node, 'href')
|
|
249441
|
+
? 'link[rel=canonical]'
|
|
249442
|
+
: null;
|
|
249479
249443
|
}
|
|
249480
|
-
const rule$
|
|
249444
|
+
const rule$F = createRule({
|
|
249481
249445
|
name: 'no-duplicate-in-head',
|
|
249482
249446
|
rule: {
|
|
249483
249447
|
create(context) {
|
|
@@ -249543,7 +249507,7 @@ function getOrderedChildren(node) {
|
|
|
249543
249507
|
...node.params,
|
|
249544
249508
|
node.body,
|
|
249545
249509
|
];
|
|
249546
|
-
return children.filter((child) => child
|
|
249510
|
+
return children.filter((child) => child != null);
|
|
249547
249511
|
}
|
|
249548
249512
|
if (node.type === dist$3.AST_NODE_TYPES.BlockStatement ||
|
|
249549
249513
|
node.type === dist$3.AST_NODE_TYPES.Program) {
|
|
@@ -249570,7 +249534,7 @@ function getOrderedChildren(node) {
|
|
|
249570
249534
|
node.update,
|
|
249571
249535
|
node.body,
|
|
249572
249536
|
];
|
|
249573
|
-
return children.filter((child) => child
|
|
249537
|
+
return children.filter((child) => child != null);
|
|
249574
249538
|
}
|
|
249575
249539
|
if (node.type === dist$3.AST_NODE_TYPES.ForInStatement ||
|
|
249576
249540
|
node.type === dist$3.AST_NODE_TYPES.ForOfStatement) {
|
|
@@ -249776,12 +249740,11 @@ function getPropertyName(property) {
|
|
|
249776
249740
|
}
|
|
249777
249741
|
function isAngularCoreCall(node, program, exportedName) {
|
|
249778
249742
|
const localName = getLocalNameForImport(program, ANGULAR_CORE, exportedName);
|
|
249779
|
-
|
|
249780
|
-
|
|
249781
|
-
|
|
249782
|
-
|
|
249783
|
-
|
|
249784
|
-
node.arguments.length >= 1);
|
|
249743
|
+
return localName
|
|
249744
|
+
? node.callee.type === dist$3.AST_NODE_TYPES.Identifier &&
|
|
249745
|
+
node.callee.name === localName &&
|
|
249746
|
+
node.arguments.length >= 1
|
|
249747
|
+
: false;
|
|
249785
249748
|
}
|
|
249786
249749
|
function appendFirstArgReactiveScope(scopes, call, kind) {
|
|
249787
249750
|
const callback = getReactiveCallbackArgument(call);
|
|
@@ -249920,13 +249883,12 @@ function isSignalType(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
249920
249883
|
}
|
|
249921
249884
|
const typeSymbol = type.getSymbol();
|
|
249922
249885
|
const aliasSymbol = type.aliasSymbol;
|
|
249923
|
-
|
|
249924
|
-
aliasSymbol?.getName().includes('Signal')
|
|
249925
|
-
|
|
249926
|
-
|
|
249927
|
-
|
|
249928
|
-
|
|
249929
|
-
.some((p) => p.name.startsWith('ɵ') || p.name === '__SIGNAL');
|
|
249886
|
+
return typeSymbol?.getName().includes('Signal') ||
|
|
249887
|
+
aliasSymbol?.getName().includes('Signal')
|
|
249888
|
+
? true
|
|
249889
|
+
: type
|
|
249890
|
+
.getProperties()
|
|
249891
|
+
.some((p) => p.name.startsWith('ɵ') || p.name === '__SIGNAL');
|
|
249930
249892
|
}
|
|
249931
249893
|
catch {
|
|
249932
249894
|
return false;
|
|
@@ -249934,22 +249896,20 @@ function isSignalType(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
249934
249896
|
}
|
|
249935
249897
|
function isSignalReadCall(node, checker, esTreeNodeToTSNodeMap) {
|
|
249936
249898
|
const { callee } = node;
|
|
249937
|
-
|
|
249938
|
-
callee.type !== dist$3.AST_NODE_TYPES.MemberExpression
|
|
249939
|
-
|
|
249940
|
-
|
|
249941
|
-
return isSignalType(callee, checker, esTreeNodeToTSNodeMap);
|
|
249899
|
+
return callee.type !== dist$3.AST_NODE_TYPES.Identifier &&
|
|
249900
|
+
callee.type !== dist$3.AST_NODE_TYPES.MemberExpression
|
|
249901
|
+
? false
|
|
249902
|
+
: isSignalType(callee, checker, esTreeNodeToTSNodeMap);
|
|
249942
249903
|
}
|
|
249943
249904
|
function isWritableSignalWrite(node, checker, esTreeNodeToTSNodeMap) {
|
|
249944
249905
|
if (node.callee.type !== dist$3.AST_NODE_TYPES.MemberExpression) {
|
|
249945
249906
|
return false;
|
|
249946
249907
|
}
|
|
249947
249908
|
const { object, property } = node.callee;
|
|
249948
|
-
|
|
249949
|
-
!SIGNAL_WRITE_METHODS.has(property.name)
|
|
249950
|
-
|
|
249951
|
-
|
|
249952
|
-
return isSignalType(object, checker, esTreeNodeToTSNodeMap);
|
|
249909
|
+
return property.type !== dist$3.AST_NODE_TYPES.Identifier ||
|
|
249910
|
+
!SIGNAL_WRITE_METHODS.has(property.name)
|
|
249911
|
+
? false
|
|
249912
|
+
: isSignalType(object, checker, esTreeNodeToTSNodeMap);
|
|
249953
249913
|
}
|
|
249954
249914
|
/**
|
|
249955
249915
|
* Returns true when `node` is a member expression `foo.bar` where `bar` is a
|
|
@@ -249963,10 +249923,7 @@ function isGetterMemberAccess(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
249963
249923
|
return false;
|
|
249964
249924
|
}
|
|
249965
249925
|
const symbol = checker.getSymbolAtLocation(tsNode);
|
|
249966
|
-
|
|
249967
|
-
return false;
|
|
249968
|
-
}
|
|
249969
|
-
return !!(symbol.flags & ts.SymbolFlags.GetAccessor);
|
|
249926
|
+
return symbol ? !!(symbol.flags & ts.SymbolFlags.GetAccessor) : false;
|
|
249970
249927
|
}
|
|
249971
249928
|
catch {
|
|
249972
249929
|
return false;
|
|
@@ -250050,19 +250007,18 @@ function getReturnedReactiveOwnerCall(node, program) {
|
|
|
250050
250007
|
isReactiveOwnerCall(statement.argument, program)) {
|
|
250051
250008
|
return statement.argument;
|
|
250052
250009
|
}
|
|
250053
|
-
|
|
250010
|
+
return node.parent.type === dist$3.AST_NODE_TYPES.ExpressionStatement &&
|
|
250054
250011
|
statement?.type === dist$3.AST_NODE_TYPES.ExpressionStatement &&
|
|
250055
|
-
isReactiveOwnerCall(statement.expression, program)
|
|
250056
|
-
|
|
250057
|
-
|
|
250058
|
-
return null;
|
|
250012
|
+
isReactiveOwnerCall(statement.expression, program)
|
|
250013
|
+
? statement.expression
|
|
250014
|
+
: null;
|
|
250059
250015
|
}
|
|
250060
250016
|
|
|
250061
250017
|
const ANGULAR_SIGNALS_UNTRACKED_GUIDE_URL = 'https://angular.dev/guide/signals#reading-without-tracking-dependencies';
|
|
250062
250018
|
const ANGULAR_SIGNALS_ASYNC_GUIDE_URL = 'https://angular.dev/guide/signals#reactive-context-and-async-operations';
|
|
250063
250019
|
const createUntrackedRule = createRule;
|
|
250064
250020
|
|
|
250065
|
-
const rule$
|
|
250021
|
+
const rule$E = createUntrackedRule({
|
|
250066
250022
|
create(context) {
|
|
250067
250023
|
const { checker, esTreeNodeToTSNodeMap, program } = getTypeAwareRuleContext(context);
|
|
250068
250024
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -250135,7 +250091,7 @@ const config$3 = {
|
|
|
250135
250091
|
type: 'problem',
|
|
250136
250092
|
},
|
|
250137
250093
|
};
|
|
250138
|
-
const rule$
|
|
250094
|
+
const rule$D = createRule({
|
|
250139
250095
|
name: 'no-href-with-router-link',
|
|
250140
250096
|
rule: config$3,
|
|
250141
250097
|
});
|
|
@@ -250196,7 +250152,7 @@ function getScopeRoot(node) {
|
|
|
250196
250152
|
return (findAncestor(node, (ancestor) => ancestor.type === dist$3.AST_NODE_TYPES.Program || isFunctionLike(ancestor)) ?? node);
|
|
250197
250153
|
}
|
|
250198
250154
|
|
|
250199
|
-
const rule$
|
|
250155
|
+
const rule$C = createRule({
|
|
250200
250156
|
create(context) {
|
|
250201
250157
|
const checkImplicitPublic = (node) => {
|
|
250202
250158
|
const classRef = getEnclosingClass(node);
|
|
@@ -250258,7 +250214,7 @@ const rule$A = createRule({
|
|
|
250258
250214
|
name: 'no-implicit-public',
|
|
250259
250215
|
});
|
|
250260
250216
|
|
|
250261
|
-
const rule$
|
|
250217
|
+
const rule$B = createRule({
|
|
250262
250218
|
create(context) {
|
|
250263
250219
|
const { sourceCode } = context;
|
|
250264
250220
|
return {
|
|
@@ -250291,10 +250247,9 @@ const rule$z = createRule({
|
|
|
250291
250247
|
|
|
250292
250248
|
function getParenthesizedInner(node) {
|
|
250293
250249
|
const maybeNode = node;
|
|
250294
|
-
|
|
250295
|
-
|
|
250296
|
-
|
|
250297
|
-
return null;
|
|
250250
|
+
return maybeNode.type === 'ParenthesizedExpression'
|
|
250251
|
+
? (maybeNode.expression ?? null)
|
|
250252
|
+
: null;
|
|
250298
250253
|
}
|
|
250299
250254
|
function unwrapParenthesized(node) {
|
|
250300
250255
|
let current = node;
|
|
@@ -250308,15 +250263,14 @@ function unwrapParenthesized(node) {
|
|
|
250308
250263
|
|
|
250309
250264
|
function isInfiniteLoopLiteral(node) {
|
|
250310
250265
|
const unwrapped = unwrapParenthesized(node);
|
|
250311
|
-
|
|
250312
|
-
|
|
250313
|
-
|
|
250314
|
-
return unwrapped.value === true || unwrapped.value === 1;
|
|
250266
|
+
return unwrapped.type === dist$3.AST_NODE_TYPES.Literal
|
|
250267
|
+
? unwrapped.value === true || unwrapped.value === 1
|
|
250268
|
+
: false;
|
|
250315
250269
|
}
|
|
250316
250270
|
function isInfiniteLoopTest(test) {
|
|
250317
|
-
return test
|
|
250271
|
+
return test == null || isInfiniteLoopLiteral(test);
|
|
250318
250272
|
}
|
|
250319
|
-
const rule$
|
|
250273
|
+
const rule$A = createRule({
|
|
250320
250274
|
create(context) {
|
|
250321
250275
|
return {
|
|
250322
250276
|
DoWhileStatement(node) {
|
|
@@ -250361,7 +250315,7 @@ const rule$y = createRule({
|
|
|
250361
250315
|
});
|
|
250362
250316
|
|
|
250363
250317
|
const LEGACY_PEER_DEPS_PATTERN = /^legacy-peer-deps\s*=\s*true$/i;
|
|
250364
|
-
const rule$
|
|
250318
|
+
const rule$z = createRule({
|
|
250365
250319
|
create(context) {
|
|
250366
250320
|
return {
|
|
250367
250321
|
Program(node) {
|
|
@@ -250821,7 +250775,7 @@ const OBSOLETE_HTML_ATTRS = {
|
|
|
250821
250775
|
};
|
|
250822
250776
|
|
|
250823
250777
|
const MESSAGE_ID$9 = 'obsolete';
|
|
250824
|
-
const rule$
|
|
250778
|
+
const rule$y = createRule({
|
|
250825
250779
|
name: 'no-obsolete-attrs',
|
|
250826
250780
|
rule: {
|
|
250827
250781
|
create(context) {
|
|
@@ -250899,7 +250853,7 @@ const OBSOLETE_HTML_TAGS = new Set([
|
|
|
250899
250853
|
]);
|
|
250900
250854
|
|
|
250901
250855
|
const MESSAGE_ID$8 = 'unexpected';
|
|
250902
|
-
const rule$
|
|
250856
|
+
const rule$x = createRule({
|
|
250903
250857
|
name: 'no-obsolete-tags',
|
|
250904
250858
|
rule: {
|
|
250905
250859
|
create(context) {
|
|
@@ -250926,7 +250880,7 @@ const rule$v = createRule({
|
|
|
250926
250880
|
},
|
|
250927
250881
|
});
|
|
250928
250882
|
|
|
250929
|
-
const rule$
|
|
250883
|
+
const rule$w = createRule({
|
|
250930
250884
|
create(context) {
|
|
250931
250885
|
const { checker, esTreeNodeToTSNodeMap, sourceCode } = getTypeAwareRuleContext(context);
|
|
250932
250886
|
return {
|
|
@@ -251070,7 +251024,7 @@ const config$2 = {
|
|
|
251070
251024
|
type: 'problem',
|
|
251071
251025
|
},
|
|
251072
251026
|
};
|
|
251073
|
-
const rule$
|
|
251027
|
+
const rule$v = createRule({
|
|
251074
251028
|
name: 'no-project-as-in-ng-template',
|
|
251075
251029
|
rule: config$2,
|
|
251076
251030
|
});
|
|
@@ -251107,7 +251061,7 @@ function collectArrayExpressions(node) {
|
|
|
251107
251061
|
}
|
|
251108
251062
|
return result;
|
|
251109
251063
|
}
|
|
251110
|
-
const rule$
|
|
251064
|
+
const rule$u = createRule({
|
|
251111
251065
|
create(context) {
|
|
251112
251066
|
const { checker: typeChecker, esTreeNodeToTSNodeMap } = getTypeAwareRuleContext(context);
|
|
251113
251067
|
const ignoreTupleContextualTyping = context.options[0]?.ignoreTupleContextualTyping ?? true;
|
|
@@ -251209,10 +251163,9 @@ function isNullableCallType(call, checker, nodeMap) {
|
|
|
251209
251163
|
return false;
|
|
251210
251164
|
}
|
|
251211
251165
|
const type = checker.getTypeAtLocation(tsNode);
|
|
251212
|
-
|
|
251213
|
-
|
|
251214
|
-
|
|
251215
|
-
return type.types.some((t) => !!(t.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)));
|
|
251166
|
+
return type.flags & ts.TypeFlags.Union
|
|
251167
|
+
? type.types.some((t) => !!(t.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)))
|
|
251168
|
+
: false;
|
|
251216
251169
|
}
|
|
251217
251170
|
catch {
|
|
251218
251171
|
return false;
|
|
@@ -251223,13 +251176,12 @@ function getTargetNode(call) {
|
|
|
251223
251176
|
if (parent.type === dist$3.AST_NODE_TYPES.TSAsExpression) {
|
|
251224
251177
|
return parent;
|
|
251225
251178
|
}
|
|
251226
|
-
|
|
251179
|
+
return parent.type === dist$3.AST_NODE_TYPES.UnaryExpression &&
|
|
251227
251180
|
parent.operator === '!' &&
|
|
251228
251181
|
parent.parent.type === dist$3.AST_NODE_TYPES.UnaryExpression &&
|
|
251229
|
-
parent.parent.operator === '!'
|
|
251230
|
-
|
|
251231
|
-
|
|
251232
|
-
return call;
|
|
251182
|
+
parent.parent.operator === '!'
|
|
251183
|
+
? parent.parent
|
|
251184
|
+
: call;
|
|
251233
251185
|
}
|
|
251234
251186
|
function getCalleeName(node) {
|
|
251235
251187
|
const { callee } = node;
|
|
@@ -251239,10 +251191,7 @@ function getCalleeName(node) {
|
|
|
251239
251191
|
return callee.property.name;
|
|
251240
251192
|
}
|
|
251241
251193
|
// Append 'Val' to avoid shadowing the signal variable itself (e.g. const xVal = x())
|
|
251242
|
-
|
|
251243
|
-
return `${callee.name}Val`;
|
|
251244
|
-
}
|
|
251245
|
-
return 'value';
|
|
251194
|
+
return callee.type === dist$3.AST_NODE_TYPES.Identifier ? `${callee.name}Val` : 'value';
|
|
251246
251195
|
}
|
|
251247
251196
|
function findParentStatement(node) {
|
|
251248
251197
|
for (let current = node; current.parent; current = current.parent) {
|
|
@@ -251276,13 +251225,13 @@ function getArrowBodyIndent(arrowFn, sourceText) {
|
|
|
251276
251225
|
const outerIndent = /^(\s*)/.exec(textBeforeArrow)?.[1] ?? '';
|
|
251277
251226
|
return { innerIndent: `${outerIndent} `, outerIndent };
|
|
251278
251227
|
}
|
|
251279
|
-
function getStatementIndent(statement, sourceText) {
|
|
251228
|
+
function getStatementIndent$1(statement, sourceText) {
|
|
251280
251229
|
const start = statement.range[0];
|
|
251281
251230
|
const lineStart = sourceText.lastIndexOf('\n', start - 1) + 1;
|
|
251282
251231
|
const before = sourceText.slice(lineStart, start);
|
|
251283
251232
|
return /^\s*$/.test(before) ? before : '';
|
|
251284
251233
|
}
|
|
251285
|
-
const rule$
|
|
251234
|
+
const rule$t = createRule({
|
|
251286
251235
|
create(context) {
|
|
251287
251236
|
const { checker, esTreeNodeToTSNodeMap, sourceCode } = getTypeAwareRuleContext(context);
|
|
251288
251237
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -251321,7 +251270,7 @@ const rule$r = createRule({
|
|
|
251321
251270
|
const varName = getCalleeName(firstCall);
|
|
251322
251271
|
const parentStatement = findParentStatement(node);
|
|
251323
251272
|
if (parentStatement) {
|
|
251324
|
-
const indent = getStatementIndent(parentStatement, sourceCode.text);
|
|
251273
|
+
const indent = getStatementIndent$1(parentStatement, sourceCode.text);
|
|
251325
251274
|
const fixes = [
|
|
251326
251275
|
fixer.insertTextBefore(parentStatement, `const ${varName} = ${callText};\n\n${indent}`),
|
|
251327
251276
|
];
|
|
@@ -251436,12 +251385,9 @@ function collectMutationTargets(node) {
|
|
|
251436
251385
|
case dist$3.AST_NODE_TYPES.MemberExpression:
|
|
251437
251386
|
return [current];
|
|
251438
251387
|
case dist$3.AST_NODE_TYPES.ObjectPattern:
|
|
251439
|
-
return current.properties.flatMap((property) =>
|
|
251440
|
-
|
|
251441
|
-
|
|
251442
|
-
}
|
|
251443
|
-
return collectMutationTargets(property.value);
|
|
251444
|
-
});
|
|
251388
|
+
return current.properties.flatMap((property) => property.type === dist$3.AST_NODE_TYPES.RestElement
|
|
251389
|
+
? collectMutationTargets(property.argument)
|
|
251390
|
+
: collectMutationTargets(property.value));
|
|
251445
251391
|
case dist$3.AST_NODE_TYPES.RestElement:
|
|
251446
251392
|
return collectMutationTargets(current.argument);
|
|
251447
251393
|
default:
|
|
@@ -251451,10 +251397,7 @@ function collectMutationTargets(node) {
|
|
|
251451
251397
|
|
|
251452
251398
|
function getSymbolAtNode(node, checker, esTreeNodeToTSNodeMap) {
|
|
251453
251399
|
const tsNode = esTreeNodeToTSNodeMap.get(node);
|
|
251454
|
-
|
|
251455
|
-
return null;
|
|
251456
|
-
}
|
|
251457
|
-
return checker.getSymbolAtLocation(tsNode) ?? null;
|
|
251400
|
+
return tsNode ? (checker.getSymbolAtLocation(tsNode) ?? null) : null;
|
|
251458
251401
|
}
|
|
251459
251402
|
|
|
251460
251403
|
function isFunctionLikeScope(node) {
|
|
@@ -251462,14 +251405,13 @@ function isFunctionLikeScope(node) {
|
|
|
251462
251405
|
}
|
|
251463
251406
|
function isLocalIdentifier(node, context, localScopes) {
|
|
251464
251407
|
const symbol = getSymbolAtNode(node, context.checker, context.esTreeNodeToTSNodeMap);
|
|
251465
|
-
|
|
251466
|
-
|
|
251467
|
-
|
|
251468
|
-
|
|
251469
|
-
|
|
251470
|
-
|
|
251471
|
-
|
|
251472
|
-
});
|
|
251408
|
+
return symbol
|
|
251409
|
+
? (symbol.declarations ?? []).some((declaration) => {
|
|
251410
|
+
const estreeDeclaration = context.tsNodeToESTreeNodeMap.get(declaration);
|
|
251411
|
+
return (!!estreeDeclaration &&
|
|
251412
|
+
isDeclaredInsideLocalScope(estreeDeclaration, localScopes));
|
|
251413
|
+
})
|
|
251414
|
+
: false;
|
|
251473
251415
|
}
|
|
251474
251416
|
function isDeclaredInsideLocalScope(node, localScopes) {
|
|
251475
251417
|
return localScopes.some((scope) => isNodeInsideFunctionScope(node, scope));
|
|
@@ -251501,12 +251443,9 @@ function isLocallyCreatedExpression(node, context, localScopes) {
|
|
|
251501
251443
|
}
|
|
251502
251444
|
}
|
|
251503
251445
|
function hasObservableMutationTarget(node, context, localScopes) {
|
|
251504
|
-
return collectMutationTargets(node).some((target) =>
|
|
251505
|
-
|
|
251506
|
-
|
|
251507
|
-
}
|
|
251508
|
-
return !isLocallyCreatedExpression(target.object, context, localScopes);
|
|
251509
|
-
});
|
|
251446
|
+
return collectMutationTargets(node).some((target) => target.type === dist$3.AST_NODE_TYPES.Identifier
|
|
251447
|
+
? !isLocalIdentifier(target, context, localScopes)
|
|
251448
|
+
: !isLocallyCreatedExpression(target.object, context, localScopes));
|
|
251510
251449
|
}
|
|
251511
251450
|
function reportSideEffect(node, context, report) {
|
|
251512
251451
|
const key = String(node.range);
|
|
@@ -251574,10 +251513,9 @@ function resolveFunctionLikeFromIdentifier(node, context, seenSymbols = new Set(
|
|
|
251574
251513
|
seenSymbols.add(symbolId);
|
|
251575
251514
|
return (symbol.declarations ?? []).flatMap((declaration) => {
|
|
251576
251515
|
const estreeDeclaration = context.tsNodeToESTreeNodeMap.get(declaration);
|
|
251577
|
-
|
|
251578
|
-
|
|
251579
|
-
|
|
251580
|
-
return resolveFunctionLikeFromContainer(estreeDeclaration, context, seenSymbols);
|
|
251516
|
+
return !estreeDeclaration || !isInspectableFunctionContainer(estreeDeclaration)
|
|
251517
|
+
? []
|
|
251518
|
+
: resolveFunctionLikeFromContainer(estreeDeclaration, context, seenSymbols);
|
|
251581
251519
|
});
|
|
251582
251520
|
}
|
|
251583
251521
|
function resolveCalledFunctions(node, context) {
|
|
@@ -251713,7 +251651,7 @@ function inspectComputedBody(root, context, localScopes, visitedFunctions, repor
|
|
|
251713
251651
|
return;
|
|
251714
251652
|
});
|
|
251715
251653
|
}
|
|
251716
|
-
const rule$
|
|
251654
|
+
const rule$s = createRule({
|
|
251717
251655
|
create(context) {
|
|
251718
251656
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode, tsNodeToESTreeNodeMap, } = getTypeAwareRuleContext(context);
|
|
251719
251657
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -251756,7 +251694,7 @@ const rule$q = createRule({
|
|
|
251756
251694
|
name: 'no-side-effects-in-computed',
|
|
251757
251695
|
});
|
|
251758
251696
|
|
|
251759
|
-
const rule$
|
|
251697
|
+
const rule$r = createUntrackedRule({
|
|
251760
251698
|
create(context) {
|
|
251761
251699
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode } = getTypeAwareRuleContext(context);
|
|
251762
251700
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -251803,20 +251741,18 @@ const rule$p = createUntrackedRule({
|
|
|
251803
251741
|
});
|
|
251804
251742
|
|
|
251805
251743
|
function collectParts(node) {
|
|
251806
|
-
|
|
251807
|
-
|
|
251808
|
-
|
|
251809
|
-
return [node];
|
|
251744
|
+
return node.type === dist$3.AST_NODE_TYPES.BinaryExpression && node.operator === '+'
|
|
251745
|
+
? [...collectParts(node.left), ...collectParts(node.right)]
|
|
251746
|
+
: [node];
|
|
251810
251747
|
}
|
|
251811
251748
|
function isRootConcat(node) {
|
|
251812
251749
|
const { parent } = node;
|
|
251813
251750
|
return parent.type !== dist$3.AST_NODE_TYPES.BinaryExpression || parent.operator !== '+';
|
|
251814
251751
|
}
|
|
251815
251752
|
function isStringType(type, checker) {
|
|
251816
|
-
|
|
251817
|
-
|
|
251818
|
-
|
|
251819
|
-
return type.isStringLiteral() || checker.typeToString(type) === 'string';
|
|
251753
|
+
return type.isUnion()
|
|
251754
|
+
? type.types.every((t) => isStringType(t, checker))
|
|
251755
|
+
: type.isStringLiteral() || checker.typeToString(type) === 'string';
|
|
251820
251756
|
}
|
|
251821
251757
|
function buildMergedString(parts) {
|
|
251822
251758
|
const combined = parts.map((p) => p.value).join('');
|
|
@@ -251850,7 +251786,7 @@ function templateContent(template, renderExpr) {
|
|
|
251850
251786
|
: ''}`)
|
|
251851
251787
|
.join('');
|
|
251852
251788
|
}
|
|
251853
|
-
const rule$
|
|
251789
|
+
const rule$q = createRule({
|
|
251854
251790
|
create(context) {
|
|
251855
251791
|
const { sourceCode } = context;
|
|
251856
251792
|
let parserServices = null;
|
|
@@ -251962,28 +251898,25 @@ function buildUntrackedImportFixes(program, fixer) {
|
|
|
251962
251898
|
const coreImport = findRuntimeAngularCoreImport(program);
|
|
251963
251899
|
if (!coreImport) {
|
|
251964
251900
|
const firstStatement = program.body[0];
|
|
251965
|
-
|
|
251966
|
-
|
|
251967
|
-
|
|
251968
|
-
|
|
251969
|
-
|
|
251970
|
-
];
|
|
251901
|
+
return firstStatement
|
|
251902
|
+
? [
|
|
251903
|
+
fixer.insertTextBefore(firstStatement, "import { untracked } from '@angular/core';\n"),
|
|
251904
|
+
]
|
|
251905
|
+
: [];
|
|
251971
251906
|
}
|
|
251972
251907
|
const namedSpecifiers = coreImport.specifiers.filter((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportSpecifier);
|
|
251973
251908
|
if (namedSpecifiers.length > 0) {
|
|
251974
251909
|
const lastNamedSpecifier = namedSpecifiers[namedSpecifiers.length - 1];
|
|
251975
|
-
|
|
251976
|
-
|
|
251977
|
-
|
|
251978
|
-
return [fixer.insertTextAfter(lastNamedSpecifier, ', untracked')];
|
|
251910
|
+
return lastNamedSpecifier
|
|
251911
|
+
? [fixer.insertTextAfter(lastNamedSpecifier, ', untracked')]
|
|
251912
|
+
: [];
|
|
251979
251913
|
}
|
|
251980
251914
|
const defaultImport = coreImport.specifiers.find((specifier) => specifier.type === dist$3.AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
251981
|
-
|
|
251982
|
-
|
|
251983
|
-
|
|
251984
|
-
|
|
251985
|
-
|
|
251986
|
-
];
|
|
251915
|
+
return defaultImport
|
|
251916
|
+
? [fixer.insertTextAfter(defaultImport, ', { untracked }')]
|
|
251917
|
+
: [
|
|
251918
|
+
fixer.insertTextAfter(coreImport, "\nimport { untracked } from '@angular/core';"),
|
|
251919
|
+
];
|
|
251987
251920
|
}
|
|
251988
251921
|
/**
|
|
251989
251922
|
* Removes the `untracked` import specifier from `@angular/core`.
|
|
@@ -251995,7 +251928,6 @@ function buildImportRemovalFixes(program, fixer, sourceCode) {
|
|
|
251995
251928
|
return [];
|
|
251996
251929
|
}
|
|
251997
251930
|
const { importDecl, specifier: untrackedSpec } = match;
|
|
251998
|
-
const namedSpecifiers = importDecl.specifiers.filter((s) => s.type === dist$3.AST_NODE_TYPES.ImportSpecifier);
|
|
251999
251931
|
if (importDecl.specifiers.length === 1) {
|
|
252000
251932
|
return [fixer.remove(importDecl)];
|
|
252001
251933
|
}
|
|
@@ -252013,24 +251945,19 @@ function buildImportRemovalFixes(program, fixer, sourceCode) {
|
|
|
252013
251945
|
// Try to remove a leading comma (last specifier)
|
|
252014
251946
|
const textBefore = importText.slice(0, specStart - importStart);
|
|
252015
251947
|
const leadingCommaIdx = textBefore.lastIndexOf(',');
|
|
252016
|
-
|
|
252017
|
-
|
|
252018
|
-
|
|
252019
|
-
if (namedSpecifiers.length === 1) {
|
|
252020
|
-
return [fixer.remove(untrackedSpec)];
|
|
252021
|
-
}
|
|
252022
|
-
return [fixer.remove(untrackedSpec)];
|
|
251948
|
+
return leadingCommaIdx === -1
|
|
251949
|
+
? [fixer.remove(untrackedSpec)]
|
|
251950
|
+
: [fixer.removeRange([importStart + leadingCommaIdx, specEnd])];
|
|
252023
251951
|
}
|
|
252024
251952
|
|
|
252025
251953
|
function hasNamedDecorator(node, name) {
|
|
252026
251954
|
return node.decorators.some((decorator) => {
|
|
252027
251955
|
const expression = decorator.expression;
|
|
252028
|
-
|
|
252029
|
-
|
|
252030
|
-
|
|
252031
|
-
|
|
252032
|
-
|
|
252033
|
-
expression.callee.name === name);
|
|
251956
|
+
return expression.type === dist$3.AST_NODE_TYPES.Identifier
|
|
251957
|
+
? expression.name === name
|
|
251958
|
+
: expression.type === dist$3.AST_NODE_TYPES.CallExpression &&
|
|
251959
|
+
expression.callee.type === dist$3.AST_NODE_TYPES.Identifier &&
|
|
251960
|
+
expression.callee.name === name;
|
|
252034
251961
|
});
|
|
252035
251962
|
}
|
|
252036
251963
|
|
|
@@ -252086,13 +252013,12 @@ function dedent(text, extraSpaces) {
|
|
|
252086
252013
|
|
|
252087
252014
|
function isDirectCallOrNewArgument(node) {
|
|
252088
252015
|
const parent = node.parent;
|
|
252089
|
-
|
|
252090
|
-
node.type !== dist$3.AST_NODE_TYPES.FunctionExpression
|
|
252091
|
-
|
|
252092
|
-
|
|
252093
|
-
|
|
252094
|
-
|
|
252095
|
-
parent.arguments.includes(node));
|
|
252016
|
+
return node.type !== dist$3.AST_NODE_TYPES.ArrowFunctionExpression &&
|
|
252017
|
+
node.type !== dist$3.AST_NODE_TYPES.FunctionExpression
|
|
252018
|
+
? false
|
|
252019
|
+
: (parent.type === dist$3.AST_NODE_TYPES.CallExpression ||
|
|
252020
|
+
parent.type === dist$3.AST_NODE_TYPES.NewExpression) &&
|
|
252021
|
+
parent.arguments.includes(node);
|
|
252096
252022
|
}
|
|
252097
252023
|
function isStoredFunctionUsedAsCallOrNewArgument(fn, checker, esTreeNodeToTSNodeMap) {
|
|
252098
252024
|
const parent = fn.parent;
|
|
@@ -252163,29 +252089,26 @@ function isAllowedDeferredCallbackContext(node, checker, esTreeNodeToTSNodeMap)
|
|
|
252163
252089
|
return false;
|
|
252164
252090
|
}
|
|
252165
252091
|
const fn = getEnclosingFunction(node);
|
|
252166
|
-
|
|
252167
|
-
|
|
252168
|
-
|
|
252169
|
-
|
|
252170
|
-
isStoredFunctionUsedAsCallOrNewArgument(fn, checker, esTreeNodeToTSNodeMap));
|
|
252092
|
+
return fn
|
|
252093
|
+
? isDirectCallOrNewArgument(fn) ||
|
|
252094
|
+
isStoredFunctionUsedAsCallOrNewArgument(fn, checker, esTreeNodeToTSNodeMap)
|
|
252095
|
+
: false;
|
|
252171
252096
|
}
|
|
252172
252097
|
function isAllowedLazyAngularFactoryContext(node, program) {
|
|
252173
252098
|
const fn = getEnclosingFunction(node);
|
|
252174
|
-
|
|
252175
|
-
|
|
252176
|
-
|
|
252177
|
-
|
|
252178
|
-
isAngularUseFactoryFunction(fn));
|
|
252099
|
+
return !fn || !getReturnedReactiveOwnerCall(node, program)
|
|
252100
|
+
? false
|
|
252101
|
+
: isAngularInjectionTokenFactoryFunction(fn, program) ||
|
|
252102
|
+
isAngularUseFactoryFunction(fn);
|
|
252179
252103
|
}
|
|
252180
252104
|
function buildReactiveCallReplacement(outerUntrackedCall, reactiveCall, sourceCode) {
|
|
252181
252105
|
const text = sourceCode.getText(reactiveCall);
|
|
252182
|
-
|
|
252183
|
-
outerUntrackedCall.parent.type !== dist$3.AST_NODE_TYPES.ExpressionStatement
|
|
252184
|
-
|
|
252185
|
-
|
|
252186
|
-
return dedent(text, reactiveCall.loc.start.column - outerUntrackedCall.parent.loc.start.column);
|
|
252106
|
+
return reactiveCall.parent.type !== dist$3.AST_NODE_TYPES.ExpressionStatement ||
|
|
252107
|
+
outerUntrackedCall.parent.type !== dist$3.AST_NODE_TYPES.ExpressionStatement
|
|
252108
|
+
? text
|
|
252109
|
+
: dedent(text, reactiveCall.loc.start.column - outerUntrackedCall.parent.loc.start.column);
|
|
252187
252110
|
}
|
|
252188
|
-
const rule$
|
|
252111
|
+
const rule$p = createUntrackedRule({
|
|
252189
252112
|
create(context) {
|
|
252190
252113
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode } = getTypeAwareRuleContext(context);
|
|
252191
252114
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -252221,7 +252144,7 @@ const rule$n = createUntrackedRule({
|
|
|
252221
252144
|
fixer.replaceText(node, buildReactiveCallReplacement(node, reactiveCall, sourceCode)),
|
|
252222
252145
|
];
|
|
252223
252146
|
const untrackedLocalName = findUntrackedAlias(program);
|
|
252224
|
-
const stillUsed = untrackedLocalName
|
|
252147
|
+
const stillUsed = untrackedLocalName != null &&
|
|
252225
252148
|
isUntrackedUsedElsewhere(untrackedLocalName, node);
|
|
252226
252149
|
if (!stillUsed) {
|
|
252227
252150
|
fixes.push(...buildImportRemovalFixes(program, fixer, sourceCode));
|
|
@@ -252314,7 +252237,7 @@ function hasOpaqueSynchronousCalls(root, checker, esTreeNodeToTSNodeMap, program
|
|
|
252314
252237
|
});
|
|
252315
252238
|
return found;
|
|
252316
252239
|
}
|
|
252317
|
-
const rule$
|
|
252240
|
+
const rule$o = createUntrackedRule({
|
|
252318
252241
|
create(context) {
|
|
252319
252242
|
const { checker, esTreeNodeToTSNodeMap, program, sourceCode } = getTypeAwareRuleContext(context);
|
|
252320
252243
|
const signalNodeMap = esTreeNodeToTSNodeMap;
|
|
@@ -252345,11 +252268,11 @@ const rule$m = createUntrackedRule({
|
|
|
252345
252268
|
? (fixer) => {
|
|
252346
252269
|
const parentStmt = parent;
|
|
252347
252270
|
const replacement = buildReplacement(untrackedCall, parentStmt, sourceCode);
|
|
252348
|
-
if (replacement
|
|
252271
|
+
if (replacement == null) {
|
|
252349
252272
|
return null;
|
|
252350
252273
|
}
|
|
252351
252274
|
const untrackedLocalName = findUntrackedAlias(program);
|
|
252352
|
-
const stillUsed = untrackedLocalName
|
|
252275
|
+
const stillUsed = untrackedLocalName != null &&
|
|
252353
252276
|
isUntrackedUsedElsewhere(untrackedLocalName, untrackedCall);
|
|
252354
252277
|
const fixes = [fixer.replaceText(parentStmt, replacement)];
|
|
252355
252278
|
if (!stillUsed) {
|
|
@@ -252396,17 +252319,16 @@ const rule$m = createUntrackedRule({
|
|
|
252396
252319
|
name: 'no-useless-untracked',
|
|
252397
252320
|
});
|
|
252398
252321
|
|
|
252399
|
-
const rule$
|
|
252322
|
+
const rule$n = createRule({
|
|
252400
252323
|
create(context, [{ printWidth }]) {
|
|
252401
252324
|
const sourceCode = context.sourceCode;
|
|
252402
252325
|
const getLineEndIndex = (lineStartIndex) => {
|
|
252403
252326
|
const text = sourceCode.text;
|
|
252404
252327
|
const newLineIndex = text.indexOf('\n', lineStartIndex);
|
|
252405
252328
|
const rawEndIndex = newLineIndex === -1 ? text.length : newLineIndex;
|
|
252406
|
-
|
|
252407
|
-
|
|
252408
|
-
|
|
252409
|
-
return rawEndIndex;
|
|
252329
|
+
return rawEndIndex > lineStartIndex && text[rawEndIndex - 1] === '\r'
|
|
252330
|
+
? rawEndIndex - 1
|
|
252331
|
+
: rawEndIndex;
|
|
252410
252332
|
};
|
|
252411
252333
|
const hasAnyCommentsInside = (node) => sourceCode.getCommentsInside(node).length > 0;
|
|
252412
252334
|
const isTemplateLikeExpression = (expression) => expression.type === dist$2.AST_NODE_TYPES.TemplateLiteral ||
|
|
@@ -252478,34 +252400,28 @@ const rule$l = createRule({
|
|
|
252478
252400
|
const valueExpression = property.value;
|
|
252479
252401
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
252480
252402
|
const valueText = renderExpressionOneLine(valueExpression);
|
|
252481
|
-
|
|
252482
|
-
|
|
252483
|
-
|
|
252484
|
-
return `${keyText}: ${valueText}`;
|
|
252403
|
+
return property.computed
|
|
252404
|
+
? `[${keyText}]: ${valueText}`
|
|
252405
|
+
: `${keyText}: ${valueText}`;
|
|
252485
252406
|
};
|
|
252486
252407
|
const renderObjectExpressionOneLine = (node) => {
|
|
252487
252408
|
const [onlyProperty] = node.properties;
|
|
252488
|
-
|
|
252489
|
-
return '{}';
|
|
252490
|
-
}
|
|
252491
|
-
return `{${renderPropertyOneLine(onlyProperty)}}`;
|
|
252409
|
+
return onlyProperty ? `{${renderPropertyOneLine(onlyProperty)}}` : '{}';
|
|
252492
252410
|
};
|
|
252493
252411
|
const renderExpressionOneLine = (expression) => {
|
|
252494
252412
|
const innerParen = getParenthesizedInner(expression);
|
|
252495
252413
|
if (innerParen) {
|
|
252496
252414
|
const inner = unwrapExpression(innerParen);
|
|
252497
|
-
|
|
252498
|
-
canInlineObjectExpression(inner)
|
|
252499
|
-
|
|
252500
|
-
|
|
252501
|
-
return sourceCode.getText(expression);
|
|
252415
|
+
return inner.type === dist$2.AST_NODE_TYPES.ObjectExpression &&
|
|
252416
|
+
canInlineObjectExpression(inner)
|
|
252417
|
+
? `(${renderObjectExpressionOneLine(inner)})`
|
|
252418
|
+
: sourceCode.getText(expression);
|
|
252502
252419
|
}
|
|
252503
252420
|
const unwrapped = unwrapExpression(expression);
|
|
252504
|
-
|
|
252505
|
-
canInlineObjectExpression(unwrapped)
|
|
252506
|
-
|
|
252507
|
-
|
|
252508
|
-
return sourceCode.getText(expression);
|
|
252421
|
+
return unwrapped.type === dist$2.AST_NODE_TYPES.ObjectExpression &&
|
|
252422
|
+
canInlineObjectExpression(unwrapped)
|
|
252423
|
+
? renderObjectExpressionOneLine(unwrapped)
|
|
252424
|
+
: sourceCode.getText(expression);
|
|
252509
252425
|
};
|
|
252510
252426
|
const hasPendingInnerInlineCandidate = (node) => {
|
|
252511
252427
|
if (node.properties.length !== 1) {
|
|
@@ -252717,7 +252633,7 @@ function renderTest(node, sourceCode) {
|
|
|
252717
252633
|
const text = sourceCode.getText(node);
|
|
252718
252634
|
return needsParenthesesInOrChain(node) ? `(${text})` : text;
|
|
252719
252635
|
}
|
|
252720
|
-
const rule$
|
|
252636
|
+
const rule$m = createRule({
|
|
252721
252637
|
create(context) {
|
|
252722
252638
|
const { sourceCode } = context;
|
|
252723
252639
|
function checkBody(statements) {
|
|
@@ -252806,6 +252722,270 @@ const rule$k = createRule({
|
|
|
252806
252722
|
name: 'prefer-combined-if-control-flow',
|
|
252807
252723
|
});
|
|
252808
252724
|
|
|
252725
|
+
const MAX_INLINE_CONDITIONAL_RETURN_LENGTH = 90;
|
|
252726
|
+
function getReturnStatement(statement) {
|
|
252727
|
+
if (statement.type === dist$3.AST_NODE_TYPES.ReturnStatement) {
|
|
252728
|
+
return statement;
|
|
252729
|
+
}
|
|
252730
|
+
if (statement.type !== dist$3.AST_NODE_TYPES.BlockStatement || statement.body.length !== 1) {
|
|
252731
|
+
return null;
|
|
252732
|
+
}
|
|
252733
|
+
const [onlyStatement] = statement.body;
|
|
252734
|
+
return onlyStatement?.type === dist$3.AST_NODE_TYPES.ReturnStatement ? onlyStatement : null;
|
|
252735
|
+
}
|
|
252736
|
+
function hasOnlyWhitespaceBetween(sourceCode, left, right) {
|
|
252737
|
+
return sourceCode.text.slice(left.range[1], right.range[0]).trim() === '';
|
|
252738
|
+
}
|
|
252739
|
+
function unwrapTypeAndParentheses(node) {
|
|
252740
|
+
let current = node;
|
|
252741
|
+
let didUnwrap = true;
|
|
252742
|
+
while (didUnwrap) {
|
|
252743
|
+
didUnwrap = false;
|
|
252744
|
+
const parenthesized = unwrapParenthesized(current);
|
|
252745
|
+
if (parenthesized !== current) {
|
|
252746
|
+
current = parenthesized;
|
|
252747
|
+
didUnwrap = true;
|
|
252748
|
+
continue;
|
|
252749
|
+
}
|
|
252750
|
+
switch (current.type) {
|
|
252751
|
+
case dist$3.AST_NODE_TYPES.TSAsExpression:
|
|
252752
|
+
case dist$3.AST_NODE_TYPES.TSNonNullExpression:
|
|
252753
|
+
case dist$3.AST_NODE_TYPES.TSSatisfiesExpression:
|
|
252754
|
+
case dist$3.AST_NODE_TYPES.TSTypeAssertion:
|
|
252755
|
+
current = current.expression;
|
|
252756
|
+
didUnwrap = true;
|
|
252757
|
+
break;
|
|
252758
|
+
}
|
|
252759
|
+
}
|
|
252760
|
+
return current;
|
|
252761
|
+
}
|
|
252762
|
+
function isConditionalExpression(node) {
|
|
252763
|
+
return (node !== null &&
|
|
252764
|
+
unwrapTypeAndParentheses(node).type === dist$3.AST_NODE_TYPES.ConditionalExpression);
|
|
252765
|
+
}
|
|
252766
|
+
function needsParenthesesInConditionalTest(node) {
|
|
252767
|
+
if (getParenthesizedInner(node)) {
|
|
252768
|
+
return false;
|
|
252769
|
+
}
|
|
252770
|
+
switch (node.type) {
|
|
252771
|
+
case dist$3.AST_NODE_TYPES.ArrowFunctionExpression:
|
|
252772
|
+
case dist$3.AST_NODE_TYPES.AssignmentExpression:
|
|
252773
|
+
case dist$3.AST_NODE_TYPES.ConditionalExpression:
|
|
252774
|
+
case dist$3.AST_NODE_TYPES.ObjectExpression:
|
|
252775
|
+
case dist$3.AST_NODE_TYPES.SequenceExpression:
|
|
252776
|
+
case dist$3.AST_NODE_TYPES.TSAsExpression:
|
|
252777
|
+
case dist$3.AST_NODE_TYPES.TSSatisfiesExpression:
|
|
252778
|
+
case dist$3.AST_NODE_TYPES.TSTypeAssertion:
|
|
252779
|
+
case dist$3.AST_NODE_TYPES.YieldExpression:
|
|
252780
|
+
return true;
|
|
252781
|
+
default:
|
|
252782
|
+
return false;
|
|
252783
|
+
}
|
|
252784
|
+
}
|
|
252785
|
+
function needsParenthesesInConditionalBranch(node) {
|
|
252786
|
+
if (getParenthesizedInner(node)) {
|
|
252787
|
+
return false;
|
|
252788
|
+
}
|
|
252789
|
+
switch (node.type) {
|
|
252790
|
+
case dist$3.AST_NODE_TYPES.ArrowFunctionExpression:
|
|
252791
|
+
case dist$3.AST_NODE_TYPES.AssignmentExpression:
|
|
252792
|
+
case dist$3.AST_NODE_TYPES.ConditionalExpression:
|
|
252793
|
+
case dist$3.AST_NODE_TYPES.SequenceExpression:
|
|
252794
|
+
case dist$3.AST_NODE_TYPES.TSAsExpression:
|
|
252795
|
+
case dist$3.AST_NODE_TYPES.TSSatisfiesExpression:
|
|
252796
|
+
case dist$3.AST_NODE_TYPES.TSTypeAssertion:
|
|
252797
|
+
case dist$3.AST_NODE_TYPES.YieldExpression:
|
|
252798
|
+
return true;
|
|
252799
|
+
default:
|
|
252800
|
+
return false;
|
|
252801
|
+
}
|
|
252802
|
+
}
|
|
252803
|
+
function renderExpression(node, sourceCode, needsParentheses) {
|
|
252804
|
+
const text = sourceCode.getText(node);
|
|
252805
|
+
return needsParentheses(node) ? `(${text})` : text;
|
|
252806
|
+
}
|
|
252807
|
+
function getStatementIndent(node, sourceCode) {
|
|
252808
|
+
const lineStart = sourceCode.getIndexFromLoc({
|
|
252809
|
+
column: 0,
|
|
252810
|
+
line: node.loc.start.line,
|
|
252811
|
+
});
|
|
252812
|
+
return sourceCode.text.slice(lineStart, node.range[0]);
|
|
252813
|
+
}
|
|
252814
|
+
function renderConditionalReturn(ifStatement, consequentExpression, alternateExpression, sourceCode) {
|
|
252815
|
+
const test = renderExpression(ifStatement.test, sourceCode, needsParenthesesInConditionalTest);
|
|
252816
|
+
const consequent = renderExpression(consequentExpression, sourceCode, needsParenthesesInConditionalBranch);
|
|
252817
|
+
const alternate = renderExpression(alternateExpression, sourceCode, needsParenthesesInConditionalBranch);
|
|
252818
|
+
const inlineReturn = `return ${test} ? ${consequent} : ${alternate};`;
|
|
252819
|
+
const indent = getStatementIndent(ifStatement, sourceCode);
|
|
252820
|
+
if (indent.length + inlineReturn.length <= MAX_INLINE_CONDITIONAL_RETURN_LENGTH) {
|
|
252821
|
+
return inlineReturn;
|
|
252822
|
+
}
|
|
252823
|
+
const branchIndent = `${indent} `;
|
|
252824
|
+
return `return ${test}\n${branchIndent}? ${consequent}\n${branchIndent}: ${alternate};`;
|
|
252825
|
+
}
|
|
252826
|
+
const rule$l = createRule({
|
|
252827
|
+
create(context) {
|
|
252828
|
+
const { sourceCode } = context;
|
|
252829
|
+
function checkBody(statements) {
|
|
252830
|
+
for (const [index, statement] of statements.entries()) {
|
|
252831
|
+
if (statement.type !== dist$3.AST_NODE_TYPES.IfStatement) {
|
|
252832
|
+
continue;
|
|
252833
|
+
}
|
|
252834
|
+
const nextStatement = statements[index + 1];
|
|
252835
|
+
if (nextStatement?.type !== dist$3.AST_NODE_TYPES.ReturnStatement) {
|
|
252836
|
+
continue;
|
|
252837
|
+
}
|
|
252838
|
+
const consequentReturn = getReturnStatement(statement.consequent);
|
|
252839
|
+
const finalReturn = nextStatement;
|
|
252840
|
+
const consequentArgument = consequentReturn?.argument ?? null;
|
|
252841
|
+
const finalArgument = finalReturn.argument;
|
|
252842
|
+
if (statement.alternate ||
|
|
252843
|
+
!consequentArgument ||
|
|
252844
|
+
!finalArgument ||
|
|
252845
|
+
isConditionalExpression(consequentArgument) ||
|
|
252846
|
+
isConditionalExpression(finalArgument) ||
|
|
252847
|
+
!hasOnlyWhitespaceBetween(sourceCode, statement, finalReturn) ||
|
|
252848
|
+
sourceCode.getCommentsInside(statement).length > 0 ||
|
|
252849
|
+
sourceCode.getCommentsInside(finalReturn).length > 0) {
|
|
252850
|
+
continue;
|
|
252851
|
+
}
|
|
252852
|
+
context.report({
|
|
252853
|
+
fix(fixer) {
|
|
252854
|
+
const replacement = renderConditionalReturn(statement, consequentArgument, finalArgument, sourceCode);
|
|
252855
|
+
return fixer.replaceTextRange([statement.range[0], finalReturn.range[1]], replacement);
|
|
252856
|
+
},
|
|
252857
|
+
messageId: 'preferConditionalReturn',
|
|
252858
|
+
node: statement,
|
|
252859
|
+
});
|
|
252860
|
+
}
|
|
252861
|
+
}
|
|
252862
|
+
return {
|
|
252863
|
+
BlockStatement(node) {
|
|
252864
|
+
checkBody(node.body);
|
|
252865
|
+
},
|
|
252866
|
+
Program(node) {
|
|
252867
|
+
checkBody(node.body);
|
|
252868
|
+
},
|
|
252869
|
+
SwitchCase(node) {
|
|
252870
|
+
checkBody(node.consequent);
|
|
252871
|
+
},
|
|
252872
|
+
};
|
|
252873
|
+
},
|
|
252874
|
+
meta: {
|
|
252875
|
+
docs: {
|
|
252876
|
+
description: 'Prefer a single conditional return over an if statement followed by another return statement.',
|
|
252877
|
+
},
|
|
252878
|
+
fixable: 'code',
|
|
252879
|
+
messages: {
|
|
252880
|
+
preferConditionalReturn: 'Replace this if/return pair with a single conditional return.',
|
|
252881
|
+
},
|
|
252882
|
+
schema: [],
|
|
252883
|
+
type: 'suggestion',
|
|
252884
|
+
},
|
|
252885
|
+
name: 'prefer-conditional-return',
|
|
252886
|
+
});
|
|
252887
|
+
|
|
252888
|
+
function parseStrictNullCheck(node, getText) {
|
|
252889
|
+
if (node.type !== dist$3.AST_NODE_TYPES.BinaryExpression) {
|
|
252890
|
+
return null;
|
|
252891
|
+
}
|
|
252892
|
+
const { left, operator, right } = node;
|
|
252893
|
+
if (operator !== '!==' && operator !== '===') {
|
|
252894
|
+
return null;
|
|
252895
|
+
}
|
|
252896
|
+
if (right.type === dist$3.AST_NODE_TYPES.Literal && right.value === null) {
|
|
252897
|
+
return { comparedWith: 'null', operand: getText(left), strictOp: operator };
|
|
252898
|
+
}
|
|
252899
|
+
if (right.type === dist$3.AST_NODE_TYPES.Identifier && right.name === 'undefined') {
|
|
252900
|
+
return { comparedWith: 'undefined', operand: getText(left), strictOp: operator };
|
|
252901
|
+
}
|
|
252902
|
+
if (left.type === dist$3.AST_NODE_TYPES.Literal && left.value === null) {
|
|
252903
|
+
return { comparedWith: 'null', operand: getText(right), strictOp: operator };
|
|
252904
|
+
}
|
|
252905
|
+
return left.type === dist$3.AST_NODE_TYPES.Identifier && left.name === 'undefined'
|
|
252906
|
+
? { comparedWith: 'undefined', operand: getText(right), strictOp: operator }
|
|
252907
|
+
: null;
|
|
252908
|
+
}
|
|
252909
|
+
function isParsedNullCheck(value) {
|
|
252910
|
+
return value !== null;
|
|
252911
|
+
}
|
|
252912
|
+
function getLooseNullCheck(left, right) {
|
|
252913
|
+
return !isParsedNullCheck(left) ||
|
|
252914
|
+
!isParsedNullCheck(right) ||
|
|
252915
|
+
left.strictOp !== right.strictOp ||
|
|
252916
|
+
left.operand !== right.operand ||
|
|
252917
|
+
left.comparedWith === right.comparedWith
|
|
252918
|
+
? null
|
|
252919
|
+
: `${left.operand} ${left.strictOp === '!==' ? '!=' : '=='} null`;
|
|
252920
|
+
}
|
|
252921
|
+
function collectAndLeaves(node) {
|
|
252922
|
+
return node.type === dist$3.AST_NODE_TYPES.LogicalExpression && node.operator === '&&'
|
|
252923
|
+
? [...collectAndLeaves(node.left), ...collectAndLeaves(node.right)]
|
|
252924
|
+
: [node];
|
|
252925
|
+
}
|
|
252926
|
+
function isAndChainRoot(node) {
|
|
252927
|
+
return (node.parent.type !== dist$3.AST_NODE_TYPES.LogicalExpression ||
|
|
252928
|
+
node.parent.operator !== '&&');
|
|
252929
|
+
}
|
|
252930
|
+
function findLooseNullCheckMatch(parsedChecks) {
|
|
252931
|
+
for (const [firstCheckIndex, firstCheck] of parsedChecks.entries()) {
|
|
252932
|
+
if (!isParsedNullCheck(firstCheck)) {
|
|
252933
|
+
continue;
|
|
252934
|
+
}
|
|
252935
|
+
for (let secondCheckIndex = firstCheckIndex + 1; secondCheckIndex < parsedChecks.length; secondCheckIndex++) {
|
|
252936
|
+
const replacement = getLooseNullCheck(firstCheck, parsedChecks[secondCheckIndex] ?? null);
|
|
252937
|
+
if (replacement !== null) {
|
|
252938
|
+
return { firstCheckIndex, replacement, secondCheckIndex };
|
|
252939
|
+
}
|
|
252940
|
+
}
|
|
252941
|
+
}
|
|
252942
|
+
return null;
|
|
252943
|
+
}
|
|
252944
|
+
const rule$k = createRule({
|
|
252945
|
+
create(context) {
|
|
252946
|
+
const getText = (n) => context.sourceCode.getText(n);
|
|
252947
|
+
return {
|
|
252948
|
+
/**
|
|
252949
|
+
* Handles only paired null/undefined checks in the same `&&` chain.
|
|
252950
|
+
*/
|
|
252951
|
+
LogicalExpression(node) {
|
|
252952
|
+
if (node.operator !== '&&' || !isAndChainRoot(node)) {
|
|
252953
|
+
return;
|
|
252954
|
+
}
|
|
252955
|
+
const leaves = collectAndLeaves(node);
|
|
252956
|
+
const parsedChecks = leaves.map((leaf) => parseStrictNullCheck(leaf, getText));
|
|
252957
|
+
const match = findLooseNullCheckMatch(parsedChecks);
|
|
252958
|
+
if (match === null) {
|
|
252959
|
+
return;
|
|
252960
|
+
}
|
|
252961
|
+
const replacement = leaves
|
|
252962
|
+
.filter((_, index) => index !== match.secondCheckIndex)
|
|
252963
|
+
.map((leaf, index) => index === match.firstCheckIndex
|
|
252964
|
+
? match.replacement
|
|
252965
|
+
: getText(leaf))
|
|
252966
|
+
.join(' && ');
|
|
252967
|
+
context.report({
|
|
252968
|
+
fix: (fixer) => fixer.replaceText(node, replacement),
|
|
252969
|
+
messageId: 'preferLooseNullCheck',
|
|
252970
|
+
node,
|
|
252971
|
+
});
|
|
252972
|
+
},
|
|
252973
|
+
};
|
|
252974
|
+
},
|
|
252975
|
+
meta: {
|
|
252976
|
+
docs: {
|
|
252977
|
+
description: 'Prefer loose null checks over paired strict comparisons against `null` and `undefined`.',
|
|
252978
|
+
},
|
|
252979
|
+
fixable: 'code',
|
|
252980
|
+
messages: {
|
|
252981
|
+
preferLooseNullCheck: 'Prefer loose null check over paired strict comparisons against `null` and `undefined`.',
|
|
252982
|
+
},
|
|
252983
|
+
schema: [],
|
|
252984
|
+
type: 'suggestion',
|
|
252985
|
+
},
|
|
252986
|
+
name: 'prefer-loose-null-check',
|
|
252987
|
+
});
|
|
252988
|
+
|
|
252809
252989
|
function getPushCall(node) {
|
|
252810
252990
|
if (node.expression.type !== dist$3.AST_NODE_TYPES.CallExpression) {
|
|
252811
252991
|
return null;
|
|
@@ -252815,10 +252995,9 @@ function getPushCall(node) {
|
|
|
252815
252995
|
return null;
|
|
252816
252996
|
}
|
|
252817
252997
|
const { property } = call.callee;
|
|
252818
|
-
|
|
252819
|
-
|
|
252820
|
-
|
|
252821
|
-
return call;
|
|
252998
|
+
return property.type !== dist$3.AST_NODE_TYPES.Identifier || property.name !== 'push'
|
|
252999
|
+
? null
|
|
253000
|
+
: call;
|
|
252822
253001
|
}
|
|
252823
253002
|
const rule$j = createRule({
|
|
252824
253003
|
create(context) {
|
|
@@ -252866,10 +253045,12 @@ const rule$j = createRule({
|
|
|
252866
253045
|
.map((arg) => sourceCode.getText(arg))
|
|
252867
253046
|
.join(', ');
|
|
252868
253047
|
const lastStmt = group[group.length - 1];
|
|
252869
|
-
|
|
252870
|
-
|
|
252871
|
-
|
|
252872
|
-
|
|
253048
|
+
return lastStmt
|
|
253049
|
+
? fixer.replaceTextRange([
|
|
253050
|
+
groupStmt.range[0],
|
|
253051
|
+
lastStmt.range[1],
|
|
253052
|
+
], `${arrayText}.push(${allArgs});`)
|
|
253053
|
+
: null;
|
|
252873
253054
|
},
|
|
252874
253055
|
}
|
|
252875
253056
|
: {}),
|
|
@@ -252909,10 +253090,9 @@ function getModuleKeywordToken(sourceCode, node) {
|
|
|
252909
253090
|
if (!firstToken) {
|
|
252910
253091
|
return null;
|
|
252911
253092
|
}
|
|
252912
|
-
|
|
252913
|
-
|
|
252914
|
-
|
|
252915
|
-
return firstToken;
|
|
253093
|
+
return firstToken.value === 'declare'
|
|
253094
|
+
? (sourceCode.getTokenAfter(firstToken) ?? null)
|
|
253095
|
+
: firstToken;
|
|
252916
253096
|
}
|
|
252917
253097
|
const rule$i = createRule({
|
|
252918
253098
|
create(context) {
|
|
@@ -253009,20 +253189,18 @@ function unwrapUsageExpression(node) {
|
|
|
253009
253189
|
}
|
|
253010
253190
|
function isStatementPositionCall(node) {
|
|
253011
253191
|
const usage = unwrapUsageExpression(node);
|
|
253012
|
-
|
|
253013
|
-
|
|
253014
|
-
|
|
253015
|
-
|
|
253016
|
-
usage.parent.parent.type === dist$3.AST_NODE_TYPES.ExpressionStatement);
|
|
253192
|
+
return usage.parent?.type === dist$3.AST_NODE_TYPES.ExpressionStatement
|
|
253193
|
+
? true
|
|
253194
|
+
: usage.parent?.type === dist$3.AST_NODE_TYPES.AwaitExpression &&
|
|
253195
|
+
usage.parent.parent.type === dist$3.AST_NODE_TYPES.ExpressionStatement;
|
|
253017
253196
|
}
|
|
253018
253197
|
function isConsoleMethodCall(node) {
|
|
253019
|
-
|
|
253198
|
+
return node.callee.type !== dist$3.AST_NODE_TYPES.MemberExpression ||
|
|
253020
253199
|
node.callee.object.type !== dist$3.AST_NODE_TYPES.Identifier ||
|
|
253021
253200
|
node.callee.object.name !== 'console' ||
|
|
253022
|
-
node.callee.property.type !== dist$3.AST_NODE_TYPES.Identifier
|
|
253023
|
-
|
|
253024
|
-
|
|
253025
|
-
return CONSOLE_METHODS.has(node.callee.property.name);
|
|
253201
|
+
node.callee.property.type !== dist$3.AST_NODE_TYPES.Identifier
|
|
253202
|
+
? false
|
|
253203
|
+
: CONSOLE_METHODS.has(node.callee.property.name);
|
|
253026
253204
|
}
|
|
253027
253205
|
function isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap) {
|
|
253028
253206
|
if (node.callee.type === dist$3.AST_NODE_TYPES.MemberExpression &&
|
|
@@ -253044,14 +253222,13 @@ function isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap) {
|
|
|
253044
253222
|
return returnType === 'void' || returnType === 'Promise<void>';
|
|
253045
253223
|
}
|
|
253046
253224
|
function isSuspiciousDomCallArgumentConsumer(node, checker, esTreeNodeToTSNodeMap, program) {
|
|
253047
|
-
|
|
253225
|
+
return isAngularUntrackedCall(node, program) ||
|
|
253048
253226
|
isSignalReadCall(node, checker, esTreeNodeToTSNodeMap) ||
|
|
253049
253227
|
isWritableSignalWrite(node, checker, esTreeNodeToTSNodeMap) ||
|
|
253050
253228
|
!isStatementPositionCall(node) ||
|
|
253051
|
-
isConsoleMethodCall(node)
|
|
253052
|
-
|
|
253053
|
-
|
|
253054
|
-
return isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap);
|
|
253229
|
+
isConsoleMethodCall(node)
|
|
253230
|
+
? false
|
|
253231
|
+
: isDomImperativeCall(node, checker, esTreeNodeToTSNodeMap);
|
|
253055
253232
|
}
|
|
253056
253233
|
function isAliasDeclarationIdentifier(node) {
|
|
253057
253234
|
return (node.type === dist$3.AST_NODE_TYPES.Identifier &&
|
|
@@ -253191,15 +253368,14 @@ const rule$h = createUntrackedRule({
|
|
|
253191
253368
|
const estreeNodeMap = tsNodeToESTreeNodeMap;
|
|
253192
253369
|
function buildFix(read) {
|
|
253193
253370
|
const untrackedAlias = findUntrackedAlias(program);
|
|
253194
|
-
const alreadyHasUntracked = untrackedAlias
|
|
253371
|
+
const alreadyHasUntracked = untrackedAlias != null;
|
|
253195
253372
|
const wrapped = buildUntrackedWrap(read, sourceCode, untrackedAlias ?? 'untracked');
|
|
253196
|
-
|
|
253197
|
-
|
|
253198
|
-
|
|
253199
|
-
|
|
253200
|
-
|
|
253201
|
-
|
|
253202
|
-
];
|
|
253373
|
+
return alreadyHasUntracked
|
|
253374
|
+
? (fixer) => [fixer.replaceText(read, wrapped)]
|
|
253375
|
+
: (fixer) => [
|
|
253376
|
+
fixer.replaceText(read, wrapped),
|
|
253377
|
+
...buildUntrackedImportFixes(program, fixer),
|
|
253378
|
+
];
|
|
253203
253379
|
}
|
|
253204
253380
|
return {
|
|
253205
253381
|
CallExpression(node) {
|
|
@@ -253248,10 +253424,9 @@ function getReturnedExpression(node) {
|
|
|
253248
253424
|
return null;
|
|
253249
253425
|
}
|
|
253250
253426
|
const statement = node.body.body[0];
|
|
253251
|
-
|
|
253252
|
-
|
|
253253
|
-
|
|
253254
|
-
return statement.argument;
|
|
253427
|
+
return statement?.type !== dist$3.AST_NODE_TYPES.ReturnStatement || !statement.argument
|
|
253428
|
+
? null
|
|
253429
|
+
: statement.argument;
|
|
253255
253430
|
}
|
|
253256
253431
|
|
|
253257
253432
|
function getWrappedSignalGetter(node, checker, esTreeNodeToTSNodeMap) {
|
|
@@ -253521,13 +253696,13 @@ const VALID_CONTAINERS = new Set(['menu', 'ol', 'ul']);
|
|
|
253521
253696
|
*/
|
|
253522
253697
|
function isElement(node) {
|
|
253523
253698
|
return (typeof node === 'object' &&
|
|
253524
|
-
node
|
|
253699
|
+
node != null &&
|
|
253525
253700
|
typeof node['name'] === 'string' &&
|
|
253526
253701
|
Array.isArray(node['children']));
|
|
253527
253702
|
}
|
|
253528
253703
|
function getClosestParentElement(node) {
|
|
253529
253704
|
let current = node['parent'];
|
|
253530
|
-
while (current
|
|
253705
|
+
while (current != null) {
|
|
253531
253706
|
if (isElement(current)) {
|
|
253532
253707
|
return current;
|
|
253533
253708
|
}
|
|
@@ -253651,10 +253826,9 @@ function isImportsArrayProperty(property) {
|
|
|
253651
253826
|
}
|
|
253652
253827
|
|
|
253653
253828
|
function getImportedName$1(spec) {
|
|
253654
|
-
|
|
253655
|
-
|
|
253656
|
-
|
|
253657
|
-
return spec.imported.value;
|
|
253829
|
+
return spec.imported.type === dist$3.AST_NODE_TYPES.Identifier
|
|
253830
|
+
? spec.imported.name
|
|
253831
|
+
: spec.imported.value;
|
|
253658
253832
|
}
|
|
253659
253833
|
|
|
253660
253834
|
const MESSAGE_ID$3 = 'replaceTuiImport';
|
|
@@ -253851,10 +254025,7 @@ function getLineBreak(text) {
|
|
|
253851
254025
|
if (text.includes('\r\n')) {
|
|
253852
254026
|
return '\r\n';
|
|
253853
254027
|
}
|
|
253854
|
-
|
|
253855
|
-
return '\r';
|
|
253856
|
-
}
|
|
253857
|
-
return '\n';
|
|
254028
|
+
return text.includes('\r') ? '\r' : '\n';
|
|
253858
254029
|
}
|
|
253859
254030
|
function getLeadingIndentation(text) {
|
|
253860
254031
|
let index = 0;
|
|
@@ -253968,11 +254139,10 @@ function getVariableSpacingStatement(node) {
|
|
|
253968
254139
|
if (node.type === dist$3.AST_NODE_TYPES.VariableDeclaration) {
|
|
253969
254140
|
return { declaration: node, exported: false, node };
|
|
253970
254141
|
}
|
|
253971
|
-
|
|
253972
|
-
node.declaration?.type !== dist$3.AST_NODE_TYPES.VariableDeclaration
|
|
253973
|
-
|
|
253974
|
-
|
|
253975
|
-
return { declaration: node.declaration, exported: true, node };
|
|
254142
|
+
return node.type !== dist$3.AST_NODE_TYPES.ExportNamedDeclaration ||
|
|
254143
|
+
node.declaration?.type !== dist$3.AST_NODE_TYPES.VariableDeclaration
|
|
254144
|
+
? null
|
|
254145
|
+
: { declaration: node.declaration, exported: true, node };
|
|
253976
254146
|
}
|
|
253977
254147
|
function isRequireCall(node) {
|
|
253978
254148
|
return (node.type === dist$3.AST_NODE_TYPES.CallExpression &&
|
|
@@ -253994,10 +254164,9 @@ function isImportLikeInitializer(node) {
|
|
|
253994
254164
|
if (initializer.type === dist$3.AST_NODE_TYPES.MemberExpression) {
|
|
253995
254165
|
return isImportLikeInitializer(initializer.object);
|
|
253996
254166
|
}
|
|
253997
|
-
|
|
253998
|
-
|
|
253999
|
-
|
|
254000
|
-
return false;
|
|
254167
|
+
return initializer.type === dist$3.AST_NODE_TYPES.CallExpression
|
|
254168
|
+
? isImportLikeInitializer(initializer.callee)
|
|
254169
|
+
: false;
|
|
254001
254170
|
}
|
|
254002
254171
|
function isImportLikeVariableDeclaration(declaration) {
|
|
254003
254172
|
if (declaration.declarations.length !== 1) {
|
|
@@ -254005,10 +254174,7 @@ function isImportLikeVariableDeclaration(declaration) {
|
|
|
254005
254174
|
}
|
|
254006
254175
|
const [declarator] = declaration.declarations;
|
|
254007
254176
|
const init = declarator.init;
|
|
254008
|
-
|
|
254009
|
-
return false;
|
|
254010
|
-
}
|
|
254011
|
-
return isImportLikeInitializer(init);
|
|
254177
|
+
return init ? isImportLikeInitializer(init) : false;
|
|
254012
254178
|
}
|
|
254013
254179
|
const rule$7 = createRule({
|
|
254014
254180
|
create(context) {
|
|
@@ -254199,7 +254365,7 @@ const rule$6 = createRule({
|
|
|
254199
254365
|
if (!arr) {
|
|
254200
254366
|
continue;
|
|
254201
254367
|
}
|
|
254202
|
-
const elements = arr.elements.filter((el) => el
|
|
254368
|
+
const elements = arr.elements.filter((el) => el != null);
|
|
254203
254369
|
if (elements.length <= 1) {
|
|
254204
254370
|
continue;
|
|
254205
254371
|
}
|
|
@@ -254417,12 +254583,11 @@ function getConstArray(node) {
|
|
|
254417
254583
|
|
|
254418
254584
|
function isClassType(type) {
|
|
254419
254585
|
const symbol = type.getSymbol();
|
|
254420
|
-
|
|
254421
|
-
|
|
254422
|
-
|
|
254423
|
-
|
|
254424
|
-
|
|
254425
|
-
?.some((d) => ts.isClassDeclaration(d) || ts.isClassExpression(d)) ?? false);
|
|
254586
|
+
return symbol
|
|
254587
|
+
? (symbol
|
|
254588
|
+
.getDeclarations()
|
|
254589
|
+
?.some((d) => ts.isClassDeclaration(d) || ts.isClassExpression(d)) ?? false)
|
|
254590
|
+
: false;
|
|
254426
254591
|
}
|
|
254427
254592
|
|
|
254428
254593
|
function isExternalPureTuple(typeChecker, type) {
|
|
@@ -254431,10 +254596,7 @@ function isExternalPureTuple(typeChecker, type) {
|
|
|
254431
254596
|
}
|
|
254432
254597
|
const typeRef = type;
|
|
254433
254598
|
const typeArgs = typeChecker.getTypeArguments(typeRef);
|
|
254434
|
-
|
|
254435
|
-
return false;
|
|
254436
|
-
}
|
|
254437
|
-
return typeArgs.every((item) => isClassType(item));
|
|
254599
|
+
return typeArgs.length === 0 ? false : typeArgs.every((item) => isClassType(item));
|
|
254438
254600
|
}
|
|
254439
254601
|
|
|
254440
254602
|
const MESSAGE_ID$2 = 'spreadArrays';
|
|
@@ -254445,7 +254607,7 @@ const rule$3 = createRule({
|
|
|
254445
254607
|
const purityCache = new WeakMap();
|
|
254446
254608
|
const isPureArray = (arr) => {
|
|
254447
254609
|
const cachedPurity = purityCache.get(arr);
|
|
254448
|
-
if (cachedPurity
|
|
254610
|
+
if (cachedPurity != null) {
|
|
254449
254611
|
return cachedPurity;
|
|
254450
254612
|
}
|
|
254451
254613
|
if (arr.isDirty) {
|
|
@@ -254614,7 +254776,7 @@ const config = {
|
|
|
254614
254776
|
}
|
|
254615
254777
|
for (const attr of node.inputs) {
|
|
254616
254778
|
const attrValue = getLiteralStringValue(attr);
|
|
254617
|
-
if (attrValue
|
|
254779
|
+
if (attrValue != null) {
|
|
254618
254780
|
checkAttribute(context, attr, attrValue, checkers);
|
|
254619
254781
|
}
|
|
254620
254782
|
}
|
|
@@ -254788,10 +254950,7 @@ function normalizeImportFilter(importFilter) {
|
|
|
254788
254950
|
function getRootPackageName(importPath) {
|
|
254789
254951
|
if (importPath.startsWith('@')) {
|
|
254790
254952
|
const segments = importPath.split('/');
|
|
254791
|
-
|
|
254792
|
-
return null;
|
|
254793
|
-
}
|
|
254794
|
-
return `${segments[0]}/${segments[1]}`;
|
|
254953
|
+
return segments.length < 2 ? null : `${segments[0]}/${segments[1]}`;
|
|
254795
254954
|
}
|
|
254796
254955
|
const parts = importPath.split('/');
|
|
254797
254956
|
return parts[0] ?? null;
|
|
@@ -254848,14 +255007,13 @@ function findNestedEntryPointRelativePaths(rootEntryDirectory) {
|
|
|
254848
255007
|
return [...new Set(directories)];
|
|
254849
255008
|
}
|
|
254850
255009
|
function selectCandidateEntryPointsForMode(allNestedRelativePaths, strict) {
|
|
254851
|
-
|
|
254852
|
-
|
|
254853
|
-
|
|
254854
|
-
|
|
254855
|
-
|
|
254856
|
-
|
|
254857
|
-
|
|
254858
|
-
});
|
|
255010
|
+
return strict
|
|
255011
|
+
? [...allNestedRelativePaths].sort((a, b) => {
|
|
255012
|
+
const depthA = a.split('/').filter(Boolean).length;
|
|
255013
|
+
const depthB = b.split('/').filter(Boolean).length;
|
|
255014
|
+
return depthB - depthA;
|
|
255015
|
+
})
|
|
255016
|
+
: allNestedRelativePaths.filter((relativePath) => !relativePath.includes('/'));
|
|
254859
255017
|
}
|
|
254860
255018
|
function mapSymbolsToEntryPointsUsingTypeChecker({ candidateEntryPoints, importedSymbols, rootEntryDirectory, state, }) {
|
|
254861
255019
|
const symbolToEntryPoint = new Map();
|
|
@@ -255006,10 +255164,9 @@ function buildImportStatement({ importKind, importPath, specifiers, state, }) {
|
|
|
255006
255164
|
if (namedSpecifiers.length > 0) {
|
|
255007
255165
|
clauses.push(`{${namedSpecifiers.map((specifier) => state.sourceCode.getText(specifier)).join(', ')}}`);
|
|
255008
255166
|
}
|
|
255009
|
-
|
|
255010
|
-
|
|
255011
|
-
|
|
255012
|
-
return `${importKeyword} ${clauses.join(', ')} from '${importPath}';`;
|
|
255167
|
+
return clauses.length === 0
|
|
255168
|
+
? null
|
|
255169
|
+
: `${importKeyword} ${clauses.join(', ')} from '${importPath}';`;
|
|
255013
255170
|
}
|
|
255014
255171
|
|
|
255015
255172
|
function getTypeName(param) {
|
|
@@ -255120,42 +255277,44 @@ const plugin = {
|
|
|
255120
255277
|
},
|
|
255121
255278
|
rules: {
|
|
255122
255279
|
'array-as-const': rule$5,
|
|
255123
|
-
'attrs-newline': rule$
|
|
255280
|
+
'attrs-newline': rule$R,
|
|
255124
255281
|
'class-property-naming': rule$4,
|
|
255125
|
-
'decorator-key-sort': rule$
|
|
255126
|
-
'element-newline': rule$
|
|
255282
|
+
'decorator-key-sort': rule$Q,
|
|
255283
|
+
'element-newline': rule$P,
|
|
255127
255284
|
'flat-exports': rule$3,
|
|
255128
|
-
'host-attributes-sort': rule$
|
|
255129
|
-
'html-logical-properties': rule$
|
|
255130
|
-
'import-integrity': rule$
|
|
255131
|
-
'injection-token-description': rule$
|
|
255132
|
-
'no-commonjs-import-patterns': rule$
|
|
255133
|
-
'no-deep-imports': rule$
|
|
255134
|
-
'no-deep-imports-to-indexed-packages': rule$
|
|
255135
|
-
'no-duplicate-attrs': rule$
|
|
255136
|
-
'no-duplicate-id': rule$
|
|
255137
|
-
'no-duplicate-in-head': rule$
|
|
255138
|
-
'no-fully-untracked-effect': rule$
|
|
255139
|
-
'no-href-with-router-link': rule$
|
|
255140
|
-
'no-implicit-public': rule$
|
|
255141
|
-
'no-import-assertions': rule$
|
|
255142
|
-
'no-infinite-loop': rule$
|
|
255143
|
-
'no-legacy-peer-deps': rule$
|
|
255144
|
-
'no-obsolete-attrs': rule$
|
|
255145
|
-
'no-obsolete-tags': rule$
|
|
255146
|
-
'no-playwright-empty-fill': rule$
|
|
255147
|
-
'no-project-as-in-ng-template': rule$
|
|
255148
|
-
'no-redundant-type-annotation': rule$
|
|
255149
|
-
'no-repeated-signal-in-conditional': rule$
|
|
255285
|
+
'host-attributes-sort': rule$O,
|
|
255286
|
+
'html-logical-properties': rule$N,
|
|
255287
|
+
'import-integrity': rule$M,
|
|
255288
|
+
'injection-token-description': rule$L,
|
|
255289
|
+
'no-commonjs-import-patterns': rule$K,
|
|
255290
|
+
'no-deep-imports': rule$J,
|
|
255291
|
+
'no-deep-imports-to-indexed-packages': rule$I,
|
|
255292
|
+
'no-duplicate-attrs': rule$H,
|
|
255293
|
+
'no-duplicate-id': rule$G,
|
|
255294
|
+
'no-duplicate-in-head': rule$F,
|
|
255295
|
+
'no-fully-untracked-effect': rule$E,
|
|
255296
|
+
'no-href-with-router-link': rule$D,
|
|
255297
|
+
'no-implicit-public': rule$C,
|
|
255298
|
+
'no-import-assertions': rule$B,
|
|
255299
|
+
'no-infinite-loop': rule$A,
|
|
255300
|
+
'no-legacy-peer-deps': rule$z,
|
|
255301
|
+
'no-obsolete-attrs': rule$y,
|
|
255302
|
+
'no-obsolete-tags': rule$x,
|
|
255303
|
+
'no-playwright-empty-fill': rule$w,
|
|
255304
|
+
'no-project-as-in-ng-template': rule$v,
|
|
255305
|
+
'no-redundant-type-annotation': rule$u,
|
|
255306
|
+
'no-repeated-signal-in-conditional': rule$t,
|
|
255150
255307
|
'no-restricted-attr-values': rule$2,
|
|
255151
|
-
'no-side-effects-in-computed': rule$
|
|
255152
|
-
'no-signal-reads-after-await-in-reactive-context': rule$
|
|
255153
|
-
'no-string-literal-concat': rule$
|
|
255154
|
-
'no-untracked-outside-reactive-context': rule$
|
|
255155
|
-
'no-useless-untracked': rule$
|
|
255156
|
-
'object-single-line': rule$
|
|
255157
|
-
'prefer-combined-if-control-flow': rule$
|
|
255308
|
+
'no-side-effects-in-computed': rule$s,
|
|
255309
|
+
'no-signal-reads-after-await-in-reactive-context': rule$r,
|
|
255310
|
+
'no-string-literal-concat': rule$q,
|
|
255311
|
+
'no-untracked-outside-reactive-context': rule$p,
|
|
255312
|
+
'no-useless-untracked': rule$o,
|
|
255313
|
+
'object-single-line': rule$n,
|
|
255314
|
+
'prefer-combined-if-control-flow': rule$m,
|
|
255315
|
+
'prefer-conditional-return': rule$l,
|
|
255158
255316
|
'prefer-deep-imports': rule$1,
|
|
255317
|
+
'prefer-loose-null-check': rule$k,
|
|
255159
255318
|
'prefer-multi-arg-push': rule$j,
|
|
255160
255319
|
'prefer-namespace-keyword': rule$i,
|
|
255161
255320
|
'prefer-untracked-incidental-signal-reads': rule$h,
|