Update dev dependencies and fix linting errors (#10228)

* chore: Uppate dev dependencies

* chore: Fix lint errors

* chore: Format options.json files

* chore: Fix stupid flow errors

* Update test262 whitelist

Seems test262-stream was updated and now these tests work.
This commit is contained in:
Daniel Tschinder 2019-07-27 15:09:30 +02:00 committed by GitHub
parent 6a9d2538e0
commit 4f0840ab88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
242 changed files with 2866 additions and 1719 deletions

View File

@ -32,13 +32,13 @@
"derequire": "^2.0.2",
"duplicate-package-checker-webpack-plugin": "^2.1.0",
"enhanced-resolve": "^3.0.0",
"eslint": "^5.16.0",
"eslint": "^6.0.1",
"eslint-config-babel": "^9.0.0",
"eslint-plugin-flowtype": "^3.8.2",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-prettier": "^3.1.0",
"fancy-log": "^1.3.3",
"flow-bin": "^0.94.0",
"flow-bin": "^0.102.0",
"graceful-fs": "^4.1.15",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
@ -48,11 +48,11 @@
"gulp-rename": "^1.4.0",
"gulp-uglify": "^3.0.2",
"gulp-watch": "^5.0.1",
"husky": "^2.3.0",
"husky": "^3.0.0",
"jest": "^24.8.0",
"lerna": "^3.14.2",
"lerna-changelog": "^0.5.0",
"lint-staged": "^8.1.7",
"lint-staged": "^9.2.0",
"lodash": "^4.17.13",
"merge-stream": "^1.0.1",
"output-file-sync": "^2.0.0",

View File

@ -92,7 +92,7 @@ const assertTest = function(stdout, stderr, opts, cwd) {
if (
// saveInFiles always creates an empty .babelrc, so lets exclude for now
filename !== ".babelrc" &&
!opts.inFiles.hasOwnProperty(filename)
!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)
) {
const expected = opts.outFiles[filename];
const actual = actualFiles[filename];

View File

@ -268,13 +268,11 @@ function babelrcLoadEnabled(
});
}
const validateConfigFile = makeWeakCache(
(file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("configfile", file.options),
}),
);
const validateConfigFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("configfile", file.options),
}));
const validateBabelrcFile = makeWeakCache(
(file: ConfigFile): ValidatedFile => ({
@ -284,13 +282,11 @@ const validateBabelrcFile = makeWeakCache(
}),
);
const validateExtendFile = makeWeakCache(
(file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("extendsfile", file.options),
}),
);
const validateExtendFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("extendsfile", file.options),
}));
/**
* Build a config chain for just the programmatic options passed into Babel.
@ -549,7 +545,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
// "sourceMap" is just aliased to sourceMap, so copy it over as
// we merge the options together.
if (options.hasOwnProperty("sourceMap")) {
if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
options.sourceMaps = options.sourceMap;
delete options.sourceMap;
}

View File

@ -278,7 +278,7 @@ export function assertConfigFileSearch(
) {
throw new Error(
`${msg(loc)} must be a undefined, a boolean, a string, ` +
`got ${JSON.stringify(value)}`,
`got ${JSON.stringify((value: any))}`,
);
}
@ -302,7 +302,7 @@ export function assertBabelrcSearch(
} else if (!checkValidTest(value)) {
throw new Error(
`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` +
`or an array of those, got ${JSON.stringify(value)}`,
`or an array of those, got ${JSON.stringify((value: any))}`,
);
}
return (value: any);

View File

@ -1,7 +1,7 @@
// @flow
import type { PluginPasses } from "../../config";
import convertSourceMap, { type SourceMap } from "convert-source-map";
import convertSourceMap, { typeof SourceMap } from "convert-source-map";
import generate from "@babel/generator";
import type File from "./file";

View File

@ -1,6 +1,6 @@
// @flow
import type { SourceMap } from "convert-source-map";
import typeof { SourceMap } from "convert-source-map";
import sourceMap from "source-map";
export default function mergeSourceMap(

View File

@ -1,6 +1,6 @@
// @flow
import traverse from "@babel/traverse";
import type { SourceMap } from "convert-source-map";
import typeof { SourceMap } from "convert-source-map";
import type { ResolvedConfig, PluginPasses } from "../config";

View File

@ -1,3 +1,3 @@
{
"parserOpts": {"createParenthesizedExpressions": true}
"parserOpts": { "createParenthesizedExpressions": true }
}

View File

@ -1,5 +1,3 @@
{
"plugins": [
["proposal-private-methods", { "loose": false }]
]
"plugins": [["proposal-private-methods", { "loose": false }]]
}

View File

@ -1,5 +1,3 @@
{
"plugins": [
["proposal-private-methods", { "loose": true }]
]
"plugins": [["proposal-private-methods", { "loose": true }]]
}

View File

@ -169,9 +169,7 @@ export default function get(entryLoc): Array<Suite> {
if (minimumVersion == null) {
throw new Error(
`'minNodeVersion' has invalid semver format: ${
taskOpts.minNodeVersion
}`,
`'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`,
);
}

View File

@ -77,7 +77,7 @@ const assertTest = function(stdout, stderr, opts) {
const actualFiles = readDir(path.join(tmpLoc));
Object.keys(actualFiles).forEach(function(filename) {
if (!opts.inFiles.hasOwnProperty(filename)) {
if (!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)) {
const expected = opts.outFiles[filename];
const actual = actualFiles[filename];

View File

@ -1137,9 +1137,7 @@ export default class ExpressionParser extends LValParser {
if (node.property.name !== propertyName || containsEsc) {
this.raise(
node.property.start,
`The only valid meta property for ${meta.name} is ${
meta.name
}.${propertyName}`,
`The only valid meta property for ${meta.name} is ${meta.name}.${propertyName}`,
);
}

View File

@ -369,9 +369,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
) {
throw this.unexpected(
pattern.start,
`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${
pattern.type
}`,
"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern," +
`instead got ${pattern.type}`,
);
}
return pattern;

View File

@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws":"Identifier 'foo' has already been declared (2:9)"
"throws": "Identifier 'foo' has already been declared (2:9)"
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
"placeholders"
],
"plugins": ["placeholders"],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)"
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
"placeholders"
],
"plugins": ["placeholders"],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)"
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
"placeholders"
],
"plugins": ["placeholders"],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)"
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
"placeholders"
],
"plugins": ["placeholders"],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)"
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
"placeholders"
],
"plugins": ["placeholders"],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)"
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
"placeholders"
],
"plugins": ["placeholders"],
"sourceType": "module",
"throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)"
}

View File

@ -1,7 +1,5 @@
{
"sourceType": "module",
"plugins": [
"typescript"
],
"plugins": ["typescript"],
"throws": "Template literal types cannot have any substitution (1:14)"
}

View File

@ -1,7 +1,5 @@
{
"sourceType": "module",
"plugins": [
"typescript"
],
"plugins": ["typescript"],
"throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)"
}

View File

@ -1,7 +1,5 @@
{
"sourceType": "module",
"plugins": [
"typescript"
],
"plugins": ["typescript"],
"throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)"
}

View File

@ -1,7 +1,5 @@
{
"sourceType": "module",
"plugins": [
"typescript"
],
"plugins": ["typescript"],
"throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)"
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
["proposal-pipeline-operator", { "proposal": "fsharp" }]
],
"plugins": [["proposal-pipeline-operator", { "proposal": "fsharp" }]],
"parserOpts": {
"allowReturnOutsideFunction": true
},

View File

@ -1,7 +1,5 @@
{
"plugins": [
["proposal-pipeline-operator", { "proposal": "fsharp" }]
],
"plugins": [["proposal-pipeline-operator", { "proposal": "fsharp" }]],
"parserOpts": {
"allowReturnOutsideFunction": true
}

View File

@ -1,7 +1,5 @@
{
"plugins": [
["proposal-pipeline-operator", { "proposal": "smart" }]
],
"plugins": [["proposal-pipeline-operator", { "proposal": "smart" }]],
"parserOpts": {
"allowReturnOutsideFunction": true
},

View File

@ -1,7 +1,5 @@
{
"plugins": [
["proposal-pipeline-operator", { "proposal": "smart" }]
],
"plugins": [["proposal-pipeline-operator", { "proposal": "smart" }]],
"parserOpts": {
"allowReturnOutsideFunction": true
}

View File

@ -1,6 +1,10 @@
{
"parserOpts": {
"plugins": ["classProperties", "classPrivateProperties", "classPrivateMethods"]
"plugins": [
"classProperties",
"classPrivateProperties",
"classPrivateMethods"
]
},
"plugins": ["transform-modules-commonjs"]
}

View File

@ -314,9 +314,7 @@ export default declare((api, options, dirname) => {
node.callee = t.memberExpression(
t.callExpression(
this.addDefaultImport(
`${moduleName}/${corejsRoot}/instance/${
InstanceProperties[propertyName].path
}`,
`${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`,
`${propertyName}InstanceProperty`,
),
[context2],
@ -407,9 +405,7 @@ export default declare((api, options, dirname) => {
path.replaceWith(
t.callExpression(
this.addDefaultImport(
`${moduleName}/${corejsRoot}/instance/${
InstanceProperties[propertyName].path
}`,
`${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`,
`${propertyName}InstanceProperty`,
),
[object],
@ -421,9 +417,7 @@ export default declare((api, options, dirname) => {
path.replaceWith(
this.addDefaultImport(
`${modulePath}/${corejsRoot}/${
StaticProperties[objectName][propertyName].path
}`,
`${modulePath}/${corejsRoot}/${StaticProperties[objectName][propertyName].path}`,
`${objectName}$${propertyName}`,
),
);

View File

@ -1,3 +1,5 @@
{
"plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]]
"plugins": [
["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]
]
}

View File

@ -1,3 +1,5 @@
{
"plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]]
"plugins": [
["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]
]
}

View File

@ -1,3 +1,5 @@
{
"plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]]
"plugins": [
["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]
]
}

View File

@ -34,9 +34,7 @@ export default function() {
post() {
if (this.opts.debug && this.regeneratorImportExcluded) {
console.log(
`\n[${
this.file.opts.filename
}] Based on your targets, regenerator-runtime import excluded.`,
`\n[${this.file.opts.filename}] Based on your targets, regenerator-runtime import excluded.`,
);
}
},

View File

@ -22,9 +22,7 @@ export default function() {
post() {
if (this.opts.debug && this.usesRegenerator) {
console.log(
`\n[${
this.file.opts.filename
}] Based on your code and targets, added regenerator-runtime.`,
`\n[${this.file.opts.filename}] Based on your code and targets, added regenerator-runtime.`,
);
}
},

View File

@ -40,7 +40,7 @@ const isArray =
*/
function loadBuiltin(builtinTable, name) {
if (isArray(name) && typeof name[0] === "string") {
if (builtinTable.hasOwnProperty(name[0])) {
if (Object.prototype.hasOwnProperty.call(builtinTable, name[0])) {
return [builtinTable[name[0]]].concat(name.slice(1));
}
return;
@ -66,7 +66,7 @@ function processOptions(options) {
if (
isArray(preset) &&
typeof preset[0] === "object" &&
preset[0].hasOwnProperty("buildPreset")
Object.prototype.hasOwnProperty.call(preset[0], "buildPreset")
) {
preset[0] = { ...preset[0], buildPreset: preset[0].buildPreset };
}
@ -112,7 +112,7 @@ export const buildExternalHelpers = babelBuildExternalHelpers;
* Registers a named plugin for use with Babel.
*/
export function registerPlugin(name: string, plugin: Object | Function): void {
if (availablePlugins.hasOwnProperty(name)) {
if (Object.prototype.hasOwnProperty.call(availablePlugins, name)) {
console.warn(
`A plugin named "${name}" is already registered, it will be overridden`,
);
@ -135,7 +135,7 @@ export function registerPlugins(newPlugins: {
* Registers a named preset for use with Babel.
*/
export function registerPreset(name: string, preset: Object | Function): void {
if (availablePresets.hasOwnProperty(name)) {
if (Object.prototype.hasOwnProperty.call(availablePresets, name)) {
console.warn(
`A preset named "${name}" is already registered, it will be overridden`,
);

View File

@ -149,7 +149,7 @@ export function normalizeReplacements(
return acc;
}, {});
} else if (typeof replacements === "object" || replacements == null) {
return replacements || undefined;
return (replacements: any) || undefined;
}
throw new Error(

View File

@ -45,9 +45,7 @@ export default function populatePlaceholders(
(replacements && replacements[placeholder.name]) || null,
);
} catch (e) {
e.message = `@babel/template placeholder "${placeholder.name}": ${
e.message
}`;
e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`;
throw e;
}
});

View File

@ -25,9 +25,7 @@ export default function traverse(
if (parent.type !== "Program" && parent.type !== "File") {
throw new Error(
"You must pass a scope and parentPath unless traversing a Program/File. " +
`Instead of that you tried to traverse a ${
parent.type
} node without ` +
`Instead of that you tried to traverse a ${parent.type} node without ` +
"passing scope and parentPath.",
);
}

View File

@ -103,9 +103,7 @@ for (const type in t.NODE_FIELDS) {
}
for (let i = 0; i < t.TYPES.length; i++) {
let decl = `declare function is${
t.TYPES[i]
}(node: ?Object, opts?: ?Object): boolean`;
let decl = `declare function is${t.TYPES[i]}(node: ?Object, opts?: ?Object): boolean`;
if (t.NODE_FIELDS[t.TYPES[i]]) {
decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`;

View File

@ -18,7 +18,8 @@ import is from "../../validators/is";
function assert(type: string, node: Object, opts?: Object): void {
if (!is(type, node, opts)) {
throw new Error(
\`Expected type "\${type}" with option \${JSON.stringify(opts)}, but instead got "\${node.type}".\`,
\`Expected type "\${type}" with option \${JSON.stringify((opts: any))}, \` +
\`but instead got "\${node.type}".\`,
);
}
}\n\n`;

View File

@ -104,9 +104,7 @@ for (const type in t.NODE_FIELDS) {
}
for (let i = 0; i < t.TYPES.length; i++) {
let decl = `export function is${
t.TYPES[i]
}(node: object | null | undefined, opts?: object | null): `;
let decl = `export function is${t.TYPES[i]}(node: object | null | undefined, opts?: object | null): `;
if (t.NODE_FIELDS[t.TYPES[i]]) {
decl += `node is ${t.TYPES[i]};`;

View File

@ -4,6 +4,6 @@ import isNode from "../validators/isNode";
export default function assertNode(node?: Object): void {
if (!isNode(node)) {
const type = (node && node.type) || JSON.stringify(node);
throw new TypeError(`Not a valid node of type "${type}"`);
throw new TypeError(`Not a valid node of type "${(type: any)}"`);
}
}

View File

@ -9,7 +9,7 @@ function assert(type: string, node: Object, opts?: Object): void {
if (!is(type, node, opts)) {
throw new Error(
`Expected type "${type}" with option ${JSON.stringify(
opts,
(opts: any),
)}, but instead got "${node.type}".`,
);
}

View File

@ -8,9 +8,7 @@ export default function builder(type: string, ...args: Array<any>): Object {
const countArgs = args.length;
if (countArgs > keys.length) {
throw new Error(
`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${
keys.length
}`,
`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`,
);
}

View File

@ -282,23 +282,6 @@ built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js(
built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js(strict mode)
built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js(default)
built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js(strict mode)
language/comments/hashbang/escaped-bang-041.js(default)
language/comments/hashbang/escaped-bang-u0021.js(default)
language/comments/hashbang/escaped-bang-u21.js(default)
language/comments/hashbang/escaped-bang-x21.js(default)
language/comments/hashbang/escaped-hash-043.js(default)
language/comments/hashbang/escaped-hash-u0023.js(default)
language/comments/hashbang/escaped-hash-u23.js(default)
language/comments/hashbang/escaped-hash-x23.js(default)
language/comments/hashbang/escaped-hashbang.js(default)
language/comments/hashbang/multi-line-comment.js(default)
language/comments/hashbang/preceding-directive-prologue-sc.js(default)
language/comments/hashbang/preceding-directive-prologue.js(default)
language/comments/hashbang/preceding-empty-statement.js(default)
language/comments/hashbang/preceding-hashbang.js(default)
language/comments/hashbang/preceding-line-comment.js(default)
language/comments/hashbang/preceding-multi-line-comment.js(default)
language/comments/hashbang/preceding-whitespace.js(default)
language/expressions/assignment/destructuring/obj-prop-__proto__dup.js(default)
language/expressions/assignment/destructuring/obj-prop-__proto__dup.js(strict mode)
language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js(default)

3956
yarn.lock

File diff suppressed because it is too large Load Diff