Remove obsolete max-len eslint rule and reformat some stuff to fit (#7602)
This commit is contained in:
committed by
Brian Ng
parent
6d6fe844fd
commit
f0d681a238
@@ -1,5 +1,3 @@
|
||||
/* eslint max-len: 0 */
|
||||
|
||||
// @flow
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint max-len: 0 */
|
||||
|
||||
// @flow
|
||||
|
||||
// A recursive descent parser operates by defining functions for all
|
||||
@@ -436,7 +434,10 @@ export default class ExpressionParser extends LValParser {
|
||||
return base;
|
||||
}
|
||||
|
||||
/** @param state Set 'state.stop = true' to indicate that we should stop parsing subscripts. 'state.optionalChainMember to indicate that the member is currently in OptionalChain'*/
|
||||
/**
|
||||
* @param state Set 'state.stop = true' to indicate that we should stop parsing subscripts.
|
||||
* state.optionalChainMember to indicate that the member is currently in OptionalChain
|
||||
*/
|
||||
parseSubscript(
|
||||
base: N.Expression,
|
||||
startPos: number,
|
||||
@@ -625,7 +626,8 @@ export default class ExpressionParser extends LValParser {
|
||||
if (this.eat(close)) break;
|
||||
}
|
||||
|
||||
// we need to make sure that if this is an async arrow functions, that we don't allow inner parens inside the params
|
||||
// we need to make sure that if this is an async arrow functions,
|
||||
// that we don't allow inner parens inside the params
|
||||
if (this.match(tt.parenL) && !innerParenStart) {
|
||||
innerParenStart = this.state.start;
|
||||
}
|
||||
@@ -710,7 +712,8 @@ export default class ExpressionParser extends LValParser {
|
||||
) {
|
||||
this.raise(
|
||||
node.start,
|
||||
"super() is only valid inside a class constructor. Make sure the method name is spelled exactly as 'constructor'.",
|
||||
"super() is only valid inside a class constructor. " +
|
||||
"Make sure the method name is spelled exactly as 'constructor'.",
|
||||
);
|
||||
}
|
||||
return this.finishNode(node, "Super");
|
||||
@@ -913,7 +916,7 @@ export default class ExpressionParser extends LValParser {
|
||||
if (this.isContextual(propertyName)) {
|
||||
this.expectPlugin("functionSent");
|
||||
} else if (!this.hasPlugin("functionSent")) {
|
||||
// They didn't actually say `function.sent`, just `function.`, so a simple error would be less confusing.
|
||||
// The code wasn't `function.sent` but just `function.`, so a simple error is less confusing.
|
||||
this.unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint max-len: 0 */
|
||||
|
||||
// @flow
|
||||
|
||||
import * as N from "../types";
|
||||
@@ -246,7 +244,8 @@ export default class StatementParser extends ExpressionParser {
|
||||
} else {
|
||||
this.raise(
|
||||
this.state.start,
|
||||
"Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead",
|
||||
"Using the export keyword between a decorator and a class is not allowed. " +
|
||||
"Please use `export @dec class` instead",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -775,7 +774,8 @@ export default class StatementParser extends ExpressionParser {
|
||||
kind === tt._const &&
|
||||
!(this.match(tt._in) || this.isContextual("of"))
|
||||
) {
|
||||
// `const` with no initializer is allowed in TypeScript. It could be a declaration `const x: number;`.
|
||||
// `const` with no initializer is allowed in TypeScript.
|
||||
// It could be a declaration like `const x: number;`.
|
||||
if (!this.hasPlugin("typescript")) {
|
||||
this.unexpected();
|
||||
}
|
||||
@@ -1708,7 +1708,8 @@ export default class StatementParser extends ExpressionParser {
|
||||
if (this.eat(tt.colon)) {
|
||||
this.unexpected(
|
||||
null,
|
||||
"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
|
||||
"ES2015 named imports do not destructure. " +
|
||||
"Use another statement for destructuring after the import.",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint max-len: 0 */
|
||||
|
||||
// @flow
|
||||
|
||||
import type Parser from "../parser";
|
||||
@@ -261,7 +259,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
let kind = null;
|
||||
let hasModuleExport = false;
|
||||
const errorMessage =
|
||||
"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module";
|
||||
"Found both `declare module.exports` and `declare export` in the same module. " +
|
||||
"Modules can only have 1 since they are either an ES module or they are a CommonJS module";
|
||||
body.forEach(bodyElement => {
|
||||
if (isEsModuleType(bodyElement)) {
|
||||
if (kind === "CommonJS") {
|
||||
@@ -1902,7 +1901,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
) {
|
||||
this.raise(
|
||||
node.typeAnnotation.start,
|
||||
"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`",
|
||||
"Type annotations must come before default assignments, " +
|
||||
"e.g. instead of `age = 25: number` use `age: number = 25`",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2019,7 +2019,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
if (nodeIsTypeImport && specifierIsTypeImport) {
|
||||
this.raise(
|
||||
firstIdentLoc,
|
||||
"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements",
|
||||
"The `type` and `typeof` keywords on named imports can only be used on regular " +
|
||||
"`import` statements. It cannot be used with `import type` or `import typeof` statements",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint max-len: 0 */
|
||||
|
||||
// @flow
|
||||
|
||||
import type { Options } from "../options";
|
||||
|
||||
@@ -20,8 +20,18 @@ export default class State {
|
||||
this.noArrowAt = [];
|
||||
this.noArrowParamsConversionAt = [];
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
this.inMethod = this.inFunction = this.inParameters = this.maybeInArrowParameters = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.inClassProperty = this.noAnonFunctionType = this.hasFlowComment = this.isIterator = false;
|
||||
this.inMethod = false;
|
||||
this.inFunction = false;
|
||||
this.inParameters = false;
|
||||
this.maybeInArrowParameters = false;
|
||||
this.inGenerator = false;
|
||||
this.inAsync = false;
|
||||
this.inPropertyName = false;
|
||||
this.inType = false;
|
||||
this.inClassProperty = false;
|
||||
this.noAnonFunctionType = false;
|
||||
this.hasFlowComment = false;
|
||||
this.isIterator = false;
|
||||
|
||||
this.classLevel = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user