Switch to klint, fix some lint rules
This commit is contained in:
parent
13cb34a966
commit
c9f9435445
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
/* eslint no-var: 0 */
|
||||||
|
|
||||||
var babylon = require("..");
|
var babylon = require("..");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
|
/* eslint max-len: 0 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on the comment attachment algorithm used in espree and estraverse.
|
* Based on the comment attachment algorithm used in espree and estraverse.
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
/* eslint indent: 0 */
|
||||||
|
/* eslint max-len: 0 */
|
||||||
|
|
||||||
// A recursive descent parser operates by defining functions for all
|
// A recursive descent parser operates by defining functions for all
|
||||||
// syntactic elements, and recursively calling those, each function
|
// syntactic elements, and recursively calling those, each function
|
||||||
// advancing the input stream and returning an AST node. Precedence
|
// advancing the input stream and returning an AST node. Precedence
|
||||||
@ -969,7 +972,7 @@ pp.parseAwait = function (node) {
|
|||||||
this.unexpected();
|
this.unexpected();
|
||||||
}
|
}
|
||||||
if (this.match(tt.star)) {
|
if (this.match(tt.star)) {
|
||||||
this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.")
|
this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.");
|
||||||
}
|
}
|
||||||
node.argument = this.parseMaybeUnary();
|
node.argument = this.parseMaybeUnary();
|
||||||
return this.finishNode(node, "AwaitExpression");
|
return this.finishNode(node, "AwaitExpression");
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export default class Parser extends Tokenizer {
|
|||||||
|
|
||||||
if (plugins.indexOf("flow") >= 0) {
|
if (plugins.indexOf("flow") >= 0) {
|
||||||
// ensure flow plugin loads last
|
// ensure flow plugin loads last
|
||||||
plugins = plugins.filter(plugin => plugin !== "flow");
|
plugins = plugins.filter((plugin) => plugin !== "flow");
|
||||||
plugins.push("flow");
|
plugins.push("flow");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint indent: 0 */
|
||||||
|
|
||||||
import { types as tt } from "../tokenizer/types";
|
import { types as tt } from "../tokenizer/types";
|
||||||
import Parser from "./index";
|
import Parser from "./index";
|
||||||
import { reservedWords } from "../util/identifier";
|
import { reservedWords } from "../util/identifier";
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
/* eslint indent: 0 */
|
||||||
|
/* eslint max-len: 0 */
|
||||||
|
|
||||||
import { types as tt } from "../tokenizer/types";
|
import { types as tt } from "../tokenizer/types";
|
||||||
import Parser from "./index";
|
import Parser from "./index";
|
||||||
import { lineBreak } from "../util/whitespace";
|
import { lineBreak } from "../util/whitespace";
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
/* eslint indent: 0 */
|
||||||
|
/* eslint max-len: 0 */
|
||||||
|
|
||||||
import { types as tt } from "../tokenizer/types";
|
import { types as tt } from "../tokenizer/types";
|
||||||
import Parser from "../parser";
|
import Parser from "../parser";
|
||||||
|
|
||||||
@ -115,8 +118,7 @@ pp.flowParseDeclareInterface = function (node) {
|
|||||||
this.next();
|
this.next();
|
||||||
this.flowParseInterfaceish(node);
|
this.flowParseInterfaceish(node);
|
||||||
return this.finishNode(node, "DeclareInterface");
|
return this.finishNode(node, "DeclareInterface");
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// Interfaces
|
// Interfaces
|
||||||
|
|
||||||
@ -920,7 +922,7 @@ export default function (instance) {
|
|||||||
node.typeParameters = null;
|
node.typeParameters = null;
|
||||||
}
|
}
|
||||||
implemented.push(this.finishNode(node, "ClassImplements"));
|
implemented.push(this.finishNode(node, "ClassImplements"));
|
||||||
} while (this.eat(tt.comma))
|
} while (this.eat(tt.comma));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint indent: 0 */
|
||||||
|
|
||||||
import XHTMLEntities from "./xhtml";
|
import XHTMLEntities from "./xhtml";
|
||||||
import { TokenType, types as tt } from "../../tokenizer/types";
|
import { TokenType, types as tt } from "../../tokenizer/types";
|
||||||
import { TokContext, types as tc } from "../../tokenizer/context";
|
import { TokContext, types as tc } from "../../tokenizer/context";
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export const types: {
|
|||||||
b_tmpl: new TokContext("${", true),
|
b_tmpl: new TokContext("${", true),
|
||||||
p_stat: new TokContext("(", false),
|
p_stat: new TokContext("(", false),
|
||||||
p_expr: new TokContext("(", true),
|
p_expr: new TokContext("(", true),
|
||||||
q_tmpl: new TokContext("`", true, true, p => p.readTmplToken()),
|
q_tmpl: new TokContext("`", true, true, (p) => p.readTmplToken()),
|
||||||
f_expr: new TokContext("function", true)
|
f_expr: new TokContext("function", true)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,7 +78,8 @@ tt.dollarBraceL.updateContext = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
tt.parenL.updateContext = function (prevType) {
|
tt.parenL.updateContext = function (prevType) {
|
||||||
let statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while;
|
let statementParens = prevType === tt._if || prevType === tt._for ||
|
||||||
|
prevType === tt._with || prevType === tt._while;
|
||||||
this.state.context.push(statementParens ? types.p_stat : types.p_expr);
|
this.state.context.push(statementParens ? types.p_stat : types.p_expr);
|
||||||
this.state.exprAllowed = true;
|
this.state.exprAllowed = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
/* @noflow */
|
/* @noflow */
|
||||||
|
/* eslint max-len: 0 */
|
||||||
|
/* eslint indent: 0 */
|
||||||
|
|
||||||
import type { TokenType } from "./types";
|
import type { TokenType } from "./types";
|
||||||
import { isIdentifierStart, isIdentifierChar, isKeyword } from "../util/identifier";
|
import { isIdentifierStart, isIdentifierChar, isKeyword } from "../util/identifier";
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint max-len: 0 */
|
||||||
|
|
||||||
// This is a trick taken from Esprima. It turns out that, on
|
// This is a trick taken from Esprima. It turns out that, on
|
||||||
// non-Chrome browsers, to check whether a string is in a set, a
|
// non-Chrome browsers, to check whether a string is in a set, a
|
||||||
// predicate containing a big ugly `switch` statement is faster than
|
// predicate containing a big ugly `switch` statement is faster than
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user