Reduce dependency on lodash functions: includes, uniq, repeat, isinteger (#11790)
* Replace lodash 'includes' usage with Array.prototype.includes * Replace lodash 'values' usage with Object.values * Replace lodash 'uniq' usage with Array.from(new Set(...)) * Property safety: ensure that ignoreSuites/ignoreTasks are populated prior to access * Property safety: ensure that blacklistTypes is populated prior to access * Revert "Replace lodash 'values' usage with Object.values" This reverts commit 9fd3679d6db03066daee09fad0050e5292a32aa1. * Replace lodash 'repeat' usage with String.prototype.repeat * Replace lodash 'isinteger' usage with Number.isInteger * Remove explicit lodash dependency from babel-generator package * Update packages/babel-helper-transform-fixture-test-runner/src/index.js Co-authored-by: Brian Ng <bng412@gmail.com> * Rely on optional chaining operator as sole boolean check * Handle additional optional chaining operator simplification * Update type signature Co-authored-by: Brian Ng <bng412@gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import fs from "fs";
|
||||
|
||||
import commander from "commander";
|
||||
import { version } from "@babel/core";
|
||||
import uniq from "lodash/uniq";
|
||||
import glob from "glob";
|
||||
|
||||
import pkg from "../../package.json";
|
||||
@@ -195,7 +194,7 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
|
||||
return globbed.concat(files);
|
||||
}, []);
|
||||
|
||||
filenames = uniq(filenames);
|
||||
filenames = Array.from(new Set(filenames));
|
||||
|
||||
filenames.forEach(function (filename) {
|
||||
if (!fs.existsSync(filename)) {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import readdirRecursive from "fs-readdir-recursive";
|
||||
import * as babel from "@babel/core";
|
||||
import includes from "lodash/includes";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
@@ -47,7 +46,7 @@ export function isCompilableExtension(
|
||||
): boolean {
|
||||
const exts = altExts || babel.DEFAULT_EXTENSIONS;
|
||||
const ext = path.extname(filename);
|
||||
return includes(exts, ext);
|
||||
return exts.includes(ext);
|
||||
}
|
||||
|
||||
export function addSourceMappingUrl(code: string, loc: string): string {
|
||||
|
||||
Reference in New Issue
Block a user