diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 68a4c9b80e..48682c11fa 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -32,7 +32,6 @@ function collect(value, previousValue): Array { return previousValue ? previousValue.concat(values) : values; } -/* eslint-disable max-len */ // Standard Babel input configs. commander.option( "-f, --filename [filename]", @@ -168,7 +167,6 @@ commander.option( "--delete-dir-on-start", "Delete the out directory before compilation", ); -/* eslint-enable max-len */ commander.version(pkg.version + " (@babel/core " + version + ")"); commander.usage("[options] "); diff --git a/packages/babel-core/src/config/files/plugins.js b/packages/babel-core/src/config/files/plugins.js index 68b369225d..044b85aa52 100644 --- a/packages/babel-core/src/config/files/plugins.js +++ b/packages/babel-core/src/config/files/plugins.js @@ -105,7 +105,6 @@ function resolveStandardizedName( } catch (e2) {} if (resolvedOriginal) { - // eslint-disable-next-line max-len e.message += `\n- If you want to resolve "${name}", use "module:${name}"`; } } @@ -119,7 +118,6 @@ function resolveStandardizedName( } catch (e2) {} if (resolvedBabel) { - // eslint-disable-next-line max-len e.message += `\n- Did you mean "@babel/${name}"?`; } @@ -131,7 +129,6 @@ function resolveStandardizedName( } catch (e2) {} if (resolvedOppositeType) { - // eslint-disable-next-line max-len e.message += `\n- Did you accidentally pass a ${type} as a ${oppositeType}?`; } @@ -143,8 +140,9 @@ const LOADING_MODULES = new Set(); function requireModule(type: string, name: string): mixed { if (LOADING_MODULES.has(name)) { throw new Error( - // eslint-disable-next-line max-len - `Reentrant ${type} detected trying to load "${name}". This module is not ignored and is trying to load itself while compiling itself, leading to a dependency cycle. We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.`, + `Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.', ); } diff --git a/packages/babel-core/src/config/validation/removed.js b/packages/babel-core/src/config/validation/removed.js index 165bc4049f..79a321917a 100644 --- a/packages/babel-core/src/config/validation/removed.js +++ b/packages/babel-core/src/config/validation/removed.js @@ -1,5 +1,4 @@ // @flow -/* eslint max-len: "off" */ export default { auxiliaryComment: { @@ -16,36 +15,42 @@ export default { }, externalHelpers: { message: - "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/", + "Use the `external-helpers` plugin instead. " + + "Check out http://babeljs.io/docs/plugins/external-helpers/", }, extra: { message: "", }, jsxPragma: { message: - "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/", + "use the `pragma` option in the `react-jsx` plugin. " + + "Check out http://babeljs.io/docs/plugins/transform-react-jsx/", }, loose: { message: - "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option.", + "Specify the `loose` option for the relevant plugin you are using " + + "or use a preset that sets the option.", }, metadataUsedHelpers: { message: "Not required anymore as this is enabled by default", }, modules: { message: - "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules", + "Use the corresponding module transform plugin in the `plugins` option. " + + "Check out http://babeljs.io/docs/plugins/#modules", }, nonStandard: { message: - "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/", + "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. " + + "Also check out the react preset http://babeljs.io/docs/plugins/preset-react/", }, optional: { message: "Put the specific transforms you want in the `plugins` option", }, sourceMapName: { message: - "The `sourceMapName` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves.", + "The `sourceMapName` option has been removed because it makes more sense for the " + + "tooling that calls Babel to assign `map.file` themselves.", }, stage: { message: @@ -69,6 +74,7 @@ export default { sourceMapTarget: { version: 6, message: - "The `sourceMapTarget` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves.", + "The `sourceMapTarget` option has been removed because it makes more sense for the tooling " + + "that calls Babel to assign `map.file` themselves.", }, }; diff --git a/packages/babel-core/test/resolution.js b/packages/babel-core/test/resolution.js index 7829af16cd..49ea42eaee 100644 --- a/packages/babel-core/test/resolution.js +++ b/packages/babel-core/test/resolution.js @@ -243,7 +243,6 @@ describe("addon resolution", function() { babelrc: false, presets: ["foo"], }); - // eslint-disable-next-line max-len }).toThrow( /Cannot find module 'babel-preset-foo'.*\n- If you want to resolve "foo", use "module:foo"/, ); @@ -258,7 +257,6 @@ describe("addon resolution", function() { babelrc: false, plugins: ["foo"], }); - // eslint-disable-next-line max-len }).toThrow( /Cannot find module 'babel-plugin-foo'.*\n- If you want to resolve "foo", use "module:foo"/, ); @@ -273,7 +271,6 @@ describe("addon resolution", function() { babelrc: false, presets: ["foo"], }); - // eslint-disable-next-line max-len }).toThrow( /Cannot find module 'babel-preset-foo'.*\n- Did you mean "@babel\/foo"\?/, ); @@ -288,7 +285,6 @@ describe("addon resolution", function() { babelrc: false, plugins: ["foo"], }); - // eslint-disable-next-line max-len }).toThrow( /Cannot find module 'babel-plugin-foo'.*\n- Did you mean "@babel\/foo"\?/, ); @@ -303,7 +299,6 @@ describe("addon resolution", function() { babelrc: false, presets: ["testplugin"], }); - // eslint-disable-next-line max-len }).toThrow( /Cannot find module 'babel-preset-testplugin'.*\n- Did you accidentally pass a preset as a plugin\?/, ); @@ -318,7 +313,6 @@ describe("addon resolution", function() { babelrc: false, plugins: ["testpreset"], }); - // eslint-disable-next-line max-len }).toThrow( /Cannot find module 'babel-plugin-testpreset'.*\n- Did you accidentally pass a plugin as a preset\?/, ); diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index b8dfe9119a..533744b5dd 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -1,5 +1,3 @@ -/* eslint max-len: "off" */ - import template from "@babel/template"; const helpers = {}; @@ -26,7 +24,9 @@ helpers.jsx = () => template.program.ast` export default function _createRawReactElement(type, props, key, children) { if (!REACT_ELEMENT_TYPE) { - REACT_ELEMENT_TYPE = (typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7; + REACT_ELEMENT_TYPE = ( + typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") + ) || 0xeac7; } var defaultProps = type && type.defaultProps; @@ -431,7 +431,8 @@ helpers.inherits = () => template.program.ast` configurable: true } }); - if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } `; diff --git a/packages/babel-node/src/_babel-node.js b/packages/babel-node/src/_babel-node.js index 742b83d3f4..cb5e0210f8 100644 --- a/packages/babel-node/src/_babel-node.js +++ b/packages/babel-node/src/_babel-node.js @@ -21,7 +21,6 @@ function collect(value, previousValue): Array { return previousValue ? previousValue.concat(values) : values; } -/* eslint-disable max-len */ program.option("-e, --eval [script]", "Evaluate script"); program.option("-p, --print [code]", "Evaluate script and print result"); program.option( @@ -41,7 +40,6 @@ program.option( ); program.option("-w, --plugins [string]", "", collect); program.option("-b, --presets [string]", "", collect); -/* eslint-enable max-len */ program.version(pkg.version); program.usage("[options] [ -e script | script.js ] [arguments]"); diff --git a/packages/babel-plugin-transform-for-of/src/index.js b/packages/babel-plugin-transform-for-of/src/index.js index 01fe235981..057a6846fb 100644 --- a/packages/babel-plugin-transform-for-of/src/index.js +++ b/packages/babel-plugin-transform-for-of/src/index.js @@ -88,14 +88,16 @@ export default declare((api, options) => { } `); - /* eslint-disable max-len */ const buildForOf = template(` var ITERATOR_COMPLETION = true; var ITERATOR_HAD_ERROR_KEY = false; var ITERATOR_ERROR_KEY = undefined; try { - for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) { - } + for ( + var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; + !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); + ITERATOR_COMPLETION = true + ) {} } catch (err) { ITERATOR_HAD_ERROR_KEY = true; ITERATOR_ERROR_KEY = err; @@ -111,7 +113,6 @@ export default declare((api, options) => { } } `); - /* eslint-enable max-len */ function _ForOfStatementArray(path) { const { node, scope } = path; diff --git a/packages/babel-preset-env/src/index.js b/packages/babel-preset-env/src/index.js index 99464814af..249c468767 100644 --- a/packages/babel-preset-env/src/index.js +++ b/packages/babel-preset-env/src/index.js @@ -79,8 +79,8 @@ export const isPluginRequired = ( if (!semver.valid(lowestTargetedVersion)) { throw new Error( - // eslint-disable-next-line max-len - `Invalid version passed for target "${environment}": "${lowestTargetedVersion}". Versions must be in semver format (major.minor.patch)`, + `Invalid version passed for target "${environment}": "${lowestTargetedVersion}". ` + + "Versions must be in semver format (major.minor.patch)", ); } diff --git a/packages/babylon/src/parser/comments.js b/packages/babylon/src/parser/comments.js index ec8f22dd90..8b71cec739 100644 --- a/packages/babylon/src/parser/comments.js +++ b/packages/babylon/src/parser/comments.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - // @flow /** diff --git a/packages/babylon/src/parser/expression.js b/packages/babylon/src/parser/expression.js index d17cdf01e4..001ea6d897 100644 --- a/packages/babylon/src/parser/expression.js +++ b/packages/babylon/src/parser/expression.js @@ -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(); } } diff --git a/packages/babylon/src/parser/statement.js b/packages/babylon/src/parser/statement.js index f86f7af9b9..06de629e04 100644 --- a/packages/babylon/src/parser/statement.js +++ b/packages/babylon/src/parser/statement.js @@ -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.", ); } diff --git a/packages/babylon/src/plugins/flow.js b/packages/babylon/src/plugins/flow.js index c94cc8ba44..f9f4c02048 100644 --- a/packages/babylon/src/plugins/flow.js +++ b/packages/babylon/src/plugins/flow.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - // @flow import type Parser from "../parser"; @@ -261,7 +259,8 @@ export default (superClass: Class): Class => 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): Class => ) { 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): Class => 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", ); } diff --git a/packages/babylon/src/tokenizer/index.js b/packages/babylon/src/tokenizer/index.js index 48c1efc25d..ba34eb3f5f 100644 --- a/packages/babylon/src/tokenizer/index.js +++ b/packages/babylon/src/tokenizer/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - // @flow import type { Options } from "../options"; diff --git a/packages/babylon/src/tokenizer/state.js b/packages/babylon/src/tokenizer/state.js index 99046451e8..1e6ebf470b 100644 --- a/packages/babylon/src/tokenizer/state.js +++ b/packages/babylon/src/tokenizer/state.js @@ -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;