Remove lodash (#12628)

* Replace `groupBy`

* Replace `partition`

* Replace `pick`

* Move `partition`

* Replace `uniqBy`

* Replace `fromPairs`

* Remove usage from website

* Reuse `partition`

* Remove from package.json

* Fix

* Use `ignore.default`

* Add `resolveConfig` to `FileInfoOptions`

* Explicit tuple types

* Make `cache` optional

* Fix cosmiconfig type

* Use `@ts-expect-error` for private property access

* Add type annotation for validate

* Fix type errors for `OptionInfo`

* Add `@ts-expect-error`

* Fix type of `normalizeOptions`

* Fix `OptionInfo` type

* Add `@ts-expect-error` for `option-normalizer`

* Avoid type error

* Fix typo

* Add types for lodash fns

Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
Sosuke Suzukiandfisker Cheung authored and GitHub committed 2022-04-10 15:26:07 +09:00
1 parent 991708420a
commit fa3b95c2e1
19 files changed
+155 -33

No files matched your search

@@ -1,4 +1,10 @@
const flat = require("lodash/flatten");
/**
* @template T
* @param {Array<Array<T>>} array
* @returns {Array<T>}
*/
// eslint-disable-next-line unicorn/prefer-spread
const flat = (array) => [].concat(...array);
const urls = [
"http://www.example.com:80/_a",
+2 -3
View File
@@ -2,7 +2,6 @@
const path = require("path");
const fs = require("fs");
const fromPairs = require("lodash/fromPairs");
const prettier = require("prettier-local");
const runPrettier = require("../run-prettier.js");
@@ -162,7 +161,7 @@ test("API getFileInfo.sync with filepath only", () => {
});
describe("API getFileInfo resolveConfig", () => {
const files = fromPairs(
const files = Object.fromEntries(
["foo", "js", "bar", "css"].map((ext) => [
ext,
path.resolve(
@@ -269,7 +268,7 @@ describe("API getFileInfo resolveConfig", () => {
});
describe("API getFileInfo resolveConfig when no config is present", () => {
const files = fromPairs(
const files = Object.fromEntries(
["foo", "js"].map((ext) => [
ext,
path.resolve(path.join(__dirname, `../cli/non-exists-dir/file.${ext}`)),