eslint-plugin-flowtype & upgrade to eslint@4 (#849)

* Add eslint-plugin-flowtype. Fix #844

Using the recommended settings for plugin.
This involved adding some spaces to some existing union types.

* Upgrade to eslint@4, fix spotted bugs

Switched to indent-legacy to allow e.g. comments to have extra indents.
This commit is contained in:
Erik Demaine
2017-09-07 11:06:26 +09:00
committed by Kevin Barabash
parent cb7f166a7e
commit 588f5a1ee6
8 changed files with 23 additions and 14 deletions

View File

@@ -11,11 +11,12 @@ import {Token} from "./Token";
* about where in the source string the problem occurred.
*/
class ParseError {
position: number|void; // Error position based on passed-in Token or ParseNode.
position: number | void;
// Error position based on passed-in Token or ParseNode.
constructor(
message: string, // The error message
token?: Token|ParseNode, // An object providing position information
message: string, // The error message
token?: Token | ParseNode, // An object providing position information
) {
let error = "KaTeX parse error: " + message;
let start;

View File

@@ -16,9 +16,9 @@ export default class ParseNode {
// TODO: We should combine these to ({lexer, start, end}|void) as they
// should all exist together or not exist at all. That way, only a single
// void check needs to be done to see if we have metadata.
lexer: LexerInterface|void;
start: number|void;
end: number|void;
lexer: LexerInterface | void;
start: number | void;
end: number | void;
constructor(
type: string, // type of node, like e.g. "ordgroup"

View File

@@ -847,7 +847,7 @@ class Parser {
}
return new ParseFuncOrArgument(
new ParseNode("ordgroup", expression, this.mode,
firstToken, lastToken),
firstToken, lastToken),
false);
} else {
// Otherwise, just return a nucleus, or nothing for an optional group

View File

@@ -216,7 +216,7 @@ defineMacro("\\dotsi", "\\!\\cdots");
// amsmath doesn't actually define \dotsx, but \dots followed by a macro
// starting with \DOTSX implies \dotso, and then \extra@ detects this case
// and forces the added `\,`.
defineMacro("\\dotsx", "\\ldots\,");
defineMacro("\\dotsx", "\\ldots\\,");
// \let\DOTSI\relax
// \let\DOTSB\relax