Skip to content

Commit aafc97b

Browse files
Updated all dependencies and removed traversing shortcuts
1 parent 048c760 commit aafc97b

13 files changed

+385
-362
lines changed

typescript/package-lock.json

Lines changed: 216 additions & 217 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typescript/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
"homepage": "https://github.com/jqassistant-plugin/jqassistant-typescript-plugin/blob/main/typescript/README.md",
1212
"license": "GNU GENERAL PUBLIC LICENSE",
1313
"dependencies": {
14-
"@types/node": "^20.14.10",
15-
"@typescript-eslint/eslint-plugin": "^7.16.0",
16-
"@typescript-eslint/parser": "^7.16.0",
17-
"@typescript-eslint/typescript-estree": "^7.16.0",
14+
"@types/node": "^22.3.0",
15+
"@typescript-eslint/eslint-plugin": "^8.1.0",
16+
"@typescript-eslint/parser": "^8.1.0",
17+
"@typescript-eslint/typescript-estree": "^8.1.0",
1818
"cli-progress": "^3.12.0",
1919
"commander": "^12.1.0",
20-
"eslint": "^8.57.0",
20+
"eslint": "^9.9.0",
2121
"json5": "^2.2.3",
2222
"minimatch": "^10.0.1",
2323
"readdirp": "^3.6.0",
24-
"typescript": "^5.5.3"
24+
"typescript": "^5.5.4"
2525
},
2626
"devDependencies": {
2727
"@types/cli-progress": "^3.11.6",
@@ -30,7 +30,7 @@
3030
"eslint-config-prettier": "^9.1.0",
3131
"jest": "^29.7.0",
3232
"prettier": "3.3.3",
33-
"ts-jest": "^29.2.2",
33+
"ts-jest": "^29.2.4",
3434
"ts-node": "^10.9.2"
3535
},
3636
"scripts": {

typescript/src/core/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ export class LocalContexts {
6969

7070
/**
7171
* @param name name of the context type to searched for
72-
* @returns closest context with given name to the current contexts, along with its position inside the stack, or
72+
* @returns closest context with given name to the current contexts, along with its position inside the stack (0 being the current context), or
7373
* `undefined` if no context with the given name exists
7474
*/
7575
getNextContext(name: string): [unknown, number] | undefined {
7676
for (let i = this.contexts.length - 1; i >= 0; i--) {
7777
const context = this.contexts[i].get(name);
78-
if (context) return [context, i - this.contexts.length];
78+
if (context) return [context, this.contexts.length - i - 1];
7979
}
8080
return undefined;
8181
}

typescript/src/core/features.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ import {
4242
} from "./processors/value.processor";
4343
import { VariableDeclarationProcessor, VariableDeclaratorProcessor } from "./processors/variable-declaration.processor";
4444
import { SimpleTraverser, Traverser } from "./traverser";
45-
import { ClassTraverser, StaticBlockTraverser } from "./traversers/class.traverser";
45+
import { ClassBodyTraverser, ClassTraverser, StaticBlockTraverser } from "./traversers/class.traverser";
4646
import { DecoratorTraverser } from "./traversers/decorator.traverser";
47-
import { EnumDeclarationTraverser, EnumMemberTraverser } from "./traversers/enum.traverser";
47+
import { EnumBodyTraverser, EnumDeclarationTraverser, EnumMemberTraverser } from "./traversers/enum.traverser";
4848
import {
4949
ExportAssignmentTraverser,
5050
ExportDefaultDeclarationTraverser,
@@ -80,6 +80,7 @@ import {
8080
} from "./traversers/expression.traverser";
8181
import { FunctionTraverser } from "./traversers/function.traverser";
8282
import {
83+
InterfaceBodyTraverser,
8384
InterfaceDeclarationTraverser,
8485
InterfaceHeritageTraverser
8586
} from "./traversers/interface-declaration.traverser";
@@ -139,6 +140,7 @@ export const TRAVERSERS: Map<AST_NODE_TYPES, Traverser> = new Map([
139140
[AST_NODE_TYPES.BlockStatement, new BlockStatementTraverser()],
140141
[AST_NODE_TYPES.CallExpression, new CallExpressionTraverser()],
141142
[AST_NODE_TYPES.ChainExpression, new ChainExpressionTraverser()],
143+
[AST_NODE_TYPES.ClassBody, new ClassBodyTraverser()],
142144
[AST_NODE_TYPES.ClassDeclaration, new ClassTraverser()],
143145
[AST_NODE_TYPES.ClassExpression, new ClassTraverser()],
144146
[AST_NODE_TYPES.ConditionalExpression, new ConditionalExpressionTraverser()],
@@ -192,9 +194,11 @@ export const TRAVERSERS: Map<AST_NODE_TYPES, Traverser> = new Map([
192194
[AST_NODE_TYPES.TSAsExpression, new AsExpressionTraverser()],
193195
[AST_NODE_TYPES.TSClassImplements, new SimpleTraverser()],
194196
[AST_NODE_TYPES.TSDeclareFunction, new FunctionTraverser()],
197+
[AST_NODE_TYPES.TSEnumBody, new EnumBodyTraverser()],
195198
[AST_NODE_TYPES.TSEnumDeclaration, new EnumDeclarationTraverser()],
196199
[AST_NODE_TYPES.TSEnumMember, new EnumMemberTraverser()],
197200
[AST_NODE_TYPES.TSExportAssignment, new ExportAssignmentTraverser()],
201+
[AST_NODE_TYPES.TSInterfaceBody, new InterfaceBodyTraverser()],
198202
[AST_NODE_TYPES.TSInterfaceDeclaration, new InterfaceDeclarationTraverser()],
199203
[AST_NODE_TYPES.TSInterfaceHeritage, new InterfaceHeritageTraverser()],
200204
[AST_NODE_TYPES.TSMethodSignature, new MethodTraverser()],

typescript/src/core/processors/class-declaration.processor.ts

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class ClassDeclarationProcessor extends Processor {
4747

4848
// merge accessor properties
4949
const childAccProps = getAndDeleteChildConcepts<LCEAccessorProperty>(
50-
ClassTraverser.MEMBERS_PROP,
50+
ClassTraverser.BODY_PROP,
5151
LCEAccessorProperty.conceptId,
5252
childConcepts,
5353
);
@@ -76,13 +76,9 @@ export class ClassDeclarationProcessor extends Processor {
7676
parseClassLikeTypeParameters({ globalContext, localContexts, node, ...unusedProcessingContext }, node),
7777
getAndDeleteChildConcepts<LCETypeDeclared>(ClassTraverser.EXTENDS_PROP, LCETypeDeclared.conceptId, childConcepts)[0],
7878
getAndDeleteChildConcepts(ClassTraverser.IMPLEMENTS_PROP, LCETypeDeclared.conceptId, childConcepts),
79-
getAndDeleteChildConcepts<LCEConstructorDeclaration>(
80-
ClassTraverser.MEMBERS_PROP,
81-
LCEConstructorDeclaration.conceptId,
82-
childConcepts,
83-
)[0],
84-
getAndDeleteChildConcepts(ClassTraverser.MEMBERS_PROP, LCEPropertyDeclaration.conceptId, childConcepts),
85-
getAndDeleteChildConcepts(ClassTraverser.MEMBERS_PROP, LCEMethodDeclaration.conceptId, childConcepts),
79+
getAndDeleteChildConcepts<LCEConstructorDeclaration>(ClassTraverser.BODY_PROP, LCEConstructorDeclaration.conceptId, childConcepts)[0],
80+
getAndDeleteChildConcepts(ClassTraverser.BODY_PROP, LCEPropertyDeclaration.conceptId, childConcepts),
81+
getAndDeleteChildConcepts(ClassTraverser.BODY_PROP, LCEMethodDeclaration.conceptId, childConcepts),
8682
[...accessorProperties.values()],
8783
getAndDeleteChildConcepts(ClassTraverser.DECORATORS_PROP, LCEDecorator.conceptId, childConcepts),
8884
CodeCoordinateUtils.getCodeCoordinates(globalContext, node, true),
@@ -101,17 +97,21 @@ export class ClassDeclarationProcessor extends Processor {
10197
export class SuperClassDeclarationProcessor extends Processor {
10298
public executionCondition: ExecutionCondition = new ExecutionCondition(
10399
[AST_NODE_TYPES.Identifier, AST_NODE_TYPES.MemberExpression],
104-
({node, localContexts}) =>
105-
!!node.parent && node.parent.type === AST_NODE_TYPES.ClassDeclaration && getParentPropName(localContexts) === ClassTraverser.EXTENDS_PROP
100+
({ node, localContexts }) =>
101+
!!node.parent && node.parent.type === AST_NODE_TYPES.ClassDeclaration && getParentPropName(localContexts) === ClassTraverser.EXTENDS_PROP,
106102
);
107103

108-
public override postChildrenProcessing({node, ...unusedProcessingContext}: ProcessingContext): ConceptMap {
109-
if(node.parent?.type === AST_NODE_TYPES.ClassDeclaration) {
104+
public override postChildrenProcessing({ node, ...unusedProcessingContext }: ProcessingContext): ConceptMap {
105+
if (node.parent?.type === AST_NODE_TYPES.ClassDeclaration) {
110106
if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.MemberExpression) {
111-
const superType = parseClassLikeBaseType({
107+
const superType = parseClassLikeBaseType(
108+
{
109+
node,
110+
...unusedProcessingContext,
111+
},
112112
node,
113-
...unusedProcessingContext
114-
}, node, node.parent.superTypeArguments?.params);
113+
node.parent.superTypeArguments?.params,
114+
);
115115
if (superType) {
116116
return singleEntryConceptMap(LCETypeDeclared.conceptId, superType);
117117
}
@@ -124,18 +124,22 @@ export class SuperClassDeclarationProcessor extends Processor {
124124
export class ImplementsDeclarationProcessor extends Processor {
125125
public executionCondition: ExecutionCondition = new ExecutionCondition(
126126
[AST_NODE_TYPES.TSClassImplements],
127-
({node, localContexts}) =>
127+
({ node, localContexts }) =>
128128
!!node.parent &&
129129
node.parent.type === AST_NODE_TYPES.ClassDeclaration &&
130-
getParentPropName(localContexts) === ClassTraverser.IMPLEMENTS_PROP
130+
getParentPropName(localContexts) === ClassTraverser.IMPLEMENTS_PROP,
131131
);
132132

133-
public override postChildrenProcessing({node, ...unusedProcessingContext}: ProcessingContext): ConceptMap {
133+
public override postChildrenProcessing({ node, ...unusedProcessingContext }: ProcessingContext): ConceptMap {
134134
if (node.type === AST_NODE_TYPES.TSClassImplements) {
135-
const implementsType = parseClassLikeBaseType({
135+
const implementsType = parseClassLikeBaseType(
136+
{
137+
node,
138+
...unusedProcessingContext,
139+
},
136140
node,
137-
...unusedProcessingContext
138-
}, node, node.typeArguments?.params);
141+
node.typeArguments?.params,
142+
);
139143
if (implementsType) {
140144
return singleEntryConceptMap(LCETypeDeclared.conceptId, implementsType);
141145
}

0 commit comments

Comments
 (0)