Skip to content

Commit 6c8e755

Browse files
Docs Update
1 parent 9729ada commit 6c8e755

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

docs/development/Concepts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ aliases:
1616

1717
**`ConceptMap`:**
1818
- [Concept Maps](https://jqassistant-plugin.github.io/jqassistant-lce-docs/architecture/Concept-Map) are realized in their more complex form, integrating parent property names into their index structure
19-
- use `mergeConceptMaps`, `unifyConceptMap`, `singleEntryConceptMap`, `createConceptMap`, and `getAndCastConcepts` utility functions for concise usage of `ConceptMap` instances
19+
- use `mergeConceptMaps`, `unifyConceptMap`, `singleEntryConceptMap`, `createConceptMap`, and `getAndCastConcepts` utility functions for the concise management of `ConceptMap` instances
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Extraction Strategy: Overview
2+
-> the extraction of language concepts is achieved by an implementation of the [LCE Architecture](https://jqassistant-plugin.github.io/jqassistant-lce-docs/)
3+
4+
- the main source of information for extracting concepts from TS source code is the ESLint AST (provided through `@typescript-eslint/typescript-estree`)
5+
- use [ESLint Playground](https://typescript-eslint.io/play/) to easily explore the data structures
6+
- all concepts have to be extracted within a single traversal of the ESLint AST
7+
- separate/additional sub-tree traversals are not allowed
8+
- additional information, mostly related to types, is extracted via the native TypeScript Compiler API (for more information see [here](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API) and [here](https://github.com/microsoft/TypeScript-Compiler-Notes/blob/main/README.md)), especially the TypeChecker
9+
- direct translation between nodes of the two different ASTs can easily be done via the `services` global context
10+
- the Compiler API should be used sparingly, as it is less developer-friendly than the ESLint API

docs/development/Local Contexts.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Local Contexts
2+
-> [Local Contexts](https://jqassistant-plugin.github.io/jqassistant-lce-docs/architecture/Local-Contexts) are implemented by the `LocalContexts` class
3+
- located under `typescript/src/core/context.ts`
4+
5+
**General Usage Rules:**
6+
- child node [[Processors|processors]] should know as little as possible about their parents and should instead receive their information for execution conditions and concept extraction from local contexts (-> increase re-usability)
7+
- the context keys are stored in a central class that is specific for each extension (e.g. `CoreContextKeys` and `ReactContextKeys`) that is located in an extension-level module named `context.keys.ts`

docs/development/Traversers.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ aliases:
66
-> [LCE traversers](https://jqassistant-plugin.github.io/jqassistant-lce-docs/architecture/Traversers) are implemented as a modified visitor pattern
77
- The abstract `Traverser` base class provides the implementation that orchestrates the execution of the other components
88
- only the `traverseChildren` method that delegates the traversal of potential child nodes to other traversers is abstract and has to be implemented by sub types
9-
- for each AST node type (provided via `@typescript-eslint/utils`) that should be processed a separate `Traverser` implementation has to be provided
9+
- for each AST node type (provided via `@typescript-eslint/utils`) that should be processed, a separate `Traverser` implementation has to be provided
10+
- note that skipping nodes in the ESLint AST through a simplified `Traverser` implementation (e.g. via nested node access: `runTraverserForNodes(node.body.body, ...)`) must be avoided as it leads to an incorrectly set `parent` property on the traversed child nodes
1011
- all traverser implementations are located under `typescript/src/core/traversers`
1112
- all files end with `.traverser.ts`
1213
- may export one or more traverser classes each
@@ -16,5 +17,6 @@ aliases:
1617
- all traversers need to be registered in the `TRAVERSERS` [feature collection](https://jqassistant-plugin.github.io/jqassistant-lce-docs/architecture/Feature-Collections) in `features.ts`
1718
- before implementing a new traverser check if there already exists one in the collection
1819
- existing traversers may not trigger the traversal for all their child nodes: expand where needed
20+
- for nodes that don't have any children that should be traversed the `SimpleTraverser` default implementation can be specified in `TRAVERSERS` for the corresponding node type
1921
- use `runTraverserForNode`(`s`) utility function to easily delegate the traversal process
2022
- parent property names should be declared as `public static readonly` members of the implementing class

docs/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ This plugin is based on the [LCE Architecture](https://jqassistant-plugin.github
4747
- [[Codebase Layout]]
4848
- [[Extensions]]
4949

50-
**LCE:**
50+
**Base LCE Architecture Implementation:**
5151
- [[Concepts]]
5252
- [[Traversers]]
5353
- [[Processors]]
5454
- [[Post-Processors]]
55+
- [[Local Contexts]]
5556
- [[Utilities]]
57+
58+
**Extraction Strategies:**
59+
- *[[Extraction Strategy - Overview|Overview]]*

typescript/src/core/processor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export type ProcessorMap = Map<AST_NODE_TYPES, Processor[]>;
1212
*/
1313
export abstract class Processor {
1414
/**
15-
* defines on what nodes and in which context the processor is executed
15+
* defines on what nodes and in which context the processor will be executed
1616
*/
1717
public abstract executionCondition: ExecutionCondition;
1818

0 commit comments

Comments
 (0)