Skip to content

Commit 000b2d5

Browse files
committed
fix(AST): Fix AST traversal for experimental features
1 parent b520c7a commit 000b2d5

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

ARCHITECTURE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This service needs some other services. To be able to mock and
1919

2020
![Dependencies Graph](./DEPENDENCIES.mmd.png)
2121

22-
[See in context](./src/jsarch.js#L53-L64)
22+
[See in context](./src/jsarch.js#L66-L77)
2323

2424

2525

@@ -34,7 +34,7 @@ architecture notes. It should be structured like that:
3434
{body}
3535
```
3636
37-
[See in context](./src/jsarch.js#L184-L194)
37+
[See in context](./src/jsarch.js#L197-L207)
3838
3939
4040
@@ -64,7 +64,7 @@ If you wish to add the architecture notes in a README.md file
6464
you will have to set the `titleLevel` option to as much `#`
6565
as necessar to fit the title hierarchy of you README file.
6666
67-
[See in context](./src/jsarch.js#L29-L37)
67+
[See in context](./src/jsarch.js#L42-L50)
6868
6969
7070
@@ -76,5 +76,5 @@ By default, links to the architecture notes right in the code
7676
7777
To override it, use the `base` option.
7878
79-
[See in context](./src/jsarch.js#L40-L48)
79+
[See in context](./src/jsarch.js#L53-L61)
8080

src/jsarch.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,21 @@ const espree = require('espree', {
1414
},
1515
});
1616
const types = require('ast-types');
17+
const def = types.Type.def;
1718
const { compareNotes } = require('./compareNotes');
1819

20+
// Temporary fix to make jsarch work
21+
// on codebases parsed with espree
22+
def('ExperimentalSpreadProperty')
23+
.bases('Node')
24+
.build('argument')
25+
.field('argument', def('Expression'));
26+
def('ExperimentalRestProperty')
27+
.bases('Node')
28+
.build('argument')
29+
.field('argument', def('Expression'));
30+
types.finalize();
31+
1932
const ARCHITECTURE_NOTE_REGEXP = /^\s*Architecture Note #((?:\d+(?:\.(?=\d)|)){1,8}):\s+([^\r\n$]*)/;
2033
const SHEBANG_REGEXP = /#! (\/\w+)+ node/;
2134
const EOL_REGEXP = /\n/g;

0 commit comments

Comments
 (0)