Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Update Javascript parser to recast + esprima #722

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions custom_typings/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/// <reference path="./espree.d.ts" />
/// <reference path="./estree.d.ts" />
/// <reference path="./strip-indent.d.ts" />
/// <reference path="./recast.d.ts" />
32 changes: 32 additions & 0 deletions custom_typings/recast.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
declare module 'recast' {
import * as estree from 'estree';

export interface File {
name: string;
program: estree.Program;
}

export interface Options {
quote?: 'single'|'double'|'auto';
wrapColumn?: number;
tabWidth?: number;
}

export interface ParseOptions {
parser?: {parse(code: string): any}, tabWidth?: number, useTabs?: boolean,
reuseWhitespace?: boolean, lineTerminator?: string, wrapColumn?: number,
sourceFileName?: string, sourceMapName?: string, sourceRoot?: string,
inputSourceMap?: string, range?: boolean, tolerant?: boolean,
quote?: 'single'|'double'|'auto', trailingComma?: boolean|{
objects?: boolean,
arrays?: boolean,
parameters?: boolean,
},
arrayBracketSpacing?: boolean, objectCurlySpacing?: boolean,
arrowParensAlways?: boolean, flowObjectCommas?: boolean,
}

export function parse(source: string, options?: ParseOptions): File;

export function print(node: estree.Node, options?: Options): {code: string};
}
Loading