Skip to content

Commit

Permalink
fix(AST): Fix AST traversal for experimental features
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Feb 1, 2018
1 parent b520c7a commit 000b2d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This service needs some other services. To be able to mock and

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

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



Expand All @@ -34,7 +34,7 @@ architecture notes. It should be structured like that:
{body}
```
[See in context](./src/jsarch.js#L184-L194)
[See in context](./src/jsarch.js#L197-L207)
Expand Down Expand Up @@ -64,7 +64,7 @@ If you wish to add the architecture notes in a README.md file
you will have to set the `titleLevel` option to as much `#`
as necessar to fit the title hierarchy of you README file.
[See in context](./src/jsarch.js#L29-L37)
[See in context](./src/jsarch.js#L42-L50)
Expand All @@ -76,5 +76,5 @@ By default, links to the architecture notes right in the code
To override it, use the `base` option.
[See in context](./src/jsarch.js#L40-L48)
[See in context](./src/jsarch.js#L53-L61)
13 changes: 13 additions & 0 deletions src/jsarch.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,21 @@ const espree = require('espree', {
},
});
const types = require('ast-types');
const def = types.Type.def;
const { compareNotes } = require('./compareNotes');

// Temporary fix to make jsarch work
// on codebases parsed with espree
def('ExperimentalSpreadProperty')
.bases('Node')
.build('argument')
.field('argument', def('Expression'));
def('ExperimentalRestProperty')
.bases('Node')
.build('argument')
.field('argument', def('Expression'));
types.finalize();

const ARCHITECTURE_NOTE_REGEXP = /^\s*Architecture Note #((?:\d+(?:\.(?=\d)|)){1,8}):\s+([^\r\n$]*)/;
const SHEBANG_REGEXP = /#! (\/\w+)+ node/;
const EOL_REGEXP = /\n/g;
Expand Down

0 comments on commit 000b2d5

Please sign in to comment.