Re-enable the max-len ESLint rule. (#5265)

This commit is contained in:
Logan Smyth
2017-02-04 08:07:15 -08:00
committed by Henry Zhu
parent 4d411ef83e
commit b845f2b69d
63 changed files with 317 additions and 223 deletions

View File

@@ -1,5 +1,3 @@
/* eslint max-len: 0 */
import * as helpers from "babel-helpers";
import generator from "babel-generator";
import * as messages from "babel-messages";
@@ -23,12 +21,14 @@ const buildUmdWrapper = template(`
function buildGlobal(namespace, builder) {
const body = [];
const container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));
const tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]);
const tree = t.program([
t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]);
body.push(t.variableDeclaration("var", [
t.variableDeclarator(
namespace,
t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([]))
t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace),
t.objectExpression([]))
)
]));

View File

@@ -1,5 +1,4 @@
/* global BabelFileResult, BabelParserOptions, BabelFileMetadata */
/* eslint max-len: 0 */
import getHelper from "babel-helpers";
import * as metadataVisitor from "./metadata";
@@ -339,7 +338,7 @@ export default class File extends Store {
this.scope.push({
id: uid,
init: init,
_blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers
_blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers
});
return uid;
}
@@ -378,8 +377,8 @@ export default class File extends Store {
sourceRoot: inputMapConsumer.sourceRoot
});
// This assumes the output map always has a single source, since Babel always compiles a single source file to a
// single output file.
// This assumes the output map always has a single source, since Babel always compiles a
// single source file to a single output file.
const source = outputMapConsumer.sources[0];
inputMapConsumer.eachMapping(function (mapping) {
@@ -424,7 +423,8 @@ export default class File extends Store {
if (parser) {
parseCode = require(parser).parse;
} else {
throw new Error(`Couldn't find parser ${parserOpts.parser} with "parse" method relative to directory ${dirname}`);
throw new Error(`Couldn't find parser ${parserOpts.parser} with "parse" method ` +
`relative to directory ${dirname}`);
}
} else {
parseCode = parserOpts.parser;
@@ -472,7 +472,8 @@ export default class File extends Store {
this.log.debug("Start transform traverse");
// merge all plugin visitors into a single visitor
const visitor = traverse.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod);
const visitor = traverse.visitors.merge(this.pluginVisitors[i], pluginPasses,
this.opts.wrapPluginVisitorMethod);
traverse(this.ast, visitor, this.scope);
this.log.debug("End transform traverse");
@@ -610,14 +611,16 @@ export default class File extends Store {
if (generator) {
gen = require(generator).print;
} else {
throw new Error(`Couldn't find generator ${gen} with "print" method relative to directory ${dirname}`);
throw new Error(`Couldn't find generator ${gen} with "print" method relative ` +
`to directory ${dirname}`);
}
}
}
this.log.debug("Generation start");
const _result = gen(ast, opts.generatorOpts ? Object.assign(opts, opts.generatorOpts) : opts, this.code);
const _result = gen(ast, opts.generatorOpts ? Object.assign(opts, opts.generatorOpts) : opts,
this.code);
result.code = _result.code;
result.map = _result.map;

View File

@@ -1,4 +1,4 @@
/* eslint max-len: 0 */
/* eslint max-len: "off" */
module.exports = {
filename: {

View File

@@ -1,5 +1,3 @@
/* eslint max-len: 0 */
import * as context from "../../../api/node";
import type Logger from "../logger";
import Plugin from "../../plugin";
@@ -180,10 +178,13 @@ export default class OptionManager {
// check for an unknown option
if (!option && this.log) {
if (removed[key]) {
this.log.error(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`, ReferenceError);
this.log.error(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`,
ReferenceError);
} else {
/* eslint-disable max-len */
const unknownOptErr = `Unknown option: ${alias}.${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`;
const presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.";
/* eslint-enable max-len */
this.log.error(`${unknownOptErr}\n\n${presetConfigErr}`, ReferenceError);
}

View File

@@ -1,4 +1,4 @@
/* eslint max-len: 0 */
/* eslint max-len: "off" */
module.exports = {
"auxiliaryComment": {

View File

@@ -1,5 +1,3 @@
/* eslint max-len: 0 */
import OptionManager from "./file/options/option-manager";
import * as messages from "babel-messages";
import Store from "../store";
@@ -85,7 +83,8 @@ export default class Plugin extends Store {
normaliseVisitor(visitor: Object): Object {
for (const key of GLOBAL_VISITOR_PROPS) {
if (visitor[key]) {
throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes.");
throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " +
"Please target individual nodes.");
}
}